niro
niro

Reputation: 977

projected surface normal vector onto xy plane

i have a plane whose equation is ax+by-z+d=0. hence, its normal vector (a,b-1). Now, i need to project my vector to xy plane in order to compute direction of it from the North axis (i guess it is Y axis in here. please help me to get projected vector. thank you.

Upvotes: 2

Views: 2217

Answers (1)

Xeo
Xeo

Reputation: 131789

I think what you're looking for is the dot product. Finding the direction the plane is facing is pretty easy that way.

// generic code, actual code depends on your engine.
// BasePlane.GetNormal() would equal to (0,0,1) for the X/Y plane
float dir = YourPlane.GetNormal().Dot(BasePlane.GetNormal());

If it equals to 1, your plane faces the same direction as the plane you're testing against. If it equals to -1, it's facing the the plane. Equalling to 0 would mean the plane stands orthogonal to the tested plane. Hope this helps.

Upvotes: 1

Related Questions