ladybug_geometry.geometry3d.plane module

Plane

class ladybug_geometry.geometry3d.plane.Plane(n=Vector3D(0.00, 0.00, 1.00), o=Point3D(0.00, 0.00, 0.00), x=None)[source]

Bases: object

Plane object.

Parameters:
  • n – A Vector3D representing the normal of the plane.

  • o – A Point3D representing the origin point of the plane.

  • x – An optional Vector3D for the X-Axis of the Plane. Note that this vector must be orthogonal to the input normal vector. If None, the default will find an X-Axis in the world XY plane.

Properties:
  • n

  • o

  • k

  • x

  • y

  • tilt

  • altitude

  • azimuth

  • min

  • max

ToString()[source]

Overwrite .NET ToString.

closest_point(point)[source]

Get the closest Point3D on this plane to another Point3D.

Parameters:

point – A Point3D object to which the closest point on this plane will be computed.

Returns:

Point3D for the closest point on this plane to the input point.

closest_points_between_line(line_ray)[source]

Get the two closest Point3D between this plane and a Line3D or Ray3D.

Parameters:

line_ray – A Line3D or Ray3D object to which the closest points will be computed.

Returns:

Two Point3D objects representing

  1. The closest point on the input line_ray to this plane.

  2. The closest point on this plane to the input line_ray.

Will be None if the line_ray intersects this plant

distance_to_line(line_ray)[source]

Get the minimum distance between this plane and the input Line3D or Ray3D.

Parameters:

line_ray – A Line3D or Ray3D object to which the minimum distance will be computed.

Returns:

The minimum distance to the input line_ray.

distance_to_point(point)[source]

Get the minimum distance between this plane and the input point.

Parameters:

point – A Point3D object to which the minimum distance will be computed.

Returns:

The distance to the input point.

duplicate()[source]

Get a copy of this object.

flip()[source]

Get a flipped version of this plane (facing the opposite direction).

classmethod from_dict(data)[source]

Create a Plane from a dictionary.

{
    "type": "Plane"
    "n": (0, 0, 1),
    "o": (0, 10, 0),
    "x": (1, 0, 0)
}
classmethod from_normal_k(n, k)[source]

Initialize a Plane from a normal vector and a scalar constant.

Parameters:
  • o – A Point3D representing the origin point of the plane.

  • k – Scalar constant relating origin point to normal vector

classmethod from_three_points(o, p2, p3)[source]

Initialize a Plane from three Point3D objects that are not co-linear.

Parameters:
  • o – A Point3D representing the origin point of the plane.

  • p2 – A Point3D representing a point the plane.

  • p3 – A Point3D representing a point the plane.

intersect_arc(arc)[source]

Get the intersection between this Plane and an Arc3D.

Parameters:

plane – A Plane object for which intersection will be computed.

Returns:

A list of 2 Point3D objects if a full intersection exists. A list with a single Point3D object if the line is tangent or intersects only once. None if no intersection exists.

intersect_line_ray(line_ray)[source]

Get the intersection between this plane and the input Line3D or Ray3D.

Parameters:

line_ray – A Line3D or Ray3D object for which intersection will be computed.

Returns:

Point3D for the intersection. Will be None if no intersection exists.

intersect_plane(plane)[source]

Get the intersection between this Plane and another Plane.

Parameters:

plane – A Plane object for which intersection will be computed.

Returns:

Ray3D for the intersection. Will be None if planes are parallel.

is_coplanar(plane)[source]

Test if another Plane object is perfectly coplanar with this Plane.

Parameters:

plane – A Plane object for which co-planarity will be tested.

Returns:

True if plane is coplanar. False if it is not coplanar.

is_coplanar_tolerance(plane, tolerance, angle_tolerance)[source]

Test if another Plane object is coplanar within a certain tolerance.

Parameters:
  • plane – A Plane object for which co-planarity will be tested.

  • tolerance – The distance between the two planes at which point they can be considered coplanar.

  • angle_tolerance – The angle in radians that the plane normals can differ from one another in order for the planes to be considered coplanar.

Returns:

True if plane is coplanar. False if it is not coplanar.

is_point_above(point)[source]

Test if a given point is above or below this plane.

Above is defined as being on the side of the plane that the plane normal is pointing towards.

Parameters:

point – A Point3D object to test.

Returns:

True is point is above; False if below.

move(moving_vec)[source]

Get a plane that has been moved along a vector.

Parameters:

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

project_point(point, projection_direction=None)[source]

Project a point onto this Plane given a certain projection direction.

Parameters:
  • point – A Point3D to be projected onto the plane

  • projection_direction – A Line3D or Ray3D object to set the direction of projection. If None, this Plane’s normal will be used. (Default: None).

Returns:

Point3D for the projected point. Will be None if the projection_direction is parallel to the plane.

reflect(normal, origin)[source]

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

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

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

rotate(axis, angle, origin)[source]

Rotate a plane 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 object will be rotated.

rotate_xy(angle, origin)[source]

Get a plane rotated counterclockwise in the world 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 plane by a factor from an origin point.

Parameters:
  • factor – A number representing how much the plane 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).

to_dict()[source]

Get Plane as a dictionary.

xy_to_xyz(point)[source]

Get a Point3D from a Point2D in the coordinate system of this plane.

xyz_to_xy(point)[source]

Get a Point2D in the coordinate system of this plane from a Point3D.

Note that the input Point3D should lie within this plane object in order for the result to be valid.

property altitude

Get the altitude of the plane. Between Pi/2 (up) and -Pi/2 (down).

property azimuth

Get the azimuth of the plane.

This is always between 0, indicating the positive Y-axis, and moving clockwise up to 2 * Pi, which indicates a return to the positive Y-axis.

This will be zero if the plane is perfectly horizontal.

property k

Scalar constant relating origin point to normal vector.

property max

Returns the Plane origin.

property min

Returns the Plane origin.

property n

Normal vector. This vector will always be normalized (magnitude = 1).

property o

Origin point.

property tilt

Get the tilt of the plane. Between 0 (up) and Pi (down).

property x

Plane X-Axis. This vector will always be normalized (magnitude = 1).

property y

Plane Y-Axis. This vector will always be normalized (magnitude = 1).