vector3

vector3 Represents a vector in 3-dimensional real space.
vector3.Set(self, inX, inY, inZ) Set x,y and z-component of a vector :param inX: Input X-coordinate :type inX: float :param inY: Input Y-coordinate :type inY: float :param inZ: Input Z-coordinate :type inZ: float
vector3.SetX(self, inX) To set the x-coordinate of the vector :param inX: Input X-coordinate :type inX: float
vector3.SetY(self, inY) To set the y-coordinate of the vector :param inX: Input Y-coordinate :type inX: float
vector3.SetZ(self, inZ) To set the z-coordinate of the vector :param inX: Input Z-coordinate :type inX: float
vector3.GetX(self) to Get the x-coordinate of the vector
vector3.GetY(self) to Get the y-coordinate of the vector
vector3.GetZ(self) to Get the z-coordinate of the vector
vector3.Get(self) To Get coordinates as a list
vector3.copy(self) To copy this vector
vector3.normalize(self) Normalize the vector
vector3.CanBeNormalized(self) Whether a vector can be normalized
vector3.length_2(self) The length of the vector squared
vector3.length(self) The length of the vector
vector3.IsApprox(self, arg0, arg1) Safe comparison for floating-point vector3
vector3.distSq(self, v) Square of distance between self and input vector.
vector3.createOrthoVector(self) Creates a vector of length one, orthogonal to this
dot(v1, v2) Dot product of two vectors
cross(v1, v2) Cross product of two vectors
vectorAngle(v1, v2) Calculate the angle between vectors (in degrees)
CalcTorsionAngle(a, b, c, d) Calculate the torsion angle between vectors (in degrees)
Point2PlaneSigned(a, b, c, d) Calculate the signed distance of point a to the plane determined by b,c,d
Point2Plane(a, b, c, d) Calculate the distance of point a to the plane determined by b,c,d
Point2PlaneAngle(a, b, c, d) Calculate the angle between point a and the plane determined by b,c,d
Point2Line(a, b, c) Calculate the distance of a point a to a line determined by b and c

Documentation

class vector3

Represents a vector in 3-dimensional real space.

The vector3 class was designed to simplify operations with floating point coordinates. To this end many of the common operations have been overloaded for simplicity. Vector addition, subtraction, scalar multiplication, dot product, cross product, magnitude and a number of other utility functions are built in to the vector class. For a full description of the class member functions please consult the documentation. The following code demonstrates several of the functions of the vector class:

Example

v1, v2, v3 = vector3(), vector3(), vector3()
v1.Set([1, 2, 3])
v2.Set([4 ,5, 6])
v3 = cross(v1,v2)
v3 *= 2.5
v3.normalize()
CanBeNormalized(self: pyOBabel.pyOBabel.vector3) → bool

Whether a vector can be normalized

Returns:CanBeNormalize – True or False
Return type:bool
Get(self: pyOBabel.pyOBabel.vector3) → list

To Get coordinates as a list

Returns:list – coordinates as a list
Return type:list
GetX(self: pyOBabel.pyOBabel.vector3) → float

to Get the x-coordinate of the vector

Returns:outX – x-coordinate of the vector
Return type:float
GetY(self: pyOBabel.pyOBabel.vector3) → float

to Get the y-coordinate of the vector

Returns:outY – y-coordinate of the vector
Return type:float
GetZ(self: pyOBabel.pyOBabel.vector3) → float

to Get the z-coordinate of the vector

Returns:outZ – z-coordinate of the vector
Return type:float
IsApprox(self: pyOBabel.pyOBabel.vector3, arg0: pyOBabel.pyOBabel.vector3, arg1: float) → bool

Safe comparison for floating-point vector3

True if this vector is approximately equal to the other vector to the input precision. More specifically, this method works exactly like the pyOBabel.IsApprox() function, replacing the absolute value for doubles by the norm for vectors.

Parameters:
  • other (vector3) – The vector for comparison
  • precision (float) – This parameter plays the same role as in pyOBabel.IsApprox()
Returns:

IsApprox – True or False

Return type:

bool

Set(self: pyOBabel.pyOBabel.vector3, inX: float, inY: float, inZ: float) → None

Set x,y and z-component of a vector :param inX: Input X-coordinate :type inX: float :param inY: Input Y-coordinate :type inY: float :param inZ: Input Z-coordinate :type inZ: float

Returns:
Return type:None
SetX(self: pyOBabel.pyOBabel.vector3, inX: float) → None

To set the x-coordinate of the vector :param inX: Input X-coordinate :type inX: float

Returns:
Return type:None
SetY(self: pyOBabel.pyOBabel.vector3, inY: float) → None

To set the y-coordinate of the vector :param inX: Input Y-coordinate :type inX: float

Returns:
Return type:None
SetZ(self: pyOBabel.pyOBabel.vector3, inZ: float) → None

To set the z-coordinate of the vector :param inX: Input Z-coordinate :type inX: float

Returns:
Return type:None
copy(self: pyOBabel.pyOBabel.vector3) → pyOBabel.pyOBabel.vector3

To copy this vector

Parameters:inpVector (vector3) – Vector to copy
Returns:
Return type:None
createOrthoVector(self: pyOBabel.pyOBabel.vector3) → pyOBabel.pyOBabel.vector3

Creates a vector of length one, orthogonal to this

Create a unit orthogonal vector

Returns:v – Unit orthogonal vector or None if not successfull
Return type:vector3
distSq(self: pyOBabel.pyOBabel.vector3, v: pyOBabel.pyOBabel.vector3) → float

Square of distance between self and input vector.

square of the distance between self and vv. equivalent to length_2(self-vv)

Parameters:v (vector3) – Vector to copy
Returns:length – The square of distance between self and input vector
Return type:float
length(self: pyOBabel.pyOBabel.vector3) → float

The length of the vector

Returns:length – The length of the vector
Return type:float
length_2(self: pyOBabel.pyOBabel.vector3) → float

The length of the vector squared

Returns:length2 – The squared length of the vector
Return type:float
normalize(self: pyOBabel.pyOBabel.vector3) → pyOBabel.pyOBabel.vector3

Normalize the vector

Scales a vector to give it length one.

Returns:normalized – The normalized vector
Return type:vector3
dot(v1: pyOBabel.pyOBabel.vector3, v2: pyOBabel.pyOBabel.vector3) → float

Dot product of two vectors

Parameters:
Returns:

product – Dot product of two vectors

Return type:

float

cross(v1: pyOBabel.pyOBabel.vector3, v2: pyOBabel.pyOBabel.vector3) → pyOBabel.pyOBabel.vector3

Cross product of two vectors

Parameters:
Returns:

cross – Cross product of two vectors

Return type:

vector3

vectorAngle(v1: pyOBabel.pyOBabel.vector3, v2: pyOBabel.pyOBabel.vector3) → float

Calculate the angle between vectors (in degrees)

Parameters:
Returns:

angle – Angle between vectors (in degrees)

Return type:

float

CalcTorsionAngle(a: pyOBabel.pyOBabel.vector3, b: pyOBabel.pyOBabel.vector3, c: pyOBabel.pyOBabel.vector3, d: pyOBabel.pyOBabel.vector3) → float

Calculate the torsion angle between vectors (in degrees)

Parameters:
Returns:

angle – Torsion angle between vectors (in degrees)

Return type:

float

Point2PlaneSigned(a: pyOBabel.pyOBabel.vector3, b: pyOBabel.pyOBabel.vector3, c: pyOBabel.pyOBabel.vector3, d: pyOBabel.pyOBabel.vector3) → float

Calculate the signed distance of point a to the plane determined by b,c,d

Parameters:
Returns:

distance – Signed distance between point to a plane

Return type:

float

Point2Plane(a: pyOBabel.pyOBabel.vector3, b: pyOBabel.pyOBabel.vector3, c: pyOBabel.pyOBabel.vector3, d: pyOBabel.pyOBabel.vector3) → float

Calculate the distance of point a to the plane determined by b,c,d

Parameters:
Returns:

distance – Distance between point to a plane

Return type:

float

Point2PlaneAngle(a: pyOBabel.pyOBabel.vector3, b: pyOBabel.pyOBabel.vector3, c: pyOBabel.pyOBabel.vector3, d: pyOBabel.pyOBabel.vector3) → float

Calculate the angle between point a and the plane determined by b,c,d

Parameters:
Returns:

angle – angle between a point and plane

Return type:

float

Point2Line(a: pyOBabel.pyOBabel.vector3, b: pyOBabel.pyOBabel.vector3, c: pyOBabel.pyOBabel.vector3) → float

Calculate the distance of a point a to a line determined by b and c

Parameters:
Returns:

distance – Distance between a point and a line

Return type:

float