ladybug_geometry.geometry3d.polyline module

3D Polyline

class ladybug_geometry.geometry3d.polyline.Polyline3D(vertices, interpolated=False)[source]

Bases: Base2DIn3D

3D polyline object.

Parameters
  • vertices – A list of Point3D objects representing the vertices of the polyline.

  • interpolated – Boolean to note whether the polyline should be interpolated between the input vertices when it is translated to other interfaces. Note that this property has no bearing on the geometric calculations performed by this library and is only present in order to assist with display/translation.

Properties:
  • vertices

  • segments

  • min

  • max

  • center

  • p1

  • p2

  • length

  • interpolated

ToString()

Overwrite .NET ToString.

duplicate()

Get a copy of this object.

classmethod from_array(point_array)[source]

Create a Polyline3D from a nested array of vertex coordinates.

Parameters

point_array – nested array of point arrays.

classmethod from_dict(data)[source]

Create a Polyline3D from a dictionary.

Parameters

data – A python dictionary in the following format.

{
    "type": "Polyline3D",
    "vertices": [(0, 0, 0), (10, 0, 2), (0, 10, 4)]
}
classmethod from_polyline2d(polyline2d, plane=None)[source]

Create a closed Polyline3D from a Polyline2D and a plane.

Parameters
  • polyline2d – A Polyline2D object to be converted to a Polyline3D.

  • plane – A Plane in which the Polyline2D sits. If None, the WorldXY plane will be used.

intersect_plane(plane)[source]

Get the intersections between this polyline and a Plane.

Parameters

plane – A Plane that will be intersected with this object.

Returns

A list with Point3D objects for the intersections. List will be empty if no intersection exists.

is_closed(tolerance)[source]

Test whether this polyline is closed to within the tolerance.

Parameters

tolerance – The minimum difference between vertices below which vertices are considered the same.

static join_segments(segments, tolerance)[source]

Get an array of Polyline3Ds from a list of LineSegment3Ds.

Parameters
  • segments – An array of LineSegment3D objects.

  • tolerance – The minimum difference in X, Y, and Z values at which Point2Ds are considered equivalent. Segments with points that match within the tolerance will be joined.

Returns

An array of Polyline3D and LineSegment3D objects assembled from the joined segments.

move(moving_vec)[source]

Get a polyline that has been moved along a vector.

Parameters

moving_vec – A Vector3D with the direction and distance to move the polyline.

reflect(normal, origin)[source]

Get a polyline reflected across a plane with the input normal and origin.

Parameters
  • normal – A Vector3D representing the normal vector for the plane across which the polyline will be reflected. THIS VECTOR MUST BE NORMALIZED.

  • origin – A Point3D representing the origin from which to reflect.

remove_colinear_vertices(tolerance)[source]

Get a version of this polyline without colinear or duplicate vertices.

Parameters

tolerance – The minimum distance that a vertex can be from a line before it is considered colinear.

reverse()[source]

Get a copy of this polyline where the vertices are reversed.

rotate(axis, angle, origin)[source]

Rotate a polyline by a certain angle around an axis and origin.

Right hand rule applies: If axis has a positive orientation, rotation will be clockwise. If axis has a negative orientation, rotation will be counterclockwise.

Parameters
  • axis – A Vector3D axis representing the axis of rotation.

  • angle – An angle for rotation in radians.

  • origin – A Point3D for the origin around which the point will be rotated.

rotate_xy(angle, origin)[source]

Get a polyline rotated counterclockwise in the XY plane by a certain angle.

Parameters
  • angle – An angle in radians.

  • origin – A Point3D for the origin around which the object will be rotated.

scale(factor, origin=None)[source]

Scale a polyline by a factor from an origin point.

Parameters
  • factor – A number representing how much the polyline should be scaled.

  • origin – A Point3D representing the origin from which to scale. If None, it will be scaled from the World origin (0, 0, 0).

split_with_plane(plane)[source]

Split this Polyline3D into Polyline3Ds and LineSegment3Ds using a Plane.

Parameters

plane – A Plane that will be used to split this polyline.

Returns

A list of Polyline3D and LineSegment3D objects if the split was successful. Will be a list with 1 Polyline3D if no intersection exists.

to_array()[source]

Get a list of lists where each sub-list represents a Point3D vertex.

to_dict()[source]

Get Polyline3D as a dictionary.

to_polyline2d()[source]

Get a Polyline2D in the XY plane derived from this 3D polyline.

property center

A Point3D for the center of the bounding box around this geometry.

property interpolated

Boolean noting whether the polyline should be interpolated upon translation.

Note that this property has no bearing on the geometric calculations performed by this library and is only present in order to assist with display/translation.

property length

The length of the polyline.

property max

A Point3D for the maximum bounding box vertex around this geometry.

property min

A Point3D for the minimum bounding box vertex around this geometry.

property p1

Starting point of the Polyline3D.

property p2

End point of the Polyline3D.

property segments

Tuple of all line segments in the polyline.

property vertices

Tuple of all vertices in this object.