Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Let's say we have a 2D Polygon ( it can be concaved or convex), and on top of this polygon we are required to build a house roof. What is the algorithm that one can use for this?

The conditions:

  1. The roof cannot be 0 degree or 90 degree.
  2. The created roof piece must be as smooth as possible ( smooth is defined as first order differentiable), meaning the slope of the roof must not change unnecessarily.

I'm sorry if the conditions sound vague. If you get lost, just think about this: you have a house, how do you generate the roof profile?

Note: The roof plan must be uniformly sloping, so no circle, or bump can be used.

share|improve this question
    
Is the polygon the "floor plan" of the house? –  Blue Jan 5 '11 at 4:25
    
@Day, you can say that –  Graviton Jan 5 '11 at 4:29
2  
How about drawing a circle around the polygon, building a hemispherical dome over it, then slicing off the parts of the dome that extend beyond polygon? –  Blue Jan 5 '11 at 4:35
    
@Day, no, that's not what I have in mind :) –  Graviton Jan 5 '11 at 5:48
    
@Ngu: What additional characteristics is the roof to have? Maybe that it's the same height along the perimeter of the polygon? Have you looked at "bump functions"? en.wikipedia.org/wiki/Bump_function –  Blue Jan 5 '11 at 7:25

3 Answers 3

up vote 2 down vote accepted

Try computing the straight skeleton of the polygon. See also http://www.sable.mcgill.ca/~dbelan2/roofs/roofs.html and http://www.vterrain.org/Culture/BldCity/Roof/ for instance.

share|improve this answer

Here is an image I happen to have prepared for a book. It shows the medial-axis polyhedron over a convex polygon, which coincides with the straight skeleton as in lhf's answer, and also with the offset-procedure in alQpr's answer. Sides slope at $45^\circ$.
MedialAxis Polyhedron

share|improve this answer
    
That's the graph of the distance to the polygon's boundary. –  whuber Jan 6 '11 at 0:00
    
yup!! This is what I want. You have an algorithm for this? –  Graviton Jan 6 '11 at 1:18
    
Sorry I never replied---Somehow I missed these comments. @whuber: Yes, precisely. –  Joseph O'Rourke Nov 22 '11 at 22:11
    
@Graviton: The algorithm is described in Discrete and Computational Geometry, Chapter 5. –  Joseph O'Rourke Nov 22 '11 at 22:11

Start at the outside. Step inwards a small amount to generate a first level (polygonal) curve at a small height above the wall. Project "ridge" lines from outward corners of house (or crotch lines for inside corners) through corresponding corners of the new polygon (I guess they'll be bisecting the angles of the original polygon) and whenever two or more ridgelines, or two or more of the edges meet, repeat the process starting with the reduced polygon(s) which give the level curve through the point of intersection.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.