> Date: Wed, 26 Feb 2003 18:02:07 -0800
> From: Dola Woolfe <[EMAIL PROTECTED]>
>
> Basically, updating coordinates takes an unpredictable
> (and usually very long) amount of time. The following
> code takes anywhere from .03sec to 120sec.
>
> VDouble[] normals = gCalculateUnitNormals(surf);
>
> for (int node = 0; node <
> surf.pGetNumberOfNodes(); node++) {
> ta.setCoordinate(node, surf.pGetX(node));
> ta.setNormal(node, new Vector3f(new
> Vector3d(normals[node])));
> }
>
> The surface has about 600 nodes.
Not sure about the unpredicatable speed of the update, but you can surely speed
this up by consolidating your coordinate updates. Individual calls to
setCoordinate() and setNormal() are heavy-weight compared to updating a bunch
of vertices at once with setCoordinates() and setNormals(). Each such
individual call injects a geometry change notification into the system which
has to processed one by one.
Also note that you're in by-copy mode, so you're working on data that has to be
copied into the Java 3D system. You can avoid copies by using GeometryArray
by-reference semantics.
-- Mark Hood
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".