Angle b/t Point and plane

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
NewImage
Posts: 8
Joined: Wed Feb 11, 2009 3:07 am

Angle b/t Point and plane

Post by NewImage »

HI

I have a point in space, and a plane and im trying to figure out how to find the angle between the two. Not just any angle but the smallest angle.

the plane runs through me, its like seeing a star in the sky and figuring out the angle that star is off the horizon

If i could find the point on the plane closest to the point in space, i could use trig and get the angle easy, but i cant figure out how to find that point on the plane.

any help would be great thanks.
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

easy one:

projected_point = point - plane.Normal * plane.getDistanceTo(point);
angle = plane.Normal.dotProduct((projected_point - point).normalize());

As you can see there is a simplification possible:
angle = plane.Normal.dotProduct((-(plane.Normal * plane.getDistanceTo(point)) - point).normalize());
NewImage
Posts: 8
Joined: Wed Feb 11, 2009 3:07 am

Post by NewImage »

nox you rock, that worked

thanks
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

Well im only a lost soul tortured by neverending linear algebra lessions 8)
Post Reply