Basic Mechanica Types

Mechanica uses some basic types that provide support and convenience methods for particular operations, especially concerning vector and tensor operations. Some of these types are completely native to Mechanica, and others constructed partially or completely from types distributed in various Mechanica dependencies (e.g., MxVector3f from Vector3, from Magnum.

class mechanica.MxVector2d(*args)

A 2D vector with double elements

static xAxis(*args, **kwargs) mx::type::MxVector2< double >
static yAxis(*args, **kwargs) mx::type::MxVector2< double >
static xScale(scale: double) mx::type::MxVector2< double >
static yScale(scale: double) mx::type::MxVector2< double >
x(*args) double
y(*args) double
flipped() mx::type::MxVector2< double >
dot(*args) double
__len__() int
__iadd__(*args) mx::type::MxVector2< double > &
__add__(*args) mx::type::MxVector2< double >
__isub__(*args) mx::type::MxVector2< double > &
__sub__(*args) mx::type::MxVector2< double >
__imul__(*args) mx::type::MxVector2< double > &
__mul__(*args) mx::type::MxVector2< double >
__itruediv__(*args)
__truediv__(*args)
length()

length of vector

normalized()

vector normalized

resized(length)

resize be a length

projected(other)

project onto another vector

projectedOntoNormalized(other)

project onto a normalized vector

distance(line_start_pt, line_end_pt)

distance from a line defined by two points

__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxVector2f(*args)

A 2D vector with float elements

static xAxis(*args, **kwargs) mx::type::MxVector2< float >
static yAxis(*args, **kwargs) mx::type::MxVector2< float >
static xScale(scale: float) mx::type::MxVector2< float >
static yScale(scale: float) mx::type::MxVector2< float >
x(*args) float
y(*args) float
flipped() mx::type::MxVector2< float >
dot(*args) float
__len__() int
__iadd__(*args) mx::type::MxVector2< float > &
__add__(*args) mx::type::MxVector2< float >
__isub__(*args) mx::type::MxVector2< float > &
__sub__(*args) mx::type::MxVector2< float >
__imul__(*args) mx::type::MxVector2< float > &
__mul__(*args) mx::type::MxVector2< float >
__itruediv__(*args)
__truediv__(*args)
length()

length of vector

normalized()

vector normalized

resized(length)

resize be a length

projected(other)

project onto another vector

projectedOntoNormalized(other)

project onto a normalized vector

distance(line_start_pt, line_end_pt)

distance from a line defined by two points

__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxVector2i(*args)

A 2D vector with int elements

static xAxis(*args, **kwargs) mx::type::MxVector2< int >
static yAxis(*args, **kwargs) mx::type::MxVector2< int >
static xScale(scale: int) mx::type::MxVector2< int >
static yScale(scale: int) mx::type::MxVector2< int >
x(*args) int
y(*args) int
flipped() mx::type::MxVector2< int >
dot(*args) int
__len__() int
__iadd__(*args) mx::type::MxVector2< int > &
__add__(*args) mx::type::MxVector2< int >
__isub__(*args) mx::type::MxVector2< int > &
__sub__(*args) mx::type::MxVector2< int >
__imul__(*args) mx::type::MxVector2< int > &
__mul__(*args) mx::type::MxVector2< int >
__itruediv__(*args)
__truediv__(*args)
__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxVector3d(*args)

A 3D vector with double elements

static xAxis(*args, **kwargs) mx::type::MxVector3< double >
static yAxis(*args, **kwargs) mx::type::MxVector3< double >
static zAxis(*args, **kwargs) mx::type::MxVector3< double >
static xScale(scale: double) mx::type::MxVector3< double >
static yScale(scale: double) mx::type::MxVector3< double >
static zScale(scale: double) mx::type::MxVector3< double >
x(*args) double
y(*args) double
z(*args) double
r(*args) double
g(*args) double
b(*args) double
xy()
flipped() mx::type::MxVector3< double >
dot(*args) double
__len__() int
__iadd__(*args) mx::type::MxVector3< double > &
__add__(*args) mx::type::MxVector3< double >
__isub__(*args) mx::type::MxVector3< double > &
__sub__(*args) mx::type::MxVector3< double >
__imul__(*args) mx::type::MxVector3< double > &
__mul__(*args) mx::type::MxVector3< double >
__itruediv__(*args)
__truediv__(*args)
length()

length of vector

normalized()

vector normalized

resized(length)

resize be a length

projected(other)

project onto another vector

projectedOntoNormalized(other)

project onto a normalized vector

distance(line_start_pt, line_end_pt)

distance from a line defined by two points

__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxVector3f(*args)

A 3D vector with float elements

static xAxis(*args, **kwargs) mx::type::MxVector3< float >
static yAxis(*args, **kwargs) mx::type::MxVector3< float >
static zAxis(*args, **kwargs) mx::type::MxVector3< float >
static xScale(scale: float) mx::type::MxVector3< float >
static yScale(scale: float) mx::type::MxVector3< float >
static zScale(scale: float) mx::type::MxVector3< float >
x(*args) float
y(*args) float
z(*args) float
r(*args) float
g(*args) float
b(*args) float
xy()
flipped() mx::type::MxVector3< float >
dot(*args) float
__len__() int
__iadd__(*args) mx::type::MxVector3< float > &
__add__(*args) mx::type::MxVector3< float >
__isub__(*args) mx::type::MxVector3< float > &
__sub__(*args) mx::type::MxVector3< float >
__imul__(*args) mx::type::MxVector3< float > &
__mul__(*args) mx::type::MxVector3< float >
__itruediv__(*args)
__truediv__(*args)
length()

length of vector

normalized()

vector normalized

resized(length)

resize be a length

projected(other)

project onto another vector

projectedOntoNormalized(other)

project onto a normalized vector

distance(line_start_pt, line_end_pt)

distance from a line defined by two points

__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxVector3i(*args)

A 3D vector with int elements

static xAxis(*args, **kwargs) mx::type::MxVector3< int >
static yAxis(*args, **kwargs) mx::type::MxVector3< int >
static zAxis(*args, **kwargs) mx::type::MxVector3< int >
static xScale(scale: int) mx::type::MxVector3< int >
static yScale(scale: int) mx::type::MxVector3< int >
static zScale(scale: int) mx::type::MxVector3< int >
x(*args) int
y(*args) int
z(*args) int
r(*args) int
g(*args) int
b(*args) int
xy(*args) mx::type::MxVector2< int > const
flipped() mx::type::MxVector3< int >
dot(*args) int
__len__() int
__iadd__(*args) mx::type::MxVector3< int > &
__add__(*args) mx::type::MxVector3< int >
__isub__(*args) mx::type::MxVector3< int > &
__sub__(*args) mx::type::MxVector3< int >
__imul__(*args) mx::type::MxVector3< int > &
__mul__(*args) mx::type::MxVector3< int >
__itruediv__(*args)
__truediv__(*args)
__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxVector4d(*args)

A 4D vector with double elements

x(*args) double
y(*args) double
z(*args) double
w(*args) double
r(*args) double
g(*args) double
b(*args) double
a(*args) double
xyz()
rgb(*args) mx::type::MxVector3< double > const
xy(*args) mx::type::MxVector2< double > const
flipped() mx::type::MxVector4< double >
dot(*args) double
__len__() int
__iadd__(*args) mx::type::MxVector4< double > &
__add__(*args) mx::type::MxVector4< double >
__isub__(*args) mx::type::MxVector4< double > &
__sub__(*args) mx::type::MxVector4< double >
__imul__(*args) mx::type::MxVector4< double > &
__mul__(*args) mx::type::MxVector4< double >
__itruediv__(*args)
__truediv__(*args)
length()

length of vector

normalized()

vector normalized

resized(length)

resize be a length

projected(other)

project onto another vector

projectedOntoNormalized(other)

project onto a normalized vector

distance(point)

distance from a point

distanceScaled(point)

scaled distance from a point

classmethod planeEquation(*args)

get a plane equation

__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxVector4f(*args)

A 4D vector with float elements

x(*args) float
y(*args) float
z(*args) float
w(*args) float
r(*args) float
g(*args) float
b(*args) float
a(*args) float
xyz()
rgb(*args) mx::type::MxVector3< float > const
xy(*args) mx::type::MxVector2< float > const
flipped() mx::type::MxVector4< float >
dot(*args) float
__len__() int
__iadd__(*args) mx::type::MxVector4< float > &
__add__(*args) mx::type::MxVector4< float >
__isub__(*args) mx::type::MxVector4< float > &
__sub__(*args) mx::type::MxVector4< float >
__imul__(*args) mx::type::MxVector4< float > &
__mul__(*args) mx::type::MxVector4< float >
__itruediv__(*args)
__truediv__(*args)
length()

length of vector

normalized()

vector normalized

resized(length)

resize be a length

projected(other)

project onto another vector

projectedOntoNormalized(other)

project onto a normalized vector

distance(point)

distance from a point

distanceScaled(point)

scaled distance from a point

classmethod planeEquation(*args)

get a plane equation

__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxVector4i(*args)

A 4D vector with int elements

x(*args) int
y(*args) int
z(*args) int
w(*args) int
r(*args) int
g(*args) int
b(*args) int
a(*args) int
xyz(*args) mx::type::MxVector3< int > const
rgb(*args) mx::type::MxVector3< int > const
xy(*args) mx::type::MxVector2< int > const
flipped() mx::type::MxVector4< int >
dot(*args) int
__len__() int
__iadd__(*args) mx::type::MxVector4< int > &
__add__(*args) mx::type::MxVector4< int >
__isub__(*args) mx::type::MxVector4< int > &
__sub__(*args) mx::type::MxVector4< int >
__imul__(*args) mx::type::MxVector4< int > &
__mul__(*args) mx::type::MxVector4< int >
__itruediv__(*args)
__truediv__(*args)
__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxMatrix3d(*args)

A 3x3 square matrix with double elements

static rotation(angle: double) mx::type::MxMatrix3< double >
static shearingX(amount: double) mx::type::MxMatrix3< double >
static shearingY(amount: double) mx::type::MxMatrix3< double >
isRigidTransformation() bool
invertedRigid() mx::type::MxMatrix3< double >
__neg__() mx::type::MxMatrix3< double >
__iadd__(other: MxMatrix3d) mx::type::MxMatrix3< double > &
__add__(other: MxMatrix3d) mx::type::MxMatrix3< double >
__isub__(other: MxMatrix3d) mx::type::MxMatrix3< double > &
__sub__(other: MxMatrix3d) mx::type::MxMatrix3< double >
__imul__(number: double) mx::type::MxMatrix3< double > &
__mul__(*args) mx::type::MxVector3< double >
__itruediv__(*args)
__truediv__(*args)
flippedCols() mx::type::MxMatrix3< double >
flippedRows() mx::type::MxMatrix3< double >
row(row: std::size_t) mx::type::MxVector3< double >
__mul__(*args) mx::type::MxVector3< double >
transposed() mx::type::MxMatrix3< double >
diagonal() mx::type::MxVector3< double >
inverted() mx::type::MxMatrix3< double >
invertedOrthogonal() mx::type::MxMatrix3< double >
__len__() int
__getitem__(index: int)
__setitem__(index: int, val)
as_lists() list

convert to a list of python lists

__str__() str

Return str(self).

class mechanica.MxMatrix3f(*args)

A 3x3 square matrix with float elements

static rotation(angle: float) mx::type::MxMatrix3< float >
static shearingX(amount: float) mx::type::MxMatrix3< float >
static shearingY(amount: float) mx::type::MxMatrix3< float >
isRigidTransformation() bool
invertedRigid() mx::type::MxMatrix3< float >
__neg__() mx::type::MxMatrix3< float >
__iadd__(other: MxMatrix3f) mx::type::MxMatrix3< float > &
__add__(other: MxMatrix3f) mx::type::MxMatrix3< float >
__isub__(other: MxMatrix3f) mx::type::MxMatrix3< float > &
__sub__(other: MxMatrix3f) mx::type::MxMatrix3< float >
__imul__(number: float) mx::type::MxMatrix3< float > &
__mul__(*args) mx::type::MxVector3< float >
__itruediv__(*args)
__truediv__(*args)
flippedCols() mx::type::MxMatrix3< float >
flippedRows() mx::type::MxMatrix3< float >
row(row: std::size_t) mx::type::MxVector3< float >
__mul__(*args) mx::type::MxVector3< float >
transposed() mx::type::MxMatrix3< float >
diagonal() mx::type::MxVector3< float >
inverted() mx::type::MxMatrix3< float >
invertedOrthogonal() mx::type::MxMatrix3< float >
__len__() int
__getitem__(index: int)
__setitem__(index: int, val)
as_lists() list

convert to a list of python lists

__str__() str

Return str(self).

class mechanica.MxMatrix4d(*args)

A 4x4 square matrix with double elements

static rotationX(angle: double) mx::type::MxMatrix4< double >
static rotationY(angle: double) mx::type::MxMatrix4< double >
static rotationZ(angle: double) mx::type::MxMatrix4< double >
static reflection(normal: MxVector3d) mx::type::MxMatrix4< double >
static shearingXY(amountX: double, amountY: double) mx::type::MxMatrix4< double >
static shearingXZ(amountX: double, amountZ: double) mx::type::MxMatrix4< double >
static shearingYZ(amountY: double, amountZ: double) mx::type::MxMatrix4< double >
static orthographicProjection(size: MxVector2d, near: double, far: double) mx::type::MxMatrix4< double >
static perspectiveProjection(*args) mx::type::MxMatrix4< double >
static lookAt(eye: MxVector3d, target: MxVector3d, up: MxVector3d) mx::type::MxMatrix4< double >
isRigidTransformation() bool
rotationScaling() mx::type::MxMatrix3< double >
rotationShear() mx::type::MxMatrix3< double >
rotation(*args) mx::type::MxMatrix3< double >
rotationNormalized() mx::type::MxMatrix3< double >
scalingSquared() mx::type::MxVector3< double >
scaling(*args) mx::type::MxVector3< double >
uniformScalingSquared() double
uniformScaling() double
normalMatrix() mx::type::MxMatrix3< double >
right(*args) mx::type::MxVector3< double >
up(*args) mx::type::MxVector3< double >
backward(*args) mx::type::MxVector3< double >
translation(*args) mx::type::MxVector3< double >
invertedRigid() mx::type::MxMatrix4< double >
transformVector(vector: MxVector3d) mx::type::MxVector3< double >
transformPoint(vector: MxVector3d) mx::type::MxVector3< double >
__neg__() mx::type::MxMatrix4< double >
__iadd__(other: MxMatrix4d) mx::type::MxMatrix4< double > &
__add__(other: MxMatrix4d) mx::type::MxMatrix4< double >
__isub__(other: MxMatrix4d) mx::type::MxMatrix4< double > &
__sub__(other: MxMatrix4d) mx::type::MxMatrix4< double >
__imul__(number: double) mx::type::MxMatrix4< double > &
__itruediv__(*args)
__truediv__(*args)
flippedCols() mx::type::MxMatrix4< double >
flippedRows() mx::type::MxMatrix4< double >
row(row: std::size_t) mx::type::MxVector4< double >
__mul__(*args) mx::type::MxVector4< double >
transposed() mx::type::MxMatrix4< double >
diagonal() mx::type::MxVector4< double >
inverted() mx::type::MxMatrix4< double >
invertedOrthogonal() mx::type::MxMatrix4< double >
__len__() int
__getitem__(index: int)
__setitem__(index: int, val)
as_lists() list

convert to a list of python lists

__str__() str

Return str(self).

class mechanica.MxMatrix4f(*args)

A 4x4 square matrix with float elements

static rotationX(angle: float) mx::type::MxMatrix4< float >
static rotationY(angle: float) mx::type::MxMatrix4< float >
static rotationZ(angle: float) mx::type::MxMatrix4< float >
static reflection(normal: MxVector3f) mx::type::MxMatrix4< float >
static shearingXY(amountX: float, amountY: float) mx::type::MxMatrix4< float >
static shearingXZ(amountX: float, amountZ: float) mx::type::MxMatrix4< float >
static shearingYZ(amountY: float, amountZ: float) mx::type::MxMatrix4< float >
static orthographicProjection(size: MxVector2f, near: float, far: float) mx::type::MxMatrix4< float >
static perspectiveProjection(*args) mx::type::MxMatrix4< float >
static lookAt(eye: MxVector3f, target: MxVector3f, up: MxVector3f) mx::type::MxMatrix4< float >
isRigidTransformation() bool
rotationScaling() mx::type::MxMatrix3< float >
rotationShear() mx::type::MxMatrix3< float >
rotation(*args) mx::type::MxMatrix3< float >
rotationNormalized() mx::type::MxMatrix3< float >
scalingSquared() mx::type::MxVector3< float >
scaling(*args) mx::type::MxVector3< float >
uniformScalingSquared() float
uniformScaling() float
normalMatrix() mx::type::MxMatrix3< float >
right(*args) mx::type::MxVector3< float >
up(*args) mx::type::MxVector3< float >
backward(*args) mx::type::MxVector3< float >
translation(*args) mx::type::MxVector3< float >
invertedRigid() mx::type::MxMatrix4< float >
transformVector(vector: MxVector3f) mx::type::MxVector3< float >
transformPoint(vector: MxVector3f) mx::type::MxVector3< float >
__neg__() mx::type::MxMatrix4< float >
__iadd__(other: MxMatrix4f) mx::type::MxMatrix4< float > &
__add__(other: MxMatrix4f) mx::type::MxMatrix4< float >
__isub__(other: MxMatrix4f) mx::type::MxMatrix4< float > &
__sub__(other: MxMatrix4f) mx::type::MxMatrix4< float >
__imul__(number: float) mx::type::MxMatrix4< float > &
__itruediv__(*args)
__truediv__(*args)
flippedCols() mx::type::MxMatrix4< float >
flippedRows() mx::type::MxMatrix4< float >
row(row: std::size_t) mx::type::MxVector4< float >
__mul__(*args) mx::type::MxVector4< float >
transposed() mx::type::MxMatrix4< float >
diagonal() mx::type::MxVector4< float >
inverted() mx::type::MxMatrix4< float >
invertedOrthogonal() mx::type::MxMatrix4< float >
__len__() int
__getitem__(index: int)
__setitem__(index: int, val)
as_lists() list

convert to a list of python lists

__str__() str

Return str(self).

class mechanica.MxQuaterniond(*args)

A quaternion with double elements

static rotation(angle: double, normalizedAxis: MxVector3d) mx::type::MxQuaternion< double >
static fromMatrix(matrix: MxMatrix3d) mx::type::MxQuaternion< double >
data(*args) double const *
__eq__(other: MxQuaterniond) bool

Return self==value.

__ne__(other: MxQuaterniond) bool

Return self!=value.

isNormalized() bool
vector() mx::type::MxVector3< double > const
scalar() double
angle(*args) double
axis() mx::type::MxVector3< double >
toMatrix() mx::type::MxMatrix3< double >
toEuler() mx::type::MxVector3< double >
__neg__() mx::type::MxQuaternion< double >
__iadd__(other: MxQuaterniond) mx::type::MxQuaternion< double > &
__add__(other: MxQuaterniond) mx::type::MxQuaternion< double >
__isub__(other: MxQuaterniond) mx::type::MxQuaternion< double > &
__sub__(other: MxQuaterniond) mx::type::MxQuaternion< double >
__imul__(scalar: double) mx::type::MxQuaternion< double > &
__itruediv__(*args)
__truediv__(*args)
__mul__(*args) mx::type::MxQuaternion< double >
dot() double
length() double
normalized() mx::type::MxQuaternion< double >
conjugated() mx::type::MxQuaternion< double >
inverted() mx::type::MxQuaternion< double >
invertedNormalized() mx::type::MxQuaternion< double >
transformVector(vector: MxVector3d) mx::type::MxVector3< double >
transformVectorNormalized(vector: MxVector3d) mx::type::MxVector3< double >
__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).

class mechanica.MxQuaternionf(*args)

A quaternion with float elements

static rotation(angle: float, normalizedAxis: MxVector3f) mx::type::MxQuaternion< float >
static fromMatrix(matrix: MxMatrix3f) mx::type::MxQuaternion< float >
data(*args) float const *
__eq__(other: MxQuaternionf) bool

Return self==value.

__ne__(other: MxQuaternionf) bool

Return self!=value.

isNormalized() bool
vector() mx::type::MxVector3< float > const
scalar() float
angle(*args) float
axis() mx::type::MxVector3< float >
toMatrix() mx::type::MxMatrix3< float >
toEuler() mx::type::MxVector3< float >
__neg__() mx::type::MxQuaternion< float >
__iadd__(other: MxQuaternionf) mx::type::MxQuaternion< float > &
__add__(other: MxQuaternionf) mx::type::MxQuaternion< float >
__isub__(other: MxQuaternionf) mx::type::MxQuaternion< float > &
__sub__(other: MxQuaternionf) mx::type::MxQuaternion< float >
__imul__(scalar: float) mx::type::MxQuaternion< float > &
__itruediv__(*args)
__truediv__(*args)
__mul__(*args) mx::type::MxQuaternion< float >
dot() float
length() float
normalized() mx::type::MxQuaternion< float >
conjugated() mx::type::MxQuaternion< float >
inverted() mx::type::MxQuaternion< float >
invertedNormalized() mx::type::MxQuaternion< float >
transformVector(vector: MxVector3f) mx::type::MxVector3< float >
transformVectorNormalized(vector: MxVector3f) mx::type::MxVector3< float >
__getitem__(index: int)
__setitem__(index: int, val)
as_list() list

convert to a python list

__str__() str

Return str(self).