ladybug_geometry.geometry2d.pointvector module

2D Vector and 2D Point

class ladybug_geometry.geometry2d.pointvector.Point2D(x=0, y=0)[source]

Bases: Vector2D

2D Point object.

Parameters:
  • x – Number for the X coordinate.

  • y – Number for the Y coordinate.

Properties:
  • x

  • y

ToString()

Overwrite .NET ToString.

angle(other)

Get the smallest angle between this vector and another.

angle_clockwise(other)

Get the clockwise angle between this vector and another.

angle_counterclockwise(other)

Get the counterclockwise angle between this vector and another.

static circular_mean(angles)

Compute the circular mean across a list of angles in radians.

If no circular mean exists, the normal mean will be returned.

Parameters:

angles – A list of angles in radians.

cross()

Get the cross product of this vector.

determinant(other)

Get the determinant between this vector and another 2D vector.

distance_to_point(point)[source]

Get the distance from this point to another Point2D.

dot(other)

Get the dot product of this vector with another.

duplicate()

Get a copy of this vector.

classmethod from_array(array)

Initialize a Vector2D/Point2D from an array.

Parameters:

array – A tuple or list with two numbers representing the x and y values of the point.

classmethod from_dict(data)

Create a Vector2D/Point2D from a dictionary.

Parameters:

data – A python dictionary in the following format

{
    "x": 10,
    "y": 0
}
is_equivalent(other, tolerance)

Test whether this object is equivalent to another within a certain tolerance.

Note that if you want to test whether the coordinate values are perfectly equal to one another, the == operator can be used.

Parameters:
  • other – Another Point2D for which geometric equivalency will be tested.

  • tolerance – The minimum difference between the coordinate values of two objects at which they can be considered geometrically equivalent.

Returns:

True if equivalent. False if not equivalent.

is_zero(tolerance)

Boolean to note whether the vector is within a given zero tolerance.

Parameters:

tolerance – The tolerance below which the vector is considered to be a zero vector.

move(moving_vec)[source]

Get a point that has been moved along a vector.

Parameters:

moving_vec – A Vector2D with the direction and distance to move the point.

normalize()

Get a copy of the vector that is a unit vector (magnitude=1).

reflect(normal, origin)[source]

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

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

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

reverse()

Get a copy of this vector that is reversed.

rotate(angle, origin)[source]

Rotate a point counterclockwise by a certain angle around an origin.

Parameters:
  • angle – An angle for rotation in radians.

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

scale(factor, origin=None)[source]

Scale a point by a factor from an origin point.

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

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

to_array()

Get Vector2D/Point2D as a tuple of two numbers

to_dict()[source]

Get Point2D as a dictionary.

property magnitude

Get the magnitude of the vector.

property magnitude_squared

Get the magnitude squared of the vector.

property max

Always equal to the point itself.

This property exists to help with bounding box calculations.

property min

Always equal to the point itself.

This property exists to help with bounding box calculations.

property x

Get the X coordinate.

property y

Get the Y coordinate.

class ladybug_geometry.geometry2d.pointvector.Vector2D(x=0, y=0)[source]

Bases: object

2D Vector object.

Parameters:
  • x – Number for the X coordinate.

  • y – Number for the Y coordinate.

Properties:
  • x

  • y

  • magnitude

  • magnitude_squared

  • is_zero

ToString()[source]

Overwrite .NET ToString.

angle(other)[source]

Get the smallest angle between this vector and another.

angle_clockwise(other)[source]

Get the clockwise angle between this vector and another.

angle_counterclockwise(other)[source]

Get the counterclockwise angle between this vector and another.

static circular_mean(angles)[source]

Compute the circular mean across a list of angles in radians.

If no circular mean exists, the normal mean will be returned.

Parameters:

angles – A list of angles in radians.

cross()[source]

Get the cross product of this vector.

determinant(other)[source]

Get the determinant between this vector and another 2D vector.

dot(other)[source]

Get the dot product of this vector with another.

duplicate()[source]

Get a copy of this vector.

classmethod from_array(array)[source]

Initialize a Vector2D/Point2D from an array.

Parameters:

array – A tuple or list with two numbers representing the x and y values of the point.

classmethod from_dict(data)[source]

Create a Vector2D/Point2D from a dictionary.

Parameters:

data – A python dictionary in the following format

{
    "x": 10,
    "y": 0
}
is_equivalent(other, tolerance)[source]

Test whether this object is equivalent to another within a certain tolerance.

Note that if you want to test whether the coordinate values are perfectly equal to one another, the == operator can be used.

Parameters:
  • other – Another Point2D for which geometric equivalency will be tested.

  • tolerance – The minimum difference between the coordinate values of two objects at which they can be considered geometrically equivalent.

Returns:

True if equivalent. False if not equivalent.

is_zero(tolerance)[source]

Boolean to note whether the vector is within a given zero tolerance.

Parameters:

tolerance – The tolerance below which the vector is considered to be a zero vector.

normalize()[source]

Get a copy of the vector that is a unit vector (magnitude=1).

reflect(normal)[source]

Get a vector that is reflected across a plane with the input normal vector.

Parameters:

normal – A Vector2D representing the normal vector for the plane across which the vector will be reflected. THIS VECTOR MUST BE NORMALIZED.

reverse()[source]

Get a copy of this vector that is reversed.

rotate(angle)[source]

Get a vector that is rotated counterclockwise by a certain angle.

Parameters:

angle – An angle for rotation in radians.

to_array()[source]

Get Vector2D/Point2D as a tuple of two numbers

to_dict()[source]

Get Vector2D as a dictionary.

property magnitude

Get the magnitude of the vector.

property magnitude_squared

Get the magnitude squared of the vector.

property max

Always equal to (0, 0).

This property exists to help with bounding box calculations.

property min

Always equal to (0, 0).

This property exists to help with bounding box calculations.

property x

Get the X coordinate.

property y

Get the Y coordinate.