ladybug_vtk.from_geometry module

Functions to translate ladybug geometry objects into VTK polydata objects.

ladybug_vtk.from_geometry.from_arc3d(arc3d: Arc3D, resolution: int = 3) PolyData[source]

Create Polydata from a Ladybug Arc3D object.

Parameters:
  • arc3d – A Ladybug Arc3D object.

  • resolution – The number of degrees per subdivision. The default is 3 that creates 120 segments for an full circle.

Returns:

Polydata containing an arc.

ladybug_vtk.from_geometry.from_cone(cone: Cone, resolution: int = 2, cap: bool = True) PolyData[source]

Create Polydata from a Ladybug Cone.

Parameters:
  • cone – A Ladybug Cone object.

  • resolution – The number of segments into which the cone will be divided. If set to 0, a line will be created. If set to 1, a single triangle will be created. If set to 2, two crossed triangles will be created. If set to greater than 2, a 3D cone with the number of sides equal to the resolution will be created. Defaults to 2.

  • cap – Boolean to indicate whether the cone should capped or not. Default to True.

Returns:

Polydata containing a cone.

ladybug_vtk.from_geometry.from_cylinder(cylinder: Cylinder, resolution: int = 50, cap: bool = True) PolyData[source]

Create Polydata from a Ladybug Cylinder.

Parameters:
  • cylinder – A Ladybug Cylinder object.

  • resolution – The number of segments into which the cylinder will be divided. Defaults to 50.

  • cap – Boolean to indicate whether the cylinder should capped or not. Default to True.

Returns:

Polydata containing a cylinder.

ladybug_vtk.from_geometry.from_face3d(face: Face3D) PolyData[source]

Create Polydata from a Ladybug face.

Parameters:

face – A Ladybug Face3D object.

Returns:

Polydata containing face and points of a face.

ladybug_vtk.from_geometry.from_line2d(line: LineSegment2D) PolyData[source]

Create Polydata from a Ladybug LineSegment2D object.

Parameters:

line – A Ladybug LineSegment2D object.

Returns:

Polydata containing a line.

ladybug_vtk.from_geometry.from_line3d(line: LineSegment3D) PolyData[source]

Create Polydata from a Ladybug LineSegment3D object.

Parameters:

line – A Ladybug LineSegment3D object.

Returns:

Polydata containing a line.

ladybug_vtk.from_geometry.from_mesh2d(mesh: Mesh2D) PolyData[source]

Create Polydata from a Ladybug mesh 2D.

Parameters:

mesh – A Ladybug Mesh2D object.

Returns:

Polydata containing face and points of a mesh.

ladybug_vtk.from_geometry.from_mesh3d(mesh: Mesh3D) PolyData[source]

Create Polydata from a Ladybug mesh.

Parameters:

mesh – A Ladybug Mesh3D object.

Returns:

Polydata containing face and points of a mesh.

ladybug_vtk.from_geometry.from_point2d(point: Point2D) PolyData[source]

Create Polydata from a Ladybug Point2D object.

Parameters:

point – A ladybug Point object.

Returns:

Polydata containing a single point.

ladybug_vtk.from_geometry.from_point3d(point: Point3D) PolyData[source]

Create Polydata from a Ladybug Point3D object.

Parameters:

point – A ladybug Point object.

Returns:

Polydata containing a single point.

ladybug_vtk.from_geometry.from_points2d(points: List[Point2D], join: bool = False) PolyData[source]

Create Polydata from a list of Ladybug Point2D objects.

Parameters:
  • points – A list of Ladybug Point2D objects.

  • join – Boolean to indicate whether the points should be joined into a polyline.

Returns:

Polydata containing all points or a polyline.

ladybug_vtk.from_geometry.from_points3d(points: List[Point3D], join: bool = False) PolyData[source]

Create Polydata from a list of Ladybug Point3D objects.

Parameters:
  • points – A list of Ladybug Point3D objects.

  • join – Boolean to indicate whether the points should be joined into a polyline.

Returns:

Polydata containing all points or a polyline.

ladybug_vtk.from_geometry.from_polyface3d(polyface: Polyface3D) PolyData[source]

Create Polydata from a Ladybug Polyface.

Parameters:

polyface – A Ladybug Polyface3D object.

Returns:

A Polydata representing the PolyFace3D.

ladybug_vtk.from_geometry.from_polygon2d(polygon: Polygon2D) PolyData[source]

Create Polydata from a Ladybug Polygon2D object.

Parameters:

polygon – A Ladybug Polygon2D object.

Returns:

Polydata containing a polygon.

ladybug_vtk.from_geometry.from_polyline2d(polyline: Polyline2D) PolyData[source]

Create Polydata from a Ladybug Polyline2D object.

Parameters:

polyline – A Ladybug Polyline2D object.

Returns:

Polydata containing a polyline.

ladybug_vtk.from_geometry.from_polyline3d(polyline: Polyline3D) PolyData[source]

Create Polydata from a Ladybug Polyline3D object.

Parameters:

polyline – A Ladybug Polyline3D object.

Returns:

Polydata containing a polyline.

ladybug_vtk.from_geometry.from_sphere(sphere: Sphere, resolution: int = 50) PolyData[source]

Create Polydata from a Ladybug Sphere.

Parameters:
  • sphere – A Ladybug Sphere object.

  • resolution – The number of segments into which the sphere will be divided. Defaults to 50.

Returns:

Polydata containing a sphere.

ladybug_vtk.from_geometry.from_text(text: str, *, plane: Point3D | Point2D | Plane, height: float = 2, horizontal_alignment: int = 0, vertical_alignment: int = 2) PolyData[source]

Create a VTK text object from a text string and a ladybug Point3D.

Parameters:
  • text – A text string.

  • plane – A ladybug Plane, Point3D or Point2D object to locate and orient the text in the VTK scene.

  • height – A number for the height of the text in the scene. Defaults is set to 2.

  • horizontal_alignment – An optional integer to specify the horizontal alignment of the text. Choose from: (0 = Left, 1 = Center, 2 = Right).

  • vertical_alignment – An optional integer to specify the vertical alignment of the text. Choose from: (0 = Top, 1 = Middle, 2 = Bottom)

Returns:

A Polydata object containing the text.

ladybug_vtk.from_geometry.to_circle(center: Point3D, radius: int = 100, sides: int = 100) PolyData[source]

Create a VTK circle from a ladybug Point3D and radius.

Parameters:
  • center – A ladybug Point3D object.

  • radius – The radius of the circle. Defaults to 100 meters.

  • sides – The number of sides of the circle. Defaults to 100.

Returns:

A Polydata object containing a circle.