class Vector2D

class NemAll_Python_Geometry.Vector2D

Representation class for 2D Vector.

CrossProduct(vec: Vector2D) Vector3D

Cross(vector) product operator.

Formula: Va = Va x Vb Va is this Vector

Args:

vec:  Vector(Vb).

Returns:

new Vector(Vc).

DotProduct(vec: Vector2D) float

Dot(sxcalar) product.

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

Args:

vec:  Vector(Vb).

Returns:

double.

GetAngle() Angle

Get vector angle.

Returns:

Angle in a range <0, 2*PI> (normalized 2pi).

GetAngleSigned() Angle

Get vector angle.

equivalent to zfno()

Returns:

Angle in a range <-PI..0..PI>

GetCoords() Tuple[double, double]

Get copy of X,Y coordinates.

Returns:

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

GetLength() float

Get vector length.

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

Returns:

double.

IsZero() bool

Check the coords [0.0, 0.0] (binary comparison)

Returns:

Is zero? true/false

Normalize(...)
Normalize() None

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.

Normalize(length: float) None

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.

Args:

length:  new length of vector.

Orthogonal(counterClockwise: bool = True]) Vector2D

Compute orthogonal vector

Method calculate orthogonal vector. Sample:

    vec = Vector2D(100., 0)
    vec.Orthogonal()
    # vec = (0., 100.);

Args:

counterClockwise:  Orientation of orthogonal vector

Returns:

Orthogonal vector

Reverse() Vector2D

Compute reversed vector

Method calculate vector with reversed orientation.

Returns:

Reversed vector

Set(...)
Set(vec: Vector2D) None

Initialize from vector 2D.

Args:

vec:  Vector.

Set(x: float, y: float) None

Initialize from x,y coordinates.

Args:

x:  coordinate.
y:  coordinate.

Set(startPoint: Point2D, endPoint: Point2D) None

Initialize vector from two points.

Args:

startPoint:  start point of vector.
endPoint:    end point of vector.

Values() list(double]

Get copy of X,Y coordinates as python list

Returns:

X coordinate of vector.,
Y coordinate of vector.

__add__(vec: Vector2D) Vector2D

Addition operator.

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

Args:

vec:  Vector(Vb).

Returns:

new Vector(Vc).

__eq__(vec: Vector2D) bool

Comparison of vectors without tolerance.

Be careful, this method work without tolerance!

Args:

vec:  Compared vector.

Returns:

True when points are equal, otherwise false.

__iadd__(vec: Vector2D) Vector2D

Addition assignment operator.

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

Args:

vec:  Vb Vector.

Returns:

Reference to vector.

__idiv__(divider: float) Vector2D

Multiply the vector by a factor (scalar multiplication)

Args:

divider:  scaling divider

Returns:

New vector

__imul__(...)
__imul__(matrix: Matrix2D) Vector2D

Matrix transformation.

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

Args:

matrix:  Transformation matrix.

Returns:

Vector2D.

__imul__(factor: float) Vector2D

Multiply the vector by a factor (scalar multiplication)

Args:

factor:  Scale factor

Returns:

New vector

__init__(...)
__init__() None
__init__(vec: Vector2D) None

Copy constructor.

Args:

vec:  Vector which will be copied.

__init__(angle: Angle, length: float) None

Constructor.

Create vector from the angle and from the length. Formula: [X_COORD, Y_COORD] = [length*cos(angle), length*sin(angle)]

Args:

angle:   base angle.
length:  length of vector (must be greater then zero).

__init__(x: float, y: float) None

Constructor.

Initialize vector from single coordinates.

Args:

x:  X coordinate of vector.
y:  Y coordinate of vector.

__init__(startPoint: Point2D, endPoint: Point2D) None

Constructor.

Initialize vector from two points.

Args:

startPoint:  start point of vector.
endPoint:    end point of vector.

__init__(endPoint: Point2D) None

Create a vector from a 2D point

Args:

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

__init__(vec: Vector3D) None

Copy constructor.

Copy only X_COORD and Y_COORD from vector.

Args:

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

__isub__(vec: Vector2D) Vector2D

Subtraction assignment operator.

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

Args:

vec:  Vb Vector.

Returns:

Reference to vector.

__mul__(...)
__mul__(vec: Vector2D) Vector3D

Cross(vector) product operator.

Formula: Vc = Va x Vb Va is this Vector

Args:

vec:  Vector(Vb).

Returns:

new Vector(Vc).

__mul__(matrix: Matrix2D) Vector2D

Matrix transformation.

Formula: Result = Vector(this) * matrix

Args:

matrix:  Transformation matrix.

Returns:

Vector2D.

__mul__(factor: float) Vector2D

Multiply the vector by a factor (scalar multiplication)

Args:

factor:  Scale factor

Returns:

New vector

__ne__(vec: Vector2D) bool

Comparison of vectors without tolerance.

Be careful, this method work without tolerance!

Args:

vec:  Compared vector.

Returns:

True when points are not equal, otherwise false.

__repr__() str

Convert to string

__sub__(vec: Vector2D) Vector2D

Subtraction operator.

Formula: Vc = Va - Vb Va is this Vector

Args:

vec:  Vector(Vb).

Returns:

new Vector(Vc).

__truediv__(divider: float) Vector2D

Multiply the vector by a factor (scalar multiplication)

Args:

divider:  scaling divider

Returns:

New vector

property X: float

Get the X coordinate reference.

Set the X coordinate reference.

property Y: float

Get the Y coordinate reference.

Set the Y coordinate reference.

__module__ = 'NemAll_Python_Geometry'