Roof plane dihedral angle

Started by
4 comments, last by haegarr 12 years, 4 months ago
I need to calculate the dihedral angle formed by two adjoining slant roofs of a building. It is the exterior angle (or reflex angle) and not the interior angle. Based upon this angle, I want to determine if these two roofs form a hip or a valley. More information on hip and valley is found here: http://en.wikipedia.org/wiki/Hip_roof

I have looked at the intersecting plane angles which is the angle formed by the the two normals of these two roof planes. This would give me the angle alright that would be the interior angle but is not sufficient to decide if it is a hip or valley. Besides a similarly angled hip or roof valley would have the same angle. Is there a way to find the exterior angle of two intersecting hip or valley roofs?

Thanks!
Advertisement
I'm not entirely sure that I understand your question completely but here is my attempt at answering it.

Firstly, to make things simple I would make sure the normals you have for each plane are all pointing to the interior. To do this check if the Y component is negative (angled downwards) and if it isn't multiply the normal by -1, then just use the dot product to determine the angle between the normals:

float normalsAngle = arccos(dot(n1, n2));

If the angle is less than 180 then it is a hip, else it is a valley.

I haven't tested this so let me know if I've made any obvious errors :-)

EDIT: Fixed an obvious error.
i think you do this when your tesselating polygon contours to fill them up with triangles, you test for a hip or valley, and only select hips, not valleys, cause the valleys would make anticlockwise triangles.

...
float normalsAngle = arccos(dot(n1, n2));

If the angle is less than 180 then it is a hip, else it is a valley.
...

The dot-product is commutative, so it cannot be used to distinguish a valley from a hip (as the OP already has stated). The result of arccos is restricted to a range of 180 degree, so it cannot be used at all for a comparison as suggested.


i think you do this when your tesselating polygon contours to fill them up with triangles, you test for a hip or valley, and only select hips, not valleys, cause the valleys would make anticlockwise triangles.

The OP speaks of "buildings" and "roofs" and links to a wikipedia page that handles those explicitly. So I assume that the problem is exactly as described.

However, the idea is not that bad: Polygon tesselation knows of the same kind of problem. Therein it is solved e.g. by having the additional information coming from the order of edges and the initial condition of being "outside" (see the sweeping line algorithms).

Think of a horizontal plane that cuts the roof, e.g. in the middle of the roof height. The cutting lines would define the edges of a polygon. Then the usual algorithms can be applied. However, you do not need to perform the cut in real. It is (IMHO, w/o having tested it) sufficient to use the connectivity information of the roof planes as well as the x,z (assuming y denotes the height) components of the normals as a simple kind of projection onto the cutting plane.

The dot-product is commutative, so it cannot be used to distinguish a valley from a hip (as the OP already has stated). The result of arccos is restricted to a range of 180 degree, so it cannot be used at all for a comparison as suggested.

Yes, the angle being commutative is the limitation is using the arccos of the dot product.


However, the idea is not that bad: Polygon tesselation knows of the same kind of problem. Therein it is solved e.g. by having the additional information coming from the order of edges and the initial condition of being "outside" (see the sweeping line algorithms).

Think of a horizontal plane that cuts the roof, e.g. in the middle of the roof height. The cutting lines would define the edges of a polygon. Then the usual algorithms can be applied. However, you do not need to perform the cut in real. It is (IMHO, w/o having tested it) sufficient to use the connectivity information of the roof planes as well as the x,z (assuming y denotes the height) components of the normals as a simple kind of projection onto the cutting plane.

I would like to try this suggestion. Can you please elucidate a bit more on this? (I consider the screen as the XY plane with Z coming out vertically from it). Considering two simple roof planes of four edges each, and cutting plane intersecting them in the middle, which edges would define the polygon? Thank you!

...I would like to try this suggestion. Can you please elucidate a bit more on this? (I consider the screen as the XY plane with Z coming out vertically from it). Considering two simple roof planes of four edges each, and cutting plane intersecting them in the middle, which edges would define the polygon? Thank you!

Looking at the example picture showing a square hip roof on the wikipedia page referred to in the OP, one can see 4 red triangles together defining the roof. If an infinite plane parallel to the ground is placed at the half high of the roof, then the common space of the roof planes and the infinite plane gives you an edge trail in form of a square. The edge trail becomes a rectangle if you do the same with the roof shown in the picture above the former one. And it becomes a T if you do the same with the roof shown in the picture below it. However, in each case you can interpret the edge trail as the (closed) contour of a polygon.

The contour gives you an order for the roof planes in the sense that you can not only pick a pair of adjacent planes but also can say which one of both is the first and which one is the second. (You may have enough neighborhood information already at hand, I don't know.) Then you can use the cross-product with the normals of 2 adjacent planes. The cross-product is not commutative, and with the definition of before and behind normals you have a clear prescription which one to use on the left and which one to use on the right of the cross sign.

Assuming that the global up direction is z, then you just need to compute the z co-ordinate of the cross-product, i.e
z' := x[sub]1[/sub] * y[sub]2[/sub] - y[sub]1[/sub] * x[sub]2[/sub]
and look at the sign: If the sign is negative then you have a hip, otherwise a valley.

Well, this is all theory. You have to check it, of course.

This topic is closed to new replies.

Advertisement