Triangle with Normal VectorΒΆ

Plotting a triangle with its normal vector. The tail of the vector is set to be the triangle centroid.

plot normal


(<Figure size 640x480 with 1 Axes>, <Axes3D: >)

from skspatial.objects import Triangle
from skspatial.plotting import plot_3d

triangle = Triangle([0, 0, 1], [1, 1, 0], [0, 2, 1])

centroid = triangle.centroid()

    triangle.plotter(c='k', zorder=3),
    triangle.normal().plotter(point=centroid, scalar=0.2, c='r'),
    *[x.plotter(c='k', zorder=3) for x in triangle.multiple('line', 'abc')],

Total running time of the script: ( 0 minutes 0.180 seconds)

Gallery generated by Sphinx-Gallery