Example #1
0
    def from_angle_direction_plane(cls, angle, direction, plane):
        """
        Parameters
        ----------
        angle : :obj:`float`
            The angle in radians.
        direction : compas.geometry.Vector or :obj:`list` of :obj:`float`
            The direction vector as list of 3 numbers.
            It must be orthogonal to the normal vector (i.e. it must lie in the shear plane).
        plane : compas.geometry.Plane or (point, normal)
            The shear plane defined by a point and normal.

        Raises
        ------
        ValueError
            If the shear direction does not lie in the shear plane.

        Returns
        -------
        Shear
            The shear transformation object.

        Examples
        --------
        >>> from compas.geometry import cross_vectors
        >>> angle = 0.1
        >>> direction = [0.1, 0.2, 0.3]
        >>> point = [4, 3, 1]
        >>> normal = cross_vectors(direction, [1, 0.3, -0.1])
        >>> S = Shear.from_angle_direction_plane(angle, direction, (point, normal))
        """
        point, normal = plane
        return cls(matrix_from_shear(angle, direction, point, normal))
Example #2
0
    def __init__(self,
                 angle=0.,
                 direction=[1, 0, 0],
                 point=[1, 1, 1],
                 normal=[0, 0, 1]):

        self.matrix = matrix_from_shear(angle, direction, point, normal)
Example #3
0
    def from_angle_direction_plane(cls, angle, direction, plane):
        """Construct a shear transformation from an angle, direction and plane.

        Parameters
        ----------
        angle : float
            The angle in radians.
        direction : [float, float, float] | :class:`compas.geometry.Vector`
            The direction vector as list of 3 numbers.
            It must be orthogonal to the normal vector (i.e. it must lie in the shear plane).
        plane : [point, vector] | :class:`compas.geometry.Plane`
            The shear plane defined by a point and normal.

        Returns
        -------
        :class:`compas.geometry.Shear`
            The shear transformation object.

        Raises
        ------
        ValueError
            If the shear direction does not lie in the shear plane.

        Examples
        --------
        >>> from compas.geometry import cross_vectors
        >>> angle = 0.1
        >>> direction = [0.1, 0.2, 0.3]
        >>> point = [4, 3, 1]
        >>> normal = cross_vectors(direction, [1, 0.3, -0.1])
        >>> S = Shear.from_angle_direction_plane(angle, direction, (point, normal))

        """
        point, normal = plane
        return cls(matrix_from_shear(angle, direction, point, normal))
Example #4
0
def test_matrix_from_shear():
    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)
    s = [[0.992033620789569, 0.02245070504757821, -0.012311676961575148, -0.023174921339435575], [-0.015932758420861955, 1.0449014100951564, -0.024623353923150296, -0.04634984267887115], [-0.023899137631292932, 0.06735211514273462, 0.9630649691152746, -0.0695247640183067], [0.0, 0.0, 0.0, 1.0]]
    assert np.allclose(S, s)