Vector3D#

class ansys.geometry.core.math.vector.Vector3D(shape, dtype=float, buffer=None, offset=0, strides=None, order=None)#

Bases: numpy.ndarray

Provides for managing and creating a 3D vector.

Parameters:
inputUnion[ndarray, RealSequence]

3D numpy.ndarray class with shape(X,).

Overview#

from_points

Create a 3D vector from two distinct 3D points.

is_perpendicular_to

Check if this vector and another vector are perpendicular.

is_parallel_to

Check if this vector and another vector are parallel.

is_opposite

Check if this vector and another vector are opposite.

normalize

Return a normalized version of the 3D vector.

transform

Transform the 3D vector3D with a transformation matrix.

get_angle_between

Get the angle between this 3D vector and another 3D vector.

cross

Get the cross product of Vector3D objects.

x

X coordinate of the Vector3D class.

y

Y coordinate of the Vector3D class.

z

Z coordinate of the Vector3D class.

norm

Norm of the vector.

magnitude

Norm of the vector.

is_zero

Check if all components of the 3D vector are zero.

__eq__

Equals operator for the Vector3D class.

__ne__

Not equals operator for the Vector3D class.

__mul__

Overload * operator with dot product.

__mod__

Overload % operator with cross product.

__add__

Addition operation overload for 3D vectors.

__sub__

Subtraction operation overload for 3D vectors.

Import detail#

from ansys.geometry.core.math.vector import Vector3D

Property detail#

property Vector3D.x: ansys.geometry.core.typing.Real#

X coordinate of the Vector3D class.

property Vector3D.y: ansys.geometry.core.typing.Real#

Y coordinate of the Vector3D class.

property Vector3D.z: ansys.geometry.core.typing.Real#

Z coordinate of the Vector3D class.

property Vector3D.norm: float#

Norm of the vector.

property Vector3D.magnitude: float#

Norm of the vector.

property Vector3D.is_zero: bool#

Check if all components of the 3D vector are zero.

Method detail#

Vector3D.is_perpendicular_to(other_vector: Vector3D) bool#

Check if this vector and another vector are perpendicular.

Vector3D.is_parallel_to(other_vector: Vector3D) bool#

Check if this vector and another vector are parallel.

Vector3D.is_opposite(other_vector: Vector3D) bool#

Check if this vector and another vector are opposite.

Vector3D.normalize() Vector3D#

Return a normalized version of the 3D vector.

Vector3D.transform(matrix: ansys.geometry.core.math.matrix.Matrix44) Vector3D#

Transform the 3D vector3D with a transformation matrix.

Parameters:
matrixMatrix44

4x4 transformation matrix to apply to the vector.

Returns:
Vector3D

A new 3D vector that is the transformed copy of the original 3D vector after applying the transformation matrix.

Notes

Transform the Vector3D object by applying the specified 4x4 transformation matrix and return a new Vector3D object representing the transformed vector.

Vector3D.get_angle_between(v: Vector3D) pint.Quantity#

Get the angle between this 3D vector and another 3D vector.

Parameters:
vVector3D

Other 3D vector for computing the angle.

Returns:
Quantity

Angle between these two 3D vectors.

Vector3D.cross(v: Vector3D) Vector3D#

Get the cross product of Vector3D objects.

Vector3D.__eq__(other: Vector3D) bool#

Equals operator for the Vector3D class.

Vector3D.__ne__(other: Vector3D) bool#

Not equals operator for the Vector3D class.

Vector3D.__mul__(other: beartype.typing.Union[Vector3D, ansys.geometry.core.typing.Real]) beartype.typing.Union[Vector3D, ansys.geometry.core.typing.Real]#

Overload * operator with dot product.

Notes

This method also admits scalar multiplication.

Vector3D.__mod__(other: Vector3D) Vector3D#

Overload % operator with cross product.

Vector3D.__add__(other: beartype.typing.Union[Vector3D, ansys.geometry.core.math.point.Point3D]) beartype.typing.Union[Vector3D, ansys.geometry.core.math.point.Point3D]#

Addition operation overload for 3D vectors.

Vector3D.__sub__(other: Vector3D) Vector3D#

Subtraction operation overload for 3D vectors.

classmethod Vector3D.from_points(point_a: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.point.Point3D], point_b: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.point.Point3D])#

Create a 3D vector from two distinct 3D points.

Parameters:
point_aPoint3D

Point3D class representing the first point.

point_bPoint3D

Point3D class representing the second point.

Returns:
Vector3D

3D vector from point_a to point_b.

Notes

The resulting 3D vector is always expressed in Point3D base units.