Skip to content

Vector3D

Canonical path: NemAll_Python_Geometry.Vector3D

Representation class for 3D Vector.

Methods:

  • CrossProduct

    Cross(vector) product operator.

  • DotProduct

    Dot(sxcalar) product.

  • GetCoords

    Get copy of X,Y,Z coordinates

  • GetLength

    Get vector length.

  • GetLengthSquare

    Get vector length without square-root in calculation.

  • IsZero

    Check the coords [0.0, 0.0, 0.0]

  • Normal

    Does the same as Cross(vector) product but does not change the operands.

  • Normalize

    dummy, is only needed for the creation of the documentation by MkDocs

  • Project

    Projection operator.

  • Reverse

    Compute reversed vector

  • Set

    dummy, is only needed for the creation of the documentation by MkDocs

  • Values

    Get copy of X,Y,Z coordinates as python list

  • __add__

    Addition operator.

  • __eq__

    Comparison of vectors without tolerance.

  • __iadd__

    Addition assignment operator.

  • __idiv__

    Multiply the vector by a factor (scalar multiplication)

  • __imul__

    dummy, is only needed for the creation of the documentation by MkDocs

  • __init__

    dummy, is only needed for the creation of the documentation by MkDocs

  • __isub__

    Subtraction assignment operator.

  • __mul__

    dummy, is only needed for the creation of the documentation by MkDocs

  • __ne__

    Comparison of vectors without tolerance.

  • __repr__

    Convert to string

  • __sub__

    Subtraction operator.

  • __truediv__

    Multiply the vector by a factor (scalar multiplication)

Attributes:

  • To2D (Vector2D) –

    convert to 2D3

  • X (float) –

    Get the X coordinate reference.

  • Y (float) –

    Get the Y coordinate reference.

  • Z (float) –

    Get the Z coordinate reference.

To2D property writable

To2D: Vector2D

convert to 2D3

X property writable

X: float

Get the X coordinate reference.

Y property writable

Y: float

Get the Y coordinate reference.

Z property writable

Z: float

Get the Z coordinate reference.

CrossProduct

CrossProduct(vec: Vector3D)

Cross(vector) product operator.

Formula: Va = Va x Vb Va is this Vector

Parameters:

DotProduct

DotProduct(vec: Vector3D) -> float

Dot(sxcalar) product.

Formula: S = Va . Vb = Va1 * Va2 + Vb1 * Vb2 Va is this Vector

Parameters:

Returns:

  • float

    double.

GetCoords

GetCoords() -> tuple[float, float, float]

Get copy of X,Y,Z coordinates

Returns:

  • tuple[float, float, float]

    tuple(X coordinate of vector, Y coordinate of vector, Z coordinate of vector)

GetLength

GetLength() -> float

Get vector length.

Formula: Result(double) = ||Va|| Va is this vector

Returns:

  • float

    double.

GetLengthSquare

GetLengthSquare() -> float

Get vector length without square-root in calculation.

Returns:

  • float

    double.

IsZero

IsZero() -> bool

Check the coords [0.0, 0.0, 0.0]

If the coords are zero, the return value is true. If the coords aren't zero, the return value is false.

Returns:

  • bool

    Is zero? true/false

Normal

Normal(vec: Vector3D) -> Vector3D

Does the same as Cross(vector) product but does not change the operands.

Formula: Vc = Va x Vb Va is this Vector

Parameters:

Normalize overloaded

Normalize() -> eGeometryErrorCode

Normalize vector.

Formula: Vn(a1/||Va||, a2/||Va||) Va is this vector This method is checked and throwing a geometry exception when vector is zero.

Returns:

Normalize(length: float) -> eGeometryErrorCode

Normalize vector to new length.

Formula: Vn(a1 * length / ||Va||, a2 * length / ||Va||) Va is this vector This method is checked and throwing a geometry exception when vector is zero.

Parameters:

  • length (float) –

    new length of vector.

Returns:

Project

Project(vec: Vector3D) -> Vector3D

Projection operator.

Formula: Vc = / . Va Va is this Vector

Parameters:

Returns:

Reverse

Reverse() -> Vector3D

Compute reversed vector

Method calculate vector with reversed orientation.

Returns:

Set overloaded

Set(vec: Vector3D)

Initialize from vector 3D.

Parameters:

Set(x: float, y: float, z: float)

Initialize from x,y,z coordinates.

Parameters:

  • x (float) –

    coordinate.

  • y (float) –

    coordinate.

  • z (float) –

    coordinate.

Set(startPoint: Point3D, endPoint: Point3D)

Initialize vector from two points.

Parameters:

  • startPoint (Point3D) –

    start point of vector.

  • endPoint (Point3D) –

    end point of vector.

Values

Values() -> list[float]

Get copy of X,Y,Z coordinates as python list

Returns:

  • list[float]

    X coordinate of vector.,

  • list[float]

    Y coordinate of vector.,

  • list[float]

    Z coordinate of vector.

__add__

__add__(vec: Vector3D) -> Vector3D

Addition operator.

Formula: Vc = Va + Vb Va is this Vector.

Parameters:

Returns:

__eq__

__eq__(vec: Vector3D) -> bool

Comparison of vectors without tolerance.

Be careful, this method work without tolerance!

Parameters:

Returns:

  • bool

    True when points are equal, otherwise false.

__iadd__

__iadd__(vec: Vector3D) -> Vector3D

Addition assignment operator.

Formula: Va = Va + Vb Va is this Vector.

Parameters:

Returns:

__idiv__

__idiv__(divider: float) -> Vector3D

Multiply the vector by a factor (scalar multiplication)

Parameters:

  • divider (float) –

    scaling divider

Returns:

__imul__ overloaded

__imul__(vec: Vector3D) -> Vector3D

Cross(vector) product operator.

Formula: Va = Va x Vb Va is this Vector

Parameters:

Returns:

  • Vector3D

    Reference to the cross(vector) product of vectors.

__imul__(factor: float) -> Vector3D

Multiply the vector by a factor (scalar multiplication)

Parameters:

  • factor (float) –

    Scale factor

Returns:

__imul__(matrix: Matrix2D) -> Vector3D

2D matrix transformation.

Formula: Vector(this) = Vector(this) * matrix

Parameters:

  • matrix (Matrix2D) –

    2D transformation matrix.

Returns:

__imul__(matrix: Matrix3D) -> Vector3D

3D matrix transformation.

Formula: Vector(this) = Vector(this) * matrix

Parameters:

  • matrix (Matrix3D) –

    3D transformation matrix.

Returns:

__init__ overloaded

__init__()

Initialize

__init__(vec: Vector2D)

Copy constructor.

Copy only X_COORD and Y_COORD from vector, Z_COORD is set to zero.

Parameters:

  • vec (Vector2D) –

    2D vector which will be copied to the 3D vector.

__init__(vec: Vector3D)

Copy constructor.

Parameters:

  • vec (Vector3D) –

    vector which will be copied.

__init__(x: float, y: float, z: float)

Constructor.

Initialize vector from single coordinates.

Parameters:

  • x (float) –

    X coordinate of vector.

  • y (float) –

    Y coordinate of vector.

  • z (float) –

    Z coordinate of vector.

__init__(startPoint: Point3D, endPoint: Point3D)

Constructor.

Initialize vector from two points.

Parameters:

  • startPoint (Point3D) –

    start point of vector.

  • endPoint (Point3D) –

    end point of vector.

__init__(endPoint: Point3D)

Create a vector from a 3D point

Parameters:

  • endPoint (Point3D) –

    End point of the vector (startpoint is 0./0./0.)

__isub__

__isub__(vec: Vector3D) -> Vector3D

Subtraction assignment operator.

Formula: Va = Va - Vb Va is this Vector.

Parameters:

Returns:

__mul__ overloaded

__mul__(vec: Vector3D) -> Vector3D

Cross(vector) product operator.

Formula: Vc = Va x Vb Va is this Vector

Parameters:

Returns:

__mul__(factor: float) -> Vector3D

Multiply the vector by a factor (scalar multiplication)

Parameters:

  • factor (float) –

    Scale factor

Returns:

__mul__(matrix: Matrix2D) -> Vector3D

2D matrix transformation.

Formula: Result = Vector(this) * matrix

Parameters:

  • matrix (Matrix2D) –

    2D transformation matrix.

Returns:

__mul__(matrix: Matrix3D) -> Vector3D

3D matrix transformation.

Formula: Result = Vector(this) * matrix

Parameters:

  • matrix (Matrix3D) –

    3D transformation matrix.

Returns:

__ne__

__ne__(vec: Vector3D) -> bool

Comparison of vectors without tolerance.

Be careful, this method work without tolerance!

Parameters:

Returns:

  • bool

    True when points are not equal, otherwise false.

__repr__

__repr__() -> str

Convert to string

__sub__

__sub__(vec: Vector3D) -> Vector3D

Subtraction operator.

Formula: Vc = Va - Vb Va is this Vector

Parameters:

Returns:

__truediv__

__truediv__(divider: float) -> Vector3D

Multiply the vector by a factor (scalar multiplication)

Parameters:

  • divider (float) –

    scaling divider

Returns: