Google Answers Logo
View Question
 
Q: Arrow head on end of vector (Java 3D) ( No Answer,   1 Comment )
Question  
Subject: Arrow head on end of vector (Java 3D)
Category: Science > Math
Asked by: tenaciouscolin-ga
List Price: $20.00
Posted: 20 Sep 2005 18:33 PDT
Expires: 28 Sep 2005 21:55 PDT
Question ID: 570342
This is a question that will be used in Java 3D, but it is really a
geometry problem.

I am trying to draw a vector as an arrow. The line segment part is
simple; I just connect two points. Each point is represented by a
(x,y,z) coordinate. I want to place a solid tetrahedron on the end of
the line segment so that it will make an arrow that will show up well
even when the shape is rotated.

The point at the tip of the arrow will have the coordinates of the end
point of the line segment. Easy. My question is, how do I calculate
the coordinates of the three other points of the tetrahedron?

Here is a drawing I made to help illustrate the problem:
http://colinpotter.dyndns.org/~colin/vector.gif

Thank you much,
 Colin
Answer  
There is no answer at this time.

Comments  
Subject: Re: Arrow head on end of vector (Java 3D)
From: chiao-ga on 21 Sep 2005 21:08 PDT
 
This problem would be really easy if the line was pointing in the
z-axis, since then if I label the pointy end as p2, the three points
would simply be

p2 + (R*cos(theta_i),R*sin(theta_i),-L)

where theta_i = 2Pi/3*i + phi, where i = 0,1,2 and you get to choose phi

---

In the given coordinates, this would be

p2 + R*cos(theta_i)*x_new + R*sin(theta_i)*y_new -L*z_new

where theta_i = 2Pi/3*i + phi, where i = 0,1,2 and you get to choose phi

We have to find x_new, y_new and z_new, which are 3 unit vectors.

z_raw = p2-p1
z_new = z_raw/|z_raw| 

where p2 is the pointy end and p1 is the other end of the line, and
|z_raw| is the length of the line.

y_new and x_new simply have to be unit vectors perpendicular to each
other and to z_new. One way of finding some vectors that work is
below.

---

You have to first guess a vector v which is not parallel to z_new. 

Out of z_new_x, z_new_y, and z_new_z, pick the direction with the
smallest magnitude and construct a unit vector in that direction. This
would be either (1,0,0),(0,1,0) or (0,0,1). Call this vector v.

y_raw = v - (v.n)*n where v.n is a dot product
y_new = y_raw/|y_raw|

x_new = cross_product(y_new,z_new)

---

This seems kinda complicated, but the part about determining x_new and
y_new is so long only because you can't quite avoid running into the
problem of accidentally trying a vector which is parallel to the
original line.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy