[X3D-Public] computing an SFRotation from 2 points?

Tony Parisi tparisi at vivaty.com
Wed Jun 24 12:13:17 PDT 2009


It's a dot product for the rotation and a cross product for the axis.
Google those plus Java and you should find a bunch of references.



-----Original Message-----
From: x3d-public-bounces at web3d.org [mailto:x3d-public-bounces at web3d.org]
On Behalf Of Don Brutzman
Sent: Wednesday, June 24, 2009 12:07 PM
To: Source at Web3d. Org; X3D Graphics public mailing list
Subject: [X3D-Public] computing an SFRotation from 2 points?

newbie question:  want to compute an SFRotation orientation from
2 SFVec3f point locations using Java.

fyi this will be used in X3D-Edit as an authoring assist, to compute
the desired Viewpoint orientation (relative to -z axis default view)
that aims the Viewpoint from defined position towards a look-at point.

prefer to use X3D SAI for Java if possible.  however i am not finding
any
utility functions in the spec:
http://www.web3d.org/x3d/specifications/ISO-IEC-19777-2-X3DLanguageBindi
ngs-Java/Part2/X3D_Java.html

however the X3D SAI for ECMAScript does have such a utility method:
Table 7.18 - SFRotation instance creation functions
	SFRotation  	(SFVec3f fromVector, SFVec3f toVector)
	fromVector and toVector are normalized and the rotation value
	that would rotate from the fromVector to the toVector is stored
	in the object.
http://www.web3d.org/x3d/specifications/ISO-IEC-19777-1-X3DLanguageBindi
ngs-ECMAScript/Part1/functions.html#t-SFRotationInstanceCreationFunction
s

thanks in advance for pointers or any example code, either using
Java SAI or simply some other exemplar Java source.

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br
brutzman at nps.edu
Watkins 270   MOVES Institute, Monterey CA 93943-5000 USA  work
+1.831.656.2149
X3D, virtual worlds, underwater robots, XMSF
http://web.nps.navy.mil/~brutzman 


_______________________________________________
X3D-Public mailing list
X3D-Public at web3d.org
http://web3d.org/mailman/listinfo/x3d-public_web3d.org





More information about the X3D-Public mailing list