2
\$\begingroup\$

I'd like to know how to draw an arrow to represent a vector position, length and direction.

The issue is that I can't quite find an easy way to know the location and rotation of the triangle representing the arrow head.

If it can help, I'm using OpenGL/OpenTK(wrapper for C#).

\$\endgroup\$
1
\$\begingroup\$

What I'd do:

Have your standard arrow draw from (0, 0, 0) to (1, 0, 0) (using a line) and the tip of the arrow be a triangle at the end (using a triangle, points at (0.95, 0, +/-0.025) and (1, 0, 0)). Then resize your arrow to the size you need with a scale matrix (since it's a unit vector, it's easy to have it the desired size) and then move your arrow to wherever you need it with a translation and a rotation matrix.

And you can reuse it wherever you like!

Of course, you have to decide where you want it first, and remember that it is pointing in x+ when moving it around..!

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.