-1

I need a function so that, when given the Vector3 for a, b and c, will give me a new Vector3, the rotation of the Triangle. Pretty much, for point d, if I want to move it out, adjacent to the triangle, I just have to multiply the distance I want to move it by the Vector3 rotation, and add the old position to get the new Location. Triangle

Community
  • 1
  • 1
Diode II
  • 21
  • 3
  • Why the -1? was it not clear? – Diode II Nov 02 '14 at 21:33
  • I didn't find it clear. What vector are you looking for? "The rotation of the triangle" doesn't make sense. If you want to move point D out of the triangle, then any vector will do as long as you move it far enough. – Blorgbeard Nov 03 '14 at 00:49
  • By rotation, I mean if I wanted to move point D out into space, but adjacent to the face of the triangle. So if I wanted to move the point 1 unit out, I would take the "Rotation", and multiply that by how far I wanted to move the point, then add the original position. – Diode II Nov 03 '14 at 03:20
  • Oh, in 3d, perpendicular to the plane of the triangle? – Blorgbeard Nov 03 '14 at 03:38
  • Take the cross-product of any two edges of the triangle, and normalize the result. Look [here](http://math.stackexchange.com/questions/305642/how-to-find-surface-normal-of-a-triangle) for details. – Blorgbeard Nov 03 '14 at 03:44

1 Answers1

0

The vector you want is called the unit normal vector. "Unit" means the length is 1 (so that you can just multiply by distance), and "normal" is the name of the vector that's perpendicular to a surface.

To get it, take the cross-product of any two edges of your triangle, and normalize the result. Look at this question for details on how to do this mathematically.

Note: "Normalizing" a vector means to keep the direction the same, but change the length to 1. It doesn't directly relate to a "normal vector".

Community
  • 1
  • 1
Blorgbeard
  • 93,378
  • 43
  • 217
  • 263