ladybug_geometry.geometry3d.pointvector module¶
3D Vector and 3D Point
- class ladybug_geometry.geometry3d.pointvector.Point3D(x=0, y=0, z=0)[source]¶
Bases:
Vector3D
3D Point object.
- Parameters:
x – Number for the X coordinate.
y – Number for the Y coordinate.
z – Number for the Z coordinate.
- Properties:
x
y
z
- ToString()¶
Overwrite .NET ToString.
- angle(other)¶
Get the smallest angle between this vector and another.
- cross(other)¶
Get the cross product of this vector and another vector.
- dot(other)¶
Get the dot product of this vector with another.
- duplicate()¶
Get a copy of this vector.
- classmethod from_array(array)¶
Initialize a Vector3D/Point3D from an array.
- Parameters:
array – A tuple or list with three numbers representing the x, y and z values of the point.
- classmethod from_dict(data)¶
Create a Vector3D/Point3D from a dictionary.
- Parameters:
data – A python dictionary in the following format
{ "x": 10, "y": 0, "z": 0 }
- classmethod from_point2d(point2d, z=0)[source]¶
Initialize a new Point3D from an Point2D and a z value.
- Parameters:
line2d – A Point2D to be used to generate the Point3D.
z – A number for the Z coordinate value of the line.
- classmethod from_vector2d(vector2d, z=0)¶
Initialize a new Vector3D from an Vector2D and a z value.
- Parameters:
line2d – A Vector2D to be used to generate the Vector3D.
z – A number for the Z coordinate value of the line.
- 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 Point3D or Vector3D 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 Vector3D with the direction and distance to move the point.
- normalize()¶
Get a copy of the vector that is a unit vector (magnitude=1).
- project(normal, origin)[source]¶
Get a point that is projected into a plane with a given normal and origin.
- Parameters:
normal – A Vector3D representing the normal vector of the plane into which the plane will be projected. THIS VECTOR MUST BE NORMALIZED.
origin – A Point3D representing the origin the plane into which the point will be projected.
- reflect(normal, origin)[source]¶
Get a point 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 point will be reflected. THIS VECTOR MUST BE NORMALIZED.
origin – A Point3D representing the origin from which to reflect.
- reverse()¶
Get a copy of this vector that is reversed.
- rotate(axis, angle, origin)[source]¶
Rotate a point 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 point 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 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 Point3D representing the origin from which to scale. If None, it will be scaled from the World origin (0, 0, 0).
- to_array()¶
Get Vector3D/Point3D as a tuple of three numbers
- 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.
- property z¶
Get the Z coordinate.
- class ladybug_geometry.geometry3d.pointvector.Vector3D(x=0, y=0, z=0)[source]¶
Bases:
object
3D Vector object.
- Parameters:
x – Number for the X coordinate.
y – Number for the Y coordinate.
z – Number for the Z coordinate.
- Properties:
x
y
z
magnitude
magnitude_squared
is_zero
- classmethod from_array(array)[source]¶
Initialize a Vector3D/Point3D from an array.
- Parameters:
array – A tuple or list with three numbers representing the x, y and z values of the point.
- classmethod from_dict(data)[source]¶
Create a Vector3D/Point3D from a dictionary.
- Parameters:
data – A python dictionary in the following format
{ "x": 10, "y": 0, "z": 0 }
- classmethod from_vector2d(vector2d, z=0)[source]¶
Initialize a new Vector3D from an Vector2D and a z value.
- Parameters:
line2d – A Vector2D to be used to generate the Vector3D.
z – A number for the Z coordinate value of the line.
- 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 Point3D or Vector3D 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.
- project(normal)[source]¶
Get a vector projected into a plane with a given normal.
- Parameters:
normal – A Vector3D representing the normal vector of the plane into which the plane will be projected. THIS VECTOR MUST BE NORMALIZED.
- reflect(normal)[source]¶
Get a vector that is reflected across a plane with the input normal vector.
- Parameters:
normal – A Vector3D representing the normal vector for the plane across which the vector will be reflected. THIS VECTOR MUST BE NORMALIZED.
- rotate(axis, angle)[source]¶
Get a vector rotated around an axis through an angle.
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 in radians.
- rotate_xy(angle)[source]¶
Get a vector rotated counterclockwise in the XY plane by a certain angle.
- Parameters:
angle – An angle in radians.
- 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, 0).
This property exists to help with bounding box calculations.
- property min¶
Always equal to (0, 0, 0).
This property exists to help with bounding box calculations.
- property x¶
Get the X coordinate.
- property y¶
Get the Y coordinate.
- property z¶
Get the Z coordinate.