How can I calculate the normal vector giving a vertex on a 2D plane in OpenGL. ?

All what I read was all about 3D and cross product of two vectors. the only thing that I have is that vertex and I want to construct a vector coming out of it.

any help?


Edited by jowana: n/a

7 Years
Discussion Span
Last Post by jowana

The problem isn't with OpenGL - it is just an interface to display stuff on the screen. Calculating the vector is the main problem. That is simple calculus or vector algebra. Refresh your math and go from there!


the reason for drawing this vector is to be the start of my rotation,
thats why I chose openGL becuase i need to apply some graphics after that.


giving a vertex on a 2D plane

What information do you have about the plane? (equations, points, etc?)

This does a nice job of explaining things.

Edited by jonsca: n/a


To get the normal out of a vertex on the edge of a 2D polygon, you take the vector that goes from the point just before to the point just after, and then you rotate that vector by 90 degrees ccw (right-hand rule). You can do that by swaping (x,y) with (-y,x). That's all! (it's actually the same as taking the cross-product, in 3D, with a vector pointing directly out of the 2D plane).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.