skspatial.objects.Triangle.normal¶
- Triangle.normal() Vector [source]¶
Return a vector normal to the triangle.
The normal vector is calculated as
\[v_{AB} \times v_{AC}\]where \(v_{AB}\) is the vector from vertex A to vertex B.
- Returns:
- Vector
Normal vector.
Examples
>>> from skspatial.objects import Triangle
>>> Triangle([0, 0], [1, 0], [0, 1]).normal() Vector([0, 0, 1])
The normal vector is not necessarily a unit vector.
>>> Triangle([0, 0], [2, 0], [0, 2]).normal() Vector([0, 0, 4])
The direction of the normal vector is dependent on the order of the vertices.
>>> Triangle([0, 0], [0, 1], [1, 0]).normal() Vector([ 0, 0, -1])