Dola,
Please allow me to suggest another improvement.
I notice that in your code, when you set normals, you are setting then to
a Vector3f. However, you are first reading the normals into a Vector3d.
Therefore, you are using the Vector3d as a temporary storage class in
order to allow the creation of your Vector3f.
Therefore, you are causing, I believe, unnecessary object allocations each
time you call "new Vector3d", and that will eventually lead to unnecessary
object garbage collections.
A better approach in terms of memory footprint, and performance, would be
to allocate a SINGLE Vector3d before your loop starts. Then set the value
of the vector each time before you feed it into the Vector3f, using
Vector3d.set().
e.g.
Vector3d tempVect = new Vector3d();
LOOPSTART
...
tempVect.set(normals[node]);
ta.setNormal(node, new Vector3f(tempVect));
LOOPEND
I hope this helps some.
Sincerely,
Ian Nieves
> Hi,
>
> I have had this problem for about 6 months now. Last
> time I posted it, a few folks offered to take a look
> at my code. I haven't sent my code to anyone bacause I
> wanted to test it on various systems. I'm having the
> same problem on all systems.
>
> 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.
>
> Any ideas? Thanks!
>
> Dola
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
>
> ===========================================================================
> 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".
>
>
===========================================================================
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".