I think the reason that the methods are destructive to the operands is for performance. To be non-destructive would require the overhead of creating a new instance of a Vector3D for each operation to store the result. An approach worth bearing in mind for your own code - reuse the same instances of Classes like Vector3D etc. I do some complex vector algebra in one of my programs, and I pre-initialise thirty or so Vectors and Matrices, so that I never have to create a new instance during the calculations - it is MUCH faster this way!!
Lewis. -----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED] On Behalf Of Steven T. Hatton Sent: 26 July 2003 19:34 To: [EMAIL PROTECTED] Subject: [JAVA3D] Is javax.vecmath Inelegant? I've already posted my gripe about the Canvas3D stubbornness. Another thing I find distasteful in the Java3D SDK is the javax.vecmath api. Why on the greenswords of Midgard did anybody make all these methods return void? Is there a pragmatic reason for this? I hate it! If I could do things like this: Vector3d v = new Vector3d(); return v.add(v1,v2); I would use a good deal less profanity when writing Java3D code. Perhaps there is a different paradigm I need to grasp in order to understand the advantange to doing things this way. Personally, I would rather the mathematical operations were nondestructive; that is, they left the operands alone. My guess is, that is so far out of the realm of realistic modifications to the api that it's not worth discussing. Could the javax.vecmath package be modified to make the operators return the result, rather than void? BTW, is the source available somewhere for this stuff? I fetched the stuff at j3d.org's cvs, but it looks to be all addon stuff. I haven't looked really closely, but all I see is a src/org/... branch in the source tree. Steven ======================================================================== === 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".
