开发者

projected surface normal vector onto xy plane

开发者 https://www.devze.com 2023-02-09 04:46 出处:网络
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 g

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号