projected surface normal vector onto xy plane
i have a plane whose equation i开发者_JAVA百科s 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.
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.
精彩评论