========================== 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: .. method:: angles The Euler angles (Body313) in radians. .. _location: .. method:: location Returns or sets the location/origin value. .. _origin: .. method:: origin Returns or sets the location/origin value. .. _x: .. method:: x The vector along the x-axis. .. _y: .. method:: y The vector along the y-axis. .. _z: .. method:: z The vector along the z-axis. -------------- Method Details -------------- .. _copy: .. method:: copy(self) Creates a copy of self. :returns: The newly created Matrix44. :rtype: Matrix44 .. _divide: .. method:: divide(self, other) Returns the result of the multiplication with the inverse of other. :param other: The Matrix44 to inverse and multiply with. :type other: Matrix44 :returns: The result of the multiplication with the inverse. :rtype: Matrix44 .. _format: .. method:: format(self, format='%s') Formats as a string. :param format: The format style to use. :type format: str :returns: A string represantation of the instance Matrix44 object on which it was called. :rtype: str .. _getDeterminant: .. method:: getDeterminant(self) Returns the matrix determinant. .. _getEulerAngles: .. method:: getEulerAngles(self, degrees=False) Returns the Euler angles. :param degrees: Determines if the angle values are in degrees or not. :type degrees: bool :returns: The Euler angles. :rtype: list .. _getTranslation: .. method:: getTranslation(self) Returns the position as a Point. .. _invert: .. method:: invert(self) Computes the inverse. :returns: The inverse of the instance Matrix44 object on which it was called. :rtype: Matrix44 .. _isIdentity: .. method:: isIdentity(self) Returns True if self is the identity matrix, False otherwise. .. _multiply: .. method:: multiply(self, other) Multiplies with other. :param other: The other to multiply with. :type other: Union[int, float, Point, Vector, Matrix44] :returns: The result of the multiplication. :rtype: Union[Matrix44, Vector, Point] .. _multiplyPoint: .. method:: 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. :type x: Union[Point, list[float], float] :param y: The y value of a Point. :type y: float :param z: The z value of a Point. :type z: float :returns: The result of the multiplication. :rtype: Point .. _multiplyVector: .. method:: 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. :type x: Union[Vector, list[float], float] :param y: The y value of a Vector. :type y: float :param z: The z value of a Vector. :type z: float :returns: The result of the multiplication. :rtype: Vector .. _orientFromAxes: .. method:: 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'. :type axes: str :param dir1: The vector for the first axis. :type dir1: Union[Vector, list[float]] :param dir2: The vector for the second axis. :type dir2: Union[Vector, list[float]] :raises: :exc:`RuntimeError` -- In case of unsupported axes specification :returns: A reference to the instance Matrix44 object on which it was called. :rtype: Matrix44 .. _orientFromEulerAngles: .. method:: orientFromEulerAngles(self, e1, e2=None, e3=None, degrees=False) Orients with the specified Euler angles. :param e1: Rotation around x-axis. :type e1: float :param e2: Rotation around y-axis. :type e2: float :param e3: Rotation around z-axis. :type e3: float :param degrees: Determines if the angle values are in degrees or not. :type degrees: bool :returns: A reference to the instance Matrix44 object on which it was called. :rtype: Matrix44 .. _orientFromEulerParameters: .. method:: orientFromEulerParameters(self, e0, e1=None, e2=None, e3=None) Orients with the specified Euler parameters. :param e0: Euler parameter. :type e0: float :param e1: Euler parameter. :type e1: float :param e2: Euler parameter. :type e2: float :param e3: Euler parameter. :type e3: float :returns: A reference to the instance Matrix44 object on which it was called. :rtype: Matrix44 .. _orthogonalize: .. method:: orthogonalize(self) Orthogonalizes the axes (x, y, z). :raises: :exc:`RuntimeError` -- If Matrix44 can not be orthogonalized. :returns: A Matrix44 with x, y, z being orthogonal. :rtype: Matrix44 .. _pt: .. method:: 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. :type x: Union[Point, list[float], float] :param y: The y value of a Point. :type y: float :param z: The z value of a Point. :type z: float :returns: The result of the multiplication. :rtype: Point .. _pts: .. method:: pts(self, pts) Returns the result of multiplying each Point in the specified list of Points with self. :param pts: A Point (or list). :type pts: list[Union[Point, list[float]]] :returns: The result of the pieswise multiplication. :rtype: list[Point] .. _rotate: .. method:: 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. :type axis: Union[Vector, str] :param angle: The rotation angle. :type angle: float :param degrees: Determines if angles is in degrees or not. :type degrees: bool :returns: A newly created Matrix44. :rtype: Matrix44 .. _rotateAroundAxis: .. method:: rotateAroundAxis(self, axis, angle, degrees=True) Rotates around the axis. This is a body rotation. :param axis: The rotation axis. :type axis: Vector :param angle: The rotation angle. :type angle: float :param degrees: Determines if angles is in degrees or not. :type degrees: bool :returns: A newly created Matrix44. :rtype: Matrix44 .. _rotx: .. method:: rotx(self, angle, degrees=True) Rotates around the x-axis. This is a body rotation. :param angle: The rotation angle. :type angle: float :param degrees: Determines if angles is in degrees or not. :type degrees: bool :returns: A newly created Matrix44. :rtype: Matrix44 .. _roty: .. method:: roty(self, angle, degrees=True) Rotates around the y-axis. This is a body rotation. :param angle: The rotation angle. :type angle: float :param degrees: Determines if angles is in degrees or not. :type degrees: bool :returns: A newly created Matrix44. :rtype: Matrix44 .. _rotz: .. method:: rotz(self, angle, degrees=True) Rotates around the z-axis. This is a body rotation. :param angle: The rotation angle. :type angle: float :param degrees: Determines if angles is in degrees or not. :type degrees: bool :returns: A newly created Matrix44. :rtype: Matrix44 .. _scale: .. method:: 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. :type x: Union[float, list[float]] :param y: The factor to multiply the 'y' vector with. :type y: float :param z: The factor to multiply the 'z' vector with. :type z: float :returns: A newly created Matrix44. :rtype: Matrix44 .. _setTranslation: .. method:: 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. :type x: Union[float, list[float]] :param y: The vector to set the 'y' vector. :type y: float :param z: The vector to set the 'z' vector. :type z: float :returns: A reference to the instance Matrix44 object on which it was called. :rtype: Matrix44 .. _translate: .. method:: 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. :type x: Union[float, list[float]] :param y: The distance to translate the 'y' vector. :type y: float :param z: The distance to translate the 'z' vector. :type z: float :returns: A reference to the instance Matrix44 object on which it was called. :rtype: Matrix44 .. _transpose: .. method:: transpose(self) Returns the transpose. .. _update: .. method:: update(self, other) Copies the data from other to self. :param other: The Matrix44 to copy values from. :type other: Matrix44 :returns: A reference to the instance Matrix44 object on which it was called. :rtype: Matrix44 .. _vec: .. method:: 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. :type x: Union[Vector, list[float], float] :param y: The y value of a Vector. :type y: float :param z: The z value of a Vector. :type z: float :returns: The result of the multiplication. :rtype: Vector .. _zeroSmallValues: .. method:: 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. :type zero: float :returns: A reference to the instance Matrix44 object on which it was called. :rtype: Matrix44 .. _zp: .. method:: zp(self, pt1, pt2=None) Depricated