Vector2D
#
- class ansys.geometry.core.math.vector.Vector2D(shape, dtype=float, buffer=None, offset=0, strides=None, order=None)#
Bases:
numpy.ndarray
Provides for creating and managing a 2D vector.
- Parameters:
- input
ndarray
|RealSequence
2D
numpy.ndarray
class with shape(X,).
- input
Overview#
Create a 2D vector from two distinct 2D points. |
Return the cross product of |
|
Check if this 2D vector and another 2D vector are perpendicular. |
|
Check if this vector and another vector are parallel. |
|
Check if this vector and another vector are opposite. |
|
Return a normalized version of the 2D vector. |
|
Get the angle between this 2D vector and another 2D vector. |
Import detail#
from ansys.geometry.core.math.vector import Vector2D
Property detail#
- property Vector2D.x: ansys.geometry.core.typing.Real#
X coordinate of the 2D vector.
- property Vector2D.y: ansys.geometry.core.typing.Real#
Y coordinate of the 2D vector.
Method detail#
- Vector2D.is_perpendicular_to(other_vector: Vector2D) bool #
Check if this 2D vector and another 2D vector are perpendicular.
- Vector2D.is_parallel_to(other_vector: Vector2D) bool #
Check if this vector and another vector are parallel.
- Vector2D.is_opposite(other_vector: Vector2D) bool #
Check if this vector and another vector are opposite.
- Vector2D.get_angle_between(v: Vector2D) pint.Quantity #
Get the angle between this 2D vector and another 2D vector.
- Parameters:
- v
Vector2D
Other 2D vector to compute the angle with.
- v
- Returns:
Quantity
Angle between these two 2D vectors.
- Vector2D.__mul__(other: Vector2D | ansys.geometry.core.typing.Real) Vector2D | ansys.geometry.core.typing.Real #
Overload * operator with dot product.
Notes
This method also admits scalar multiplication.
- Vector2D.__add__(other: Vector2D | ansys.geometry.core.math.point.Point2D) Vector2D | ansys.geometry.core.math.point.Point2D #
Addition operation overload for 2D vectors.
- classmethod Vector2D.from_points(point_a: numpy.ndarray | ansys.geometry.core.typing.RealSequence | ansys.geometry.core.math.point.Point2D, point_b: numpy.ndarray | ansys.geometry.core.typing.RealSequence | ansys.geometry.core.math.point.Point2D)#
Create a 2D vector from two distinct 2D points.
- Parameters:
- Returns:
Vector2D
2D vector from
point_a
topoint_b
.
Notes
The resulting 2D vector is always expressed in
Point2D
base units.