Class: Factory

PD.Shell. Factory

A helper class for creating shell facets.

The sole purpose of this class is to provide a more fluent API for creating polylines and polygons within a shell. It uses the moveTo/lineTo approach.


new Factory(shell, coords)

Creates a new planar facet in the shall.

Parameters:
Name Type Description
shell PD.Shell

The shell to create the facet in.

coords PD.LocalCoordinates

The local coordinates to create the facet in.

Author:
  • drajmarsh

Members


:number

contourIndex

Stores the ordinal index of the contour currently being added to.

Type
  • number

:PD.LocalCoordinates

coords

Stores the local coordinates to use.

Type

:PD.Polygon

facet

Stores the polygon being created.

Type

:PD.Shell

shell

Stores the shell the facet is being added to.

Type

Methods


lineTo(x, y, z)

Appends a new vertex at the given local coordinates.

Parameters:
Name Type Description
x number

The new position in the local X axis.

y number

The new position in the local Y axis.

z number

The new position in the local Z axis.

Returns:

Returns the newly added point.

Type
PD.Point

moveTo(x, y, z)

Creates a new contour and appends a new vertex at the given local coordinates.

Parameters:
Name Type Description
x number

The new position in the local X axis.

y number

The new position in the local Y axis.

z number

The new position in the local Z axis.

Returns:

Returns the newly added point.

Type
PD.Point

update()

Finishes the facet and computes its properties.

Returns:

Returns the finished polygon.

Type
PD.Polygon