Question

I have a set of 3D normal vectors for points on a 3D mesh, and I need to calculate the slope of the area below each of them. I have no idea how to do this. I don't need X or Y slope, I just need the total incline of the point in question (although to be fair, I don't know how to derive total slope from X and Y slope individually, which is part of my problem). I did see This article, but I couldn't really make heads or tails of it... The vectors are outward-facing. If anyone can explain this one to me, I'd be really grateful.

Was it helpful?

Solution

If you already have the normal vector, you're almost there. What you now need is the angle (look for dot product) between the normal and a vertical line (what exactly vertical means depends on your application).

If your normal vectors are actually normalized (have length 1) and the vertical is (0 0 1), the cosine of the slope angle is simply the z coordinate of the normal vector.

To demonstrate this: Take a pen and let it stand on your table. This is your table's normal vector. The angle between this vector and a vertical line is zero, as your table has no slope at all. If you tilt your table by a certain amount, the angle between the normal and a vertical line will increase by the same amount.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top