Muscat.LinAlg.Transform module¶
- class Transform(offset: ArrayLike | None = None, first: ArrayLike | None = None, second: ArrayLike | None = None)[source]¶
Bases:
object
- ApplyInvTransform(point: ArrayLike) np.ndarray [source]¶
we apply inverse of the transformation
#p = M^-1*point+self.offset
- Parameters:
point (ArrayLike) – List of points to apply the transformation
- Returns:
the position of the point on the new reference system
- Return type:
np.ndarray
- ApplyInvTransformDirection(point: ArrayLike) np.ndarray [source]¶
we apply inverse of the transformation (only the direction, no offset)
p = M^-1*(point)
- Parameters:
point (ArrayLike) – List of points to apply the transformation
- Returns:
the position of the point on the new reference system
- Return type:
np.ndarray
- ApplyInvTransformTensor(tensor: ArrayLike) np.ndarray [source]¶
Apply the inverse of the transformation on a tensor
- Parameters:
tensor (ArrayLike) – np array of size (3,3)
- Returns:
the tensor on the (old) base
- Return type:
np.ndarray
- ApplyTransform(point: ArrayLike) np.ndarray [source]¶
p = M*(point-self.offset)
- Parameters:
point (ArrayLike) – List of points to apply the transformation
- Returns:
the position of the point on the new reference system
- Return type:
np.ndarray
- ApplyTransformDirection(point: ArrayLike) np.ndarray [source]¶
Apply only the direction transformation (not the offset)
p = M*(point)
- Parameters:
point (ArrayLike) – List of points to apply the transformation
- Returns:
the position of the point on the new reference system
- Return type:
np.ndarray
- ApplyTransformTensor(tensor: ArrayLike) np.ndarray [source]¶
Apply rotation on a tensor
- Parameters:
tensor (ArrayLike) – np array of size (3,3)
- Returns:
the tensor on the new base
- Return type:
np.ndarray
- GetDirection(i: MuscatIndex, pos: ArrayLike | None = None, direction: ArrayLike | None = None) np.ndarray [source]¶
Return the direction of the i component of the coordinate system. for linear transformation pos is not used
- Parameters:
i (MuscatIndex) – must be in [0,2]
pos (Optional[ArrayLike], optional) – _description_, by default None
direction (Optional[ArrayLike], optional) – _description_, by default None
- Returns:
the i vector of the base
- Return type:
np.ndarray
- GetOrthoNormalBase() Transform [source]¶
Return a new transform but with orthogonal base
- Returns:
_description_
- Return type:
- SetAsRotationAroundAxis(vector: ArrayLike, angle: float64, center: ArrayLike | None = None) None [source]¶
Setter method for setting the transform as a rotation around a vector with a given angle the transformation matrix and offset are computed from the center and the angle :param vector: must be 1D of size 3, vector around which the rotation is performed :type vector: ArrayLike :param angle: angle (in rad) for the rotation :type angle: MuscatFloat :param center: center point for the rotation of size 3, by default None :type center: Optional[ArrayLike], optional
- SetFirst(data: ArrayLike) None [source]¶
define the x coordinate (direction) with respect to the new origin
- Parameters:
data (ArrayLike) – the first direction of the coordinate system
- SetOffset(data: ArrayLike) None [source]¶
Set the origin of the new coordinate system
- Parameters:
data (ArrayLike) – offset
- SetOperator(first: ArrayLike | None = None, second: ArrayLike | None = None, third: ArrayLike | None = None, op=None) None [source]¶
- SetSecond(data: ArrayLike | None = None) None [source]¶
Define the y coordinate (direction) with respect to the new origin # the z direction is calculated with a cross product
- Parameters:
data (ArrayLike, optional) – if non the second vector of the internal rotation matrix is used , by default None
- Raises:
ValueError – RuntimeError if the incoming vector is colinear to the first vector
- SetThird(data: ArrayLike | None = None) None [source]¶
Define the z coordinate (direction) with respect to the new origin # the z direction is calculated with a cross product of x, y
- Parameters:
data (ArrayLike, optional) – _description_, by default None
- Raises:
ValueError – if the incoming vector is colinear to x, y
- class Transform2D(offset: ArrayLike | None = None, first: ArrayLike | None = None, second: ArrayLike | None = None)[source]¶
Bases:
object
This class is a wrapper around the Transform class to work on points in 2D. Please refer to the documentation of Transform for all the functions
- GetDirection(i: MuscatIndex, pos: np.ndarray | None = None, direction: np.ndarray | None = None)[source]¶
- property keepNormalized¶
- property keepOrthogonal¶