# Matrix44 (hwx.common.math)¶

A 4x4 orthonormal Matrix.

## Properties¶

 angles location origin x y z

## Public Methods¶

 copy (self) divide (self, other) format (self, format=’%s’) getDeterminant (self) getEulerAngles (self, degrees=False) getTranslation (self) invert (self) isIdentity (self) multiply (self, other) multiplyPoint (self, x, y=None, z=None) multiplyVector (self, x, y=None, z=None) orientFromAxes (self, axes, dir1, dir2=(1, 0, 0)) orientFromEulerAngles (self, e1, e2=None, e3=None, degrees=False) orientFromEulerParameters (self, e0, e1=None, e2=None, e3=None) orthogonalize (self) pt (self, x, y=None, z=None) pts (self, pts) rotate (self, axis, angle, degrees=True) rotateAroundAxis (self, axis, angle, degrees=True) rotx (self, angle, degrees=True) roty (self, angle, degrees=True) rotz (self, angle, degrees=True) scale (self, x, y=None, z=None) setTranslation (self, x, y=None, z=None) translate (self, x=0, y=None, z=None) transpose (self) update (self, other) vec (self, x, y=None, z=None) zeroSmallValues (self, zero=1e-10) zp (self, pt1, pt2=None)

## Property Details¶

angles()

The Euler angles (Body313) in radians.

location()

Returns or sets the location/origin value.

origin()

Returns or sets the location/origin value.

x()

The vector along the x-axis.

y()

The vector along the y-axis.

z()

The vector along the z-axis.

## Method Details¶

copy(self)

Creates a copy of self.

returns: The newly created Matrix44. Matrix44
divide(self, other)

Returns the result of the multiplication with the inverse of other.

param other: The Matrix44 to inverse and multiply with. Matrix44 The result of the multiplication with the inverse. Matrix44
format(self, format='%s')

Formats as a string.

param format: The format style to use. str A string represantation of the instance Matrix44 object on which it was called. str
getDeterminant(self)

Returns the matrix determinant.

getEulerAngles(self, degrees=False)

Returns the Euler angles.

param degrees: Determines if the angle values are in degrees or not. bool The Euler angles. list
getTranslation(self)

Returns the position as a Point.

invert(self)

Computes the inverse.

returns: The inverse of the instance Matrix44 object on which it was called. Matrix44
isIdentity(self)

Returns True if self is the identity matrix, False otherwise.

multiply(self, other)

Multiplies with other.

param other: The other to multiply with. Union[int, float, Point, Vector, Matrix44] The result of the multiplication. Union[Matrix44, Vector, Point]
multiplyPoint(self, x, y=None, z=None)

Multiplies with a Point.

Points are represented as mathematical column points and have a one in the fourth position, which includes translation operations.

param x: An itetable of 3 or the x value of a Point. Union[Point, list[float], float] The y value of a Point. float The z value of a Point. float The result of the multiplication. Point
multiplyVector(self, x, y=None, z=None)

Multiplies with the Vector specified with x, y, z.

The x can be a float, Vector (or list).

Vectors are represented as mathematical column vectors and have a zero in the fourth position, which does not include translation operations.

param x: An itetable of 3 or the x value of a Vector. Union[Vector, list[float], float] The y value of a Vector. float The z value of a Vector. float The result of the multiplication. Vector
orientFromAxes(self, axes, dir1, dir2=(1, 0, 0))

Orients with the specified axes.

param axes: The axis to orient by: Valid choices are ‘x’, ‘y’, ‘z’, ‘xy’, ‘xz’, ‘yx’, ‘yz’, ‘zx’, ‘zy’. str The vector for the first axis. Union[Vector, list[float]] The vector for the second axis. Union[Vector, list[float]] RuntimeError – In case of unsupported axes specification A reference to the instance Matrix44 object on which it was called. Matrix44
orientFromEulerAngles(self, e1, e2=None, e3=None, degrees=False)

Orients with the specified Euler angles.

param e1: Rotation around x-axis. float Rotation around y-axis. float Rotation around z-axis. float Determines if the angle values are in degrees or not. bool A reference to the instance Matrix44 object on which it was called. Matrix44
orientFromEulerParameters(self, e0, e1=None, e2=None, e3=None)

Orients with the specified Euler parameters.

param e0: Euler parameter. float Euler parameter. float Euler parameter. float Euler parameter. float A reference to the instance Matrix44 object on which it was called. Matrix44
orthogonalize(self)

Orthogonalizes the axes (x, y, z).

raises: RuntimeError – If Matrix44 can not be orthogonalized. A Matrix44 with x, y, z being orthogonal. Matrix44
pt(self, x, y=None, z=None)

Multiplies with a Point.

Points are represented as mathematical column points and have a one in the fourth position, which includes translation operations.

param x: An itetable of 3 or the x value of a Point. Union[Point, list[float], float] The y value of a Point. float The z value of a Point. float The result of the multiplication. Point
pts(self, pts)

Returns the result of multiplying each Point in the specified list of Points with self.

param pts: A Point (or list). list[Union[Point, list[float]]] The result of the pieswise multiplication. list[Point]
rotate(self, axis, angle, degrees=True)

Rotates around the specified axis.

This is a body rotation.

param axis: The rotation axis. Valid choices are “x”, “y”, “z” or any Vector. Union[Vector, str] The rotation angle. float Determines if angles is in degrees or not. bool A newly created Matrix44. Matrix44
rotateAroundAxis(self, axis, angle, degrees=True)

Rotates around the axis.

This is a body rotation.

param axis: The rotation axis. Vector The rotation angle. float Determines if angles is in degrees or not. bool A newly created Matrix44. Matrix44
rotx(self, angle, degrees=True)

Rotates around the x-axis.

This is a body rotation.

param angle: The rotation angle. float Determines if angles is in degrees or not. bool A newly created Matrix44. Matrix44
roty(self, angle, degrees=True)

Rotates around the y-axis.

This is a body rotation.

param angle: The rotation angle. float Determines if angles is in degrees or not. bool A newly created Matrix44. Matrix44
rotz(self, angle, degrees=True)

Rotates around the z-axis.

This is a body rotation.

param angle: The rotation angle. float Determines if angles is in degrees or not. bool A newly created Matrix44. Matrix44
scale(self, x, y=None, z=None)

Scales by the specified amount in x, y, z.

If y is None, x is assumed to be a list of 3 floats.

param x: The factor to multiply the ‘x’ vector with. Union[float, list[float]] The factor to multiply the ‘y’ vector with. float The factor to multiply the ‘z’ vector with. float A newly created Matrix44. Matrix44
setTranslation(self, x, y=None, z=None)

Sets the position as a Point.

If y is None, x is assumed to be a list of 3 floats.

param x: The vector to set the ‘x’ vector. Union[float, list[float]] The vector to set the ‘y’ vector. float The vector to set the ‘z’ vector. float A reference to the instance Matrix44 object on which it was called. Matrix44
translate(self, x=0, y=None, z=None)

Translates by the specified distance each x, y, z vector.

If y is None, x is assumed to be a list of 3 floats.

param x: The distance to translate the ‘x’ vector. Union[float, list[float]] The distance to translate the ‘y’ vector. float The distance to translate the ‘z’ vector. float A reference to the instance Matrix44 object on which it was called. Matrix44
transpose(self)

Returns the transpose.

update(self, other)

Copies the data from other to self.

param other: The Matrix44 to copy values from. Matrix44 A reference to the instance Matrix44 object on which it was called. Matrix44
vec(self, x, y=None, z=None)

Multiplies with the Vector specified with x, y, z.

The x can be a float, Vector (or list).

Vectors are represented as mathematical column vectors and have a zero in the fourth position, which does not include translation operations.

param x: An itetable of 3 or the x value of a Vector. Union[Vector, list[float], float] The y value of a Vector. float The z value of a Vector. float The result of the multiplication. Vector
zeroSmallValues(self, zero=1e-10)

Sets all components that are less than the specified value to zero.

param zero: The tolerance on what to zero. float A reference to the instance Matrix44 object on which it was called. Matrix44
zp(self, pt1, pt2=None)

Depricated