Re: [script] output triangle count

Date : Tue, 27 Nov 2007 16:24:57 -0000 (GMT)
To : XSI(at)Softimage.COM
From : "Andy Nicholas" <andy(at)andynicholas.com>
Subject : Re: [script] output triangle count
It's basically going to be like this for each polygon inside that 1D array
of polygons:

[N, i1, i2, i3, i4, i5...]

where N gives the number of indices for that polygon. It'd then be
followed by more definitions until you reach the end of the array.

But looking at it, it does seem slightly tricky to use as you'll have to
go through every single polygon skipping the indices to total up how many
triangles each polygon uses (based on numtriangles = numindices-2).

I'd advise you to write a C++ command to get the information because a)
using a script to do this willalmost certainly be pretty slow, and b)
there's a GetTriangleCount() method in the C++ CGeometryAccessor class
which does exactly what you want already.

Cheers

Andy


> Thanks Guillaume and Andy.
>
> Sorry for being obtuse, but I don't quite understand what the doc says
> about the polygon data returned by the call:
>
> 2) polygon data: ordered array of polygon definitions,
> each polygon is defined by a list of elements,
> the first element of a polygon definition must be set with the number
> of indices for that polygon.
> The ordering of vertices must respect a ccw ordering to get out going
> normals (right-hand rule).
> E.g. array of polygons with 4 indices each e.g. {4,0,1,4,3,4,1,2,5,4... }
>
> Sorry but this is almost chinese for me. I mean heck, I just want to
> know how many polygons there are in the object. An unsubdivided sphere
> gives me an array length of 304, where it has 96 quads and 16
> triangles......
>
>
> Thanks
> Bernard
>
>
>
>
>
> On Nov 27, 2007 10:25 AM, Guillaume Laforge <guillaume(at)alamaison.fr>
> wrote:
>> Hi Bernard,
>>
>> The GetApproximatedMesh  method gives you the description of the
>> sudivided mesh. Maybe you can find triangles count from there ?
>>
>> My non subdived 1/2
>>
>>
>> Guillaume Laforge | La Maison
>>
>>
>>
>> Bernard Lebel a écrit :
>>
>> > Hello,
>> >
>> > Is there a way to find out, in scripting, the "output" triangle count?
>> > For instance, when I run something like
>> >
>> > logmessage( selection(0).activeprimitive.geometry.triangles.count );
>> >
>> > no matter how high the geoapprox setting is, it's always returning the
>> > same value. I'd like to know how many triangles there are *after* the
>> > geometry approximation.
>> >
>> >
>> > Thanks
>> > Bernard
>> > ---
>> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
>> body:
>> > unsubscribe xsi
>> >
>>
>> ---
>> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
>> body:
>> unsubscribe xsi
>>
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>



---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.