-
Notifications
You must be signed in to change notification settings - Fork 208
Profiled roofs
This document provides illustrations for the code in building/roof/profile.py
An example roof profile for a gambrel roof shape is shown on the image below:
And the resulting roof:
Any valid roof profile must have the following properties:
- The profile is defined on the horintal axis X between the coordinates 0.0 and 1.0. So the smallest X-coordinate must be 0.0, the largest X-coordinate must be 1.0.
- The largest coordinate on the vertical axis Z must be 1.0.
The X-axis of the roof profile coincides with the direction of the roof as defined by self.direction. The leftmost vertex of the building outline on the X-axis of the profile has X-coordinate 0.0, the rightmost one has X-coordinate 1.0 as shown on the image below:
For each point of the profile an instance of the Slot class is created as shown on the image Main. The Slot class is used to form faces for the profiled roof. Each instance of the Slot class has a Python list parts. A part is sequence of vertices that start at a slot and ends at the same slot or at a neighboring one. Y-coordinate of the first vertex of the part in the coordinate system of the profile is stored for each part.
- Create an instance of the building/roof/profile/RoofProfile class giving it a structure like gabledRoof, roundRoof, gambrelRoof or saltboxRoof from building/roof/profile/RoofProfile. The class will be used to process all buildings or building parts with the given shape.
For each building or building part with the given roof shape
-
Call RoofProfile.init(..):
It calls in turn Roof.init(..). The latter methods creates an instance of util/polygon/Polygon for the outline. The constructor of Polygon class removes straight angles to calculate the default roof direction correctly -
Call RoofProfile.make(..):
Call Roof.processDirection() to calculate the roof direction as a unit vector and projections of the outline vertices on the roof direction vector. Also find the index of outline vertices with the smallest projection and with the largest projection. The vertex with the smallest projection is the leftmost vertex along the roof direction vector. The vertex with the largest projection is the rightmost vertex along the roof direction vector. Also calculate the polygon width as the difference between the largest and the smallest projections.
For the rest of code follow the detailed description in RoofProfile.make(..) and in the classes building/roof/profile/Slot and building/roof/profile/ProfiledVert.