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

Don Brutzman brutzman at nps.navy.mil
Wed Jun 24 12:07:11 PDT 2009


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-X3DLanguageBindings-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-X3DLanguageBindings-ECMAScript/Part1/functions.html#t-SFRotationInstanceCreationFunctions

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 




More information about the X3D-Public mailing list