:class:`Vector3D` ================= .. py:class:: ansys.geometry.core.math.vector.Vector3D(shape, dtype=float, buffer=None, offset=0, strides=None, order=None) Bases: :py:obj:`numpy.ndarray` Provides for managing and creating a 3D vector. :Parameters: **input** : :obj:`~numpy.ndarray` | :obj:`RealSequence` 3D :class:`numpy.ndarray ` class with shape(X,). .. !! processed by numpydoc !! .. py:currentmodule:: Vector3D Overview -------- .. tab-set:: .. tab-item:: Constructors .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~from_points` - Create a 3D vector from two distinct 3D points. .. tab-item:: Methods .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~is_perpendicular_to` - Check if this vector and another vector are perpendicular. * - :py:attr:`~is_parallel_to` - Check if this vector and another vector are parallel. * - :py:attr:`~is_opposite` - Check if this vector and another vector are opposite. * - :py:attr:`~normalize` - Return a normalized version of the 3D vector. * - :py:attr:`~transform` - Transform the 3D vector3D with a transformation matrix. * - :py:attr:`~get_angle_between` - Get the angle between this 3D vector and another 3D vector. * - :py:attr:`~cross` - Get the cross product of ``Vector3D`` objects. .. tab-item:: Properties .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~x` - X coordinate of the ``Vector3D`` class. * - :py:attr:`~y` - Y coordinate of the ``Vector3D`` class. * - :py:attr:`~z` - Z coordinate of the ``Vector3D`` class. * - :py:attr:`~norm` - Norm of the vector. * - :py:attr:`~magnitude` - Norm of the vector. * - :py:attr:`~is_zero` - Check if all components of the 3D vector are zero. .. tab-item:: Special methods .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~__eq__` - Equals operator for the ``Vector3D`` class. * - :py:attr:`~__ne__` - Not equals operator for the ``Vector3D`` class. * - :py:attr:`~__mul__` - Overload * operator with dot product. * - :py:attr:`~__mod__` - Overload % operator with cross product. * - :py:attr:`~__add__` - Addition operation overload for 3D vectors. * - :py:attr:`~__sub__` - Subtraction operation overload for 3D vectors. Import detail ------------- .. code-block:: python from ansys.geometry.core.math.vector import Vector3D Property detail --------------- .. py:property:: x :type: ansys.geometry.core.typing.Real X coordinate of the ``Vector3D`` class. .. !! processed by numpydoc !! .. py:property:: y :type: ansys.geometry.core.typing.Real Y coordinate of the ``Vector3D`` class. .. !! processed by numpydoc !! .. py:property:: z :type: ansys.geometry.core.typing.Real Z coordinate of the ``Vector3D`` class. .. !! processed by numpydoc !! .. py:property:: norm :type: float Norm of the vector. .. !! processed by numpydoc !! .. py:property:: magnitude :type: float Norm of the vector. .. !! processed by numpydoc !! .. py:property:: is_zero :type: bool Check if all components of the 3D vector are zero. .. !! processed by numpydoc !! Method detail ------------- .. py:method:: is_perpendicular_to(other_vector: Vector3D) -> bool Check if this vector and another vector are perpendicular. .. !! processed by numpydoc !! .. py:method:: is_parallel_to(other_vector: Vector3D) -> bool Check if this vector and another vector are parallel. .. !! processed by numpydoc !! .. py:method:: is_opposite(other_vector: Vector3D) -> bool Check if this vector and another vector are opposite. .. !! processed by numpydoc !! .. py:method:: normalize() -> Vector3D Return a normalized version of the 3D vector. .. !! processed by numpydoc !! .. py:method:: transform(matrix: ansys.geometry.core.math.matrix.Matrix44) -> Vector3D Transform the 3D vector3D with a transformation matrix. :Parameters: **matrix** : :obj:`Matrix44` 4x4 transformation matrix to apply to the vector. :Returns: :obj:`Vector3D` A new 3D vector that is the transformed copy of the original 3D vector after applying the transformation matrix. .. rubric:: Notes Transform the ``Vector3D`` object by applying the specified 4x4 transformation matrix and return a new ``Vector3D`` object representing the transformed vector. .. !! processed by numpydoc !! .. py:method:: get_angle_between(v: Vector3D) -> pint.Quantity Get the angle between this 3D vector and another 3D vector. :Parameters: **v** : :obj:`Vector3D` Other 3D vector for computing the angle. :Returns: :obj:`~pint.Quantity` Angle between these two 3D vectors. .. !! processed by numpydoc !! .. py:method:: cross(v: Vector3D) -> Vector3D Get the cross product of ``Vector3D`` objects. .. !! processed by numpydoc !! .. py:method:: __eq__(other: Vector3D) -> bool Equals operator for the ``Vector3D`` class. .. !! processed by numpydoc !! .. py:method:: __ne__(other: Vector3D) -> bool Not equals operator for the ``Vector3D`` class. .. !! processed by numpydoc !! .. py:method:: __mul__(other: Union[Vector3D, ansys.geometry.core.typing.Real]) -> Union[Vector3D, ansys.geometry.core.typing.Real] Overload * operator with dot product. .. rubric:: Notes This method also admits scalar multiplication. .. !! processed by numpydoc !! .. py:method:: __mod__(other: Vector3D) -> Vector3D Overload % operator with cross product. .. !! processed by numpydoc !! .. py:method:: __add__(other: Union[Vector3D, ansys.geometry.core.math.point.Point3D]) -> Union[Vector3D, ansys.geometry.core.math.point.Point3D] Addition operation overload for 3D vectors. .. !! processed by numpydoc !! .. py:method:: __sub__(other: Vector3D) -> Vector3D Subtraction operation overload for 3D vectors. .. !! processed by numpydoc !! .. py:method:: from_points(point_a: numpy.ndarray | ansys.geometry.core.typing.RealSequence | ansys.geometry.core.math.point.Point3D, point_b: numpy.ndarray | ansys.geometry.core.typing.RealSequence | ansys.geometry.core.math.point.Point3D) :classmethod: Create a 3D vector from two distinct 3D points. :Parameters: **point_a** : :obj:`~numpy.ndarray` | :obj:`RealSequence` | :obj:`Point3D` :class:`Point3D ` class representing the first point. **point_b** : :obj:`~numpy.ndarray` | :obj:`RealSequence` | :obj:`Point3D` :class:`Point3D ` class representing the second point. :Returns: :obj:`Vector3D` 3D vector from ``point_a`` to ``point_b``. .. rubric:: Notes The resulting 3D vector is always expressed in ``Point3D`` base units. .. !! processed by numpydoc !!