John R,

At 22:13 11.08.00 , you wrote:
>I have two cylinders (pipes actually) that I'm trying to draw an "arrow"
>between to show flow direction.  So, what I really have is 2 3D points.
>(Transformation matricies actually, but only containing translation.)
>
>Call these two points, A and B.
>
>And what I want to do is, create a standard "arrow" inside a transform
>group and translate it to the midpoint of A and B, and rotate it such
>that it "points" at B.

My experience with this stuff is limited; but I've had similar battles and
eventually won, so I may know how to solve your problem.

I think we'll need points, not transforms, to specify the endpoints.

The midpoint between A and B is easy:

Point3d midPt = new Point3d((A.x + B.x) / 2, (A.y + B.y) / 2, (A.z + B.z) / 2);

For the rotation, I would (ab)use the "lookAt" convenience method of
Transform3D:

Transform3D direction = new Transform3D();
direction.lookAt(midPt, B, new Vector3d(0, 1, 0));

After this, "direction" should at least point the right way; if your arrow
ends up
at the center of the universe rather than between your pipes, you'll need

direction.setTranslation(midPt)

to move it where you want it.

If this doesn't work, let me know and I'll build it in actual code and try
to work it
out from there.

-Carl-

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