Class: Roofs

PD.Shape. Roofs


new Roofs()

A factory for generating a range of different roof forms and shapes based on the PD.Shape class.

Author:
  • drajmarsh

Methods


anticupola( [config]) <static>

Generates a anticupola-shaped roof.

An anticupola is a shape formed by joining two polygons, one (the base) with twice as many edges as the other and rotated slightly by half a segment, joined to the top by a band of isosceles triangles.

Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

detail number <optional>

The level of geometric detail (0 to 32), defaults to 8.

points number <optional>

The number of points in random and Fibonacci domes (2 to 1024), defaults to 128.

type number | string <optional>

What type of dome to create (0:latLng, 1:Geodesic, 2: random), defaults to 0.

Returns:

Returns a new anticupola roof shape.

Type
PD.Shape

barrel( [config]) <static>

Generates a simple barrel vault roof.

A barrel vault roof is formed from a series of planes that form a semicircular arch at each end. The number of planes is determined by the facet resolution. A rainbow roof is very similar, but forms a pointed arch instead of a semicircular one.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral, with the order of vertices as shown below. This final shape actually requires six (6) points, or ten (10) if it has a gutter (), where the 4 and 5 will be automatically computed based on the roof pitch angle.

You can specify the roof pitch angle(s) in degrees using config.angle or in radians using config.radians. This method will use config.angle over config.radians, so you should only include one or the other, not both.

    3------------------------------------2
    +------------------------------------+
    |                                    |
    +------------------------------------+
    |                                    |
    |                                    |
    +------------------------------------+
    |                                    |               , - ~ ' ~ - ,
    |                                    |           , '               ' ,
    +------------------------------------+         ,                       ,
    |                                    |        ,                         ,
    +------------------------------------+       ,                           ,
    0------------------------------------1       1  -  -  -  -   -  -  -  -  2 - + -
                                                 +---------------------------+ - + - gutter
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

facets number <optional>

The number of facets (2 to 72), defaults to 12.

isRainbow boolean <optional>

Whether to generate a ridged rainbow roof instead of a barrel, defaults to false.

Returns:

Returns a new barrel vaulted roof shape.

Type
PD.Shape

butterfly( [config]) <static>

Creates simple butterfly roof, which is basically an inverted gable.

A butterfly roof consists of two inclined planes that meet in the middle of a base quadrilateral to form a central valley. As opposed to a gable roof, the planes are generated from the center value and incline upwards towards the sides.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral, with the order of vertices as shown below. This final shape actually requires six (6) points, or ten (10) if it has a gutter (), where the 4 and 5 will be automatically computed based on the roof pitch angle.

You can specify the roof pitch angle in degrees using config.angle or in radians using config.radians. This method will use config.angle over config.radians, so you should only include one or the other, not both.

    9                                     8
     3-----------------------------------2
      \                                _/
       \                             _/
        5---------------------------4      (1)._                 _.(2)
         \                        _/        :    '-._       _.-'    :
          \                     _/          :         '-4-'         :
           0-------------------1            1  -  -  -  -  -  -  -  2 - + -
          6                     7           7-----------------------8 - + - base
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

angle number <optional>

The roof pitch in degrees (0.1 to 75deg), defaults to 30deg.

radians number <optional>

The roof pitch in radians, defaults to 0.5236rad.

valleyWidth number <optional>

The width of the valley gutter in the middle, defaults to 0.

valleyDepth number <optional>

The depth of the valley gutter in the middle, defaults to 100mm.

Returns:

Returns a new butterfly roof shape.

Type
PD.Shape

conical( [config]) <static>

Generates a simple conical roof.

A cone is a cylindrical shaped roof with the top radius that different from the bottom radius, often being just a single point, and formed from a series of facets that approximate its curved shape.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral. If you provide just one point, it will be used as the center of the cone. If you provide two points, the second is assumed to define a point on the circumference of the cone, so is used to compute the radius. If you provide three or four points, these will be used to generate the radius such that the circumference is tangential to all two/three lines.

All conical shapes generated by this class use facets to approximate the curved shape of the dome. To generate smoothly curved algorithmic domed surfaces, use the OpenCascade engine or the PD.BRep class. You can control the facet density using the detail or points configuration properties described below.

Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

sides number <optional>

The number of side facets (3 to 360), defaults to 36.

radius number <optional>

The radius of the base of the cone, defaults to given size.

radiusTop number <optional>

The radius of the top of the cone, defaults to 0.

height number <optional>

The height to the top of the cone, defaults to 1000mm.

Returns:

Returns a new domed roof shape.

Type
PD.Shape

cupola( [config]) <static>

Generates a cupola-shaped roof.

A cupola is a shape formed by joining two polygons, one (the base) with twice as many edges as the other, by an alternating band of isosceles triangles and rectangles.

Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

detail number <optional>

The level of geometric detail (0 to 32), defaults to 8.

points number <optional>

The number of points in random and Fibonacci domes (2 to 1024), defaults to 128.

type number | string <optional>

What type of dome to create (0:latLng, 1:Geodesic, 2: random), defaults to 0.

Returns:

Returns a new cupola roof shape.

Type
PD.Shape

dome( [config]) <static>

Generates a simple dome roof.

A dome is a hemispherical shaped roof formed from a series of facets that approximate its curved shape.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral. If you provide just one point, it will be used as the center of the dome. If you provide two points, the second is assumed to define a point on the circumference of the dome, so is used to compute the radius. If you provide three or four points, these will be used to generate the radius such that the circumference is tangential to all two/three lines.

All dome shapes generated by this class use facets to approximate the curved shape of the dome. To generate smoothly curved algorithmic domed surfaces, use the OpenCascade engine or the PD.BRep class. You can control the facet density using the detail or points configuration properties described below.

               , - ~ ' ~ - ,                        , - ~ ' ~ - ,
           , '               ' ,                , '               ' ,
         ,                       ,            ,                       ,
        ,                         ,          ,                         ,
       ,                           ,        ,                           ,
       +  -  -  -  - 0 -  -  -  -  1        +  -  -  -  -   -  -  -  -  + - + -
                                            +---------------------------+ - + - base
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

detail number <optional>

The level of geometric detail (0 to 32), defaults to 8.

points number <optional>

The number of points in random and Fibonacci domes (2 to 1024), defaults to 128.

type number | string <optional>

What type of dome to create (0:latLng, 1:Geodesic, 2: random), defaults to 0.

Returns:

Returns a new domed roof shape.

Type
PD.Shape

gable( [config]) <static>

Generates a simple gable roof.

A gable roof consists of two inclined planes that meet in the middle of a base quadrilateral to form a raised central ridge.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral, with the order of vertices as shown below. This final shape actually requires six (6) points, or ten (10) if it has a gutter (), where the 4 and 5 will be automatically computed based on the roof pitch angle.

You can specify the roof pitch angle in degrees using config.angle or in radians using config.radians. This method will use config.angle over config.radians, so you should only include one or the other, not both.

    9                                     8
     3-----------------------------------2
      \                                _/
       \                             _/
        5---------------------------4                   _.-._
         \                        _/               _.-'       '-._
          \                     _/            _.-'                 '-._
           0-------------------1            1  -  -  -  -   -  -  -  -  2 - + -
          6                     7           +---------------------------+ - + - base
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

angle number <optional>

The roof pitch in degrees (0.1 to 75deg), defaults to 30deg.

radians number <optional>

The roof pitch in radians, defaults to 0.5236rad.

Returns:

Returns a new gable roof shape.

Type
PD.Shape

gambrel( [config]) <static>

Generates a simple gambrel roof.

A gambrel roof consists of four inclined planes, where the bottom two planes are inclined at different angles to the top two planes.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral, with the order of vertices as shown below. This final shape actually requires six (6) points, or ten (10) if it has a gutter (), where the 4 and 5 will be automatically computed based on the roof pitch angle.

You can specify the roof pitch angle(s) in degrees using config.angle or in radians using config.radians. This method will use config.angle over config.radians, so you should only include one or the other, not both.

   13                                    12
    3------------------------------------2
    |                                    |
    6------------------------------------7
    |                                    |                 _.-'-._
    8------------------------------------9            _.-'         '-._
    |                                    |          +                   +
    4------------------------------------5        _/                     \_
    |                                    |      _/                         \_
    0------------------------------------1     1  -  -  -  -  -  -  -  -  -  2 - + -
   10                                    11    11---------------------------12 - + - base
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

angle number <optional>

The lower roof pitch in degrees (0.1 to 75deg), defaults to 60deg.

radians number <optional>

The lower roof pitch in radians, defaults to 0.5236rad.

angleUpper number <optional>

The upper roof pitch in degrees (0.1 to 75deg), defaults to 30deg.

radiansUpper number <optional>

The upper roof pitch in radians, defaults to 0.5236rad.

height number <optional>

The height of the lower roof portion, defaults to 1000mm.

Returns:

Returns a new gambrel roof shape.

Type
PD.Shape

hip( [config]) <static>

Generates a simple hip roof.

A hip roof consists of four inclined planes that meet in the middle of a base quad to form a central ridge. The angle of inclination for all planes is typically the same, unless the two end triangular planes intersect each other in which case their angles are modified to create a pyramid shape.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral, with the order of vertices as shown below. This final shape actually requires six (6) points, or ten (10) if it has a gutter (), where the 4 and 5 will be automatically computed based on the roof pitch angle.

You can specify the roof pitch angle(s) in degrees using config.angle or in radians using config.radians. This method will use config.angle over config.radians, so you should only include one or the other, not both.

   9                       8
    3---------------------2
     \''..              _/ \
      \   ''..        _/    \
       \      _5-----4.      \                  _______
        \   _/         ''..   \            _.-'         '-._
         \ /               ''..\      _.-'                   '-._
          0---------------------1    0----------------------------1 - + -
         6                       7   6----------------------------7 - + - base
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

angle number <optional>

The side roof pitch angle in degrees (0.1 to 75deg), defaults to 30deg.

radians number <optional>

The side roof pitch angle in radians, defaults to 0.5236rad.

angleEnd number <optional>

The end roof pitch angle in degrees(0.1 to 89.9deg), defaults to 30deg.

radiansEnd number <optional>

The end roof pitch angle in radians, defaults to 0.5236rad.

Returns:

Returns a new hip roof shape.

Type
PD.Shape

hippedGable( [config]) <static>

Generates a simple hipped gable roof.

A hipped gable roof consists of four inclined planes that meet in the middle of a base quad to form a central ridge. The angle of inclination for all planes is typically the same, unless the two end triangular end planes intersect each other in which case their angles are modified to create a pyramid shape.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral, with the order of vertices as shown below. This final shape actually requires six (6) points, or ten (10) if it has a gutter (), where the 4 and 5 will be automatically computed based on the roof pitch angle.

You can specify the roof pitch angle(s) in degrees using config.angle or in radians using config.radians. This method will use config.angle over config.radians, so you should only include one or the other, not both.

 13                      12
   3---------------------2
    \                     \
     8.                   _7
      \''-.              /  \
       \   '5-----------4.   \              _____________________
        \ .'              ''..\           _/                     \_
         9                    '6        _/                         \_
          \                     \      :                             :
           0---------------------1     0-----------------------------1
          10                     11    10---------------------------11 - + - base
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

angle number <optional>

The side roof pitch angle in degrees (0.1 to 75deg), defaults to 30deg.

radians number <optional>

The side roof pitch angle in radians, defaults to 0.5236rad.

angleEnd number <optional>

The end roof pitch angle in degrees(0.1 to 89.9deg), defaults to 30deg.

radiansEnd number <optional>

The end roof pitch angle in radians, defaults to 0.5236rad.

fraction number <optional>

The fractional ridge offset of the hip triangles (0 to 1), defaults to 0.5.

Returns:

Returns a new hipped gable roof shape.

Type
PD.Shape

mansard( [config]) <static>

Generates a simple mansard roof.

A mansard roof consists of eight inclined planes, where the bottom four planes are inclined at different angles to the top four planes. A Dutch gable is where the end triangle planes (5,6,8 and 7,4,9) are vertical.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral, with the order of vertices as shown below. This final shape actually requires six (6) points, or ten (10) if it has a gutter (), where the 4 and 5 will be automatically computed based on the roof pitch angle.

You can specify the roof pitch angle(s) in degrees using config.angle or in radians using config.radians. This method will use config.angle over config.radians, so you should only include one or the other, not both.

    3------------------------------------2
    |'.                                .'|
    |   7----------------------------6   |                      ____________
    |   | '.                      .' |   |                 _.-'              '-._
    |   |   9--------------------8   |   |            _.-'                        '-._
    |   | .'                      '. |   |          +----------------------------------+
    |   4----------------------------5   |        _/                                    \_
    |.'                                '.|      _/                                        \_
    0------------------------------------1     0--------------------------------------------1 - + -
                                               +--------------------------------------------+ - + - base
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

angle number <optional>

The lower roof pitch in degrees (0.1 to 75deg), defaults to 60deg.

radians number <optional>

The lower roof pitch in radians, defaults to 0.5236rad.

angleUpper number <optional>

The upper roof pitch in degrees (0.1 to 75deg), defaults to 30deg.

radiansUpper number <optional>

The upper roof pitch in radians, defaults to 0.5236rad.

dutchGable number <optional>

The factor for turning the mansard shape into a Dutch gable (0 to 1), defaults to 0.

height number <optional>

The height of the lower roof portion, defaults to 1000mm.

Returns:

Returns a new mansard roof shape.

Type
PD.Shape

pavilion( [config]) <static>

Generates a simple pavilion roof.

A pavilion roof consists of four inclined planes that all meet at a central apex point to form a pyramid.

The config.vertices property is an array that you can pre-fill with up to four initial points defining the corners of the base. These points must define a convex coplanar quadrilateral, with the order of vertices as shown below. This final shape actually requires six (6) points, or ten (10) if it has a gutter (), where the 4 and 5 will be automatically computed based on the roof pitch angle.

You can specify the roof pitch angle(s) in degrees using config.angle or in radians using config.radians. This method will use config.angle over config.radians, so you should only include one or the other, not both.

    3---------------2
     \''..        _/ \
      \   ''..  _/    \
       \      _4       \
        \   _/   ''..   \             _.-'-._
         \ /         ''..\       _.-'         '-._
          0---------------1    0-------------------1 - + -
                               +-------------------+ - + - gutter
Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

angle number <optional>

The lower roof pitch in degrees (0.1 to 75deg), defaults to 60deg.

radians number <optional>

The lower roof pitch in radians, defaults to 0.5236rad.

Returns:

Returns a new pavilion roof shape.

Type
PD.Shape

rotunda( [config]) <static>

Generates a pentagonal rotunda roof.

As this shape always has 10 sides in its base, the sides value refers to the number of unit-sized cylindrical segments to add to its base.

Parameters:
Name Type Argument Description
config object <optional>

A configuration object.

Properties of config:
Name Type Argument Description
vertices Array.<Array.<number>> <optional>

An array of 1 to 4 [x,y,z] vector array initial corner points.

size number | Array.<number> <optional>

The base size as a number or [sizeX,sizeY] vector array, defaults to 2000mm.

base number <optional>

The height of the base/gutter at the bottom, defaults to 150mm.

detail number <optional>

The level of geometric detail (0 to 32), defaults to 8.

points number <optional>

The number of points in random and Fibonacci domes (2 to 1024), defaults to 128.

type number | string <optional>

What type of dome to create (0:latLng, 1:Geodesic, 2: random), defaults to 0.

Returns:

Returns a new rotunda roof shape.

Type
PD.Shape