0

Can anyone please help me in calculating center of rotation and position of a X3D object? I've noticed that aopt tool by InstantReality adds something like:

<Viewpoint DEF='AOPT_CAM' centerOfRotation='x y z' position='x y z'/>

The result is nice, object is properly zoomed, centrated and center of rotation is somehow perfectly "inside" the object (x,y,z, center). I must avoid using aopt, how can I obtain that, (i.e. via JavaScript) pheraphs looping trough XML Coordinate point and doing some calculations...? I'm using X3DOM to render the object.

Many thanks.

Jumpa
  • 4,319
  • 11
  • 52
  • 100

1 Answers1

1

"AOPT_CAM" is the name of the Viewpoint. The centerOfRotation and position values are automatically computed by the Browser (InstantReality in your case).

In order to compute these values by yourself you need to know your object size (BoundingBox) and do some math to compute where the Viewpoint should be located ('position' attribute) in your local coordinate system. You also need to know the object displacement in the coordinate system. If not specified this should be (0,0,0)

Traian
  • 2,915
  • 1
  • 24
  • 32