reflect_line_triangle
- compas.geometry.reflect_line_triangle(line, triangle, tol=None)[source]
Bounce a line of a reflection triangle.
- Parameters:
- line[point, point] |
compas.geometry.Line
Two points defining the line.
- triangle[point, point, point]
The triangle vertices.
- tolfloat, optional
A tolerance value for finding the intersection between the line and the triangle. Default is
TOL.absolute()
.
- line[point, point] |
- Returns:
- tuple[[float, float, float], [float, float, float]]
The reflected line defined by the intersection point of the line and triangle and the mirrored start point of the line with respect to a line perpendicular to the triangle through the intersection.
Notes
The direction of the line and triangle are important. The line is only reflected if it points towards the front of the triangle. This is true if the dot product of the direction vector of the line and the normal vector of the triangle is smaller than zero.
Examples
>>> triangle = [1.0, 0, 0], [-1.0, 0, 0], [0, 0, 1.0] >>> line = [-1, 1, 0], [-0.5, 0.5, 0] >>> reflect_line_triangle(line, triangle) ([0.0, 0.0, 0.0], [1.0, 1.0, 0.0])