matrix_from_shear

compas.geometry.matrix_from_shear(angle, direction, point, normal)[source]

Constructs a shear matrix by an angle along the direction vector on the shear plane (defined by point and normal).

Parameters
  • angle (float) – The angle in radians.

  • direction ([float, float, float] | Vector) – The direction vector as list of 3 numbers. It must be orthogonal to the normal vector.

  • point ([float, float, float] | Point) – The point of the shear plane as list of 3 numbers.

  • normal ([float, float, float] | Vector) – The normal of the shear plane as list of 3 numbers.

Returns

list[list[float]] – A 4-by-4 transformation matrix.

Raises

ValueError – If direction and normal are not orthogonal.

Notes

A point P is transformed by the shear matrix into P” such that the vector P-P” is parallel to the direction vector and its extent is given by the angle of P-P’-P”, where P’ is the orthogonal projection of P onto the shear plane (defined by point and normal).

Examples

>>> angle = 0.1
>>> direction = [0.1, 0.2, 0.3]
>>> point = [4, 3, 1]
>>> normal = cross_vectors(direction, [1, 0.3, -0.1])
>>> S = matrix_from_shear(angle, direction, point, normal)