------ =_NextPart_001_01C0A7F9.B75F9004
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

You could do some things with geometry using tangents, or you could =
just
use Java3D to do it for you.
=A0
I assume you want the object to be "sitting on" the sphere.=A0 Assuming
the the object's "up" is positive Z, look at these thoughts:
=A0
Given a selected position on the sphere (longitude, latitude) of radius
R
=A0
1. Put the object "on the surface" at the "north pole".
Transform3D=A0xform1 =3D new Transform3D();
xform1.setTranslation( new Vector3f( 0f, 0f, R) );
TransformGroup tg1 =3D new TransformGroup( xform1 );
=A0
2. Next, rotate tg1 to the correct latitude by rotating around the
y-axis; measure angle relative to north pole: [0, 180deg]=A0 equator =
=3D
90deg, south pole 180deg
Transform3D xform2 =3D new Transform3D();
xform2.rotY( Math.toRadians( latitude ) );
TransformGroup tg2 =3D new TransformGroup( xform2 );
tg2.addChild( tg1 );
=A0
3. Finally, do the longitude, measure CCW from +x axis [0, 360deg]
Transform3D xform3 =3D new Transform3D();
xform3.rotZ( Math.toRadians( longitude ) );
TransformGroup tg3 =3D new TransformGroup( xform3 );
tg3.addChild( tg2 );
=A0
Add your shape to tg1.
=A0
I could show you how this works in diagrams, but then everybody would
think I am REALLY anal.=A0 Also, you don't "really" need all the TGs...
could just make the Transform3Ds and multiply them together and place
them in one TG.
=A0
Hope this helps...
-Lee

-----Original Message-----
From: Sackmunky [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 12:29 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Positioning object


I know that this forum is on the "proggramming aspect of java3d" but =
can
anyone help on this.
I have a Sphere at(0.0.0)
and an object that I want to place on the Sphere. Whereever I place it,
I want it to always rotate the center point of that object to (0,0,0).
Can anyone help?
=A0
Zak
=A0
PS. They were saying something about the tangent lines.....etc. I am
very weak in geometry. :(=A0=A0=A0=20


------ =_NextPart_001_01C0A7F9.B75F9004
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">


<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>You=20
could do some things with geometry using tangents, or you could just =
use Java3D=20
to do it for you.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>I=20
assume you want the object to be "sitting on" the sphere.&nbsp; =
Assuming the the=20
object's "up" is positive Z, look at these =
thoughts:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>Given=20
a selected position on the sphere (longitude, latitude) of radius=20
R</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>1. Put=20
the object "on the surface" at the "north pole".</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>Transform3D&nbsp;xform1 =3D new=20
Transform3D();</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>xform1.setTranslation( new Vector3f( 0f, 0f, =
R)=20
);</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>TransformGroup tg1 =3D new TransformGroup( =
xform1=20
);</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>2.=20
Next, rotate tg1 to the correct latitude by rotating around the y-axis; =
measure=20
angle relative to north pole: [0, 180deg]&nbsp; equator =3D 90deg, =
south pole=20
180deg</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>Transform3D xform2 =3D new=20
Transform3D();</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>xform2.rotY( Math.toRadians( latitude )=20
);</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>TransformGroup tg2 =3D new TransformGroup( =
xform2=20
);</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>tg2.addChild( tg1 );</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>3.=20
Finally, do the longitude, measure CCW from +x axis [0,=20
360deg]</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>Transform3D xform3 =3D new=20
Transform3D();</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>xform3.rotZ( Math.toRadians( longitude )=20
);</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>TransformGroup tg3 =3D new TransformGroup( =
xform3=20
);</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>tg3.addChild( tg2 );</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>Add=20
your shape to tg1.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>I=20
could show you how this works in diagrams, but then everybody would =
think I am=20
REALLY anal.&nbsp; Also, you don't "really" need all the TGs... could =
just make=20
the Transform3Ds and multiply them together and place them in one=20
TG.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D224005917-08032001>Hope=20
this helps...</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D224005917-08032001>-Lee</SPAN></FONT></DIV></SPAN></FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B> Sackmunky=20
  [mailto:[EMAIL PROTECTED]]<BR><B>Sent:</B> Thursday, March 08, =
2001 12:29=20
  PM<BR><B>To:</B> [EMAIL PROTECTED]<BR><B>Subject:</B> =
[JAVA3D]=20
  Positioning object<BR><BR></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>I know that this forum is on the =
"proggramming=20
  aspect of java3d" but can anyone help on this.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>I have a Sphere =
at(0.0.0)</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>and an object that I want to place =
on the Sphere.=20
  Whereever I place it, I want it to always rotate the center point of =
that=20
  object to (0,0,0). Can anyone help?</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Zak</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>PS. They were saying something about =
the tangent=20
  lines.....etc. I am very weak in geometry. :(&nbsp;&nbsp;&nbsp;=20
</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------ =_NextPart_001_01C0A7F9.B75F9004--

===========================================================================
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".

Reply via email to