#### Previous topic

sknano.core.geometric_regions.Circle.translate

#### Next topic

sknano.core.geometric_regions.Triangle.area

# sknano.core.geometric_regions.Triangle¶

class sknano.core.geometric_regions.Triangle(p1=None, p2=None, p3=None)[source][source]

Geometric2DRegion for a triangle.

New in version 0.3.10.

Represents the bounded region with corner points $$p_1=(x_1,y_1)$$, $$p_2=(x_2,y_2)$$, and $$p_3=(x_3,y_3)$$.

Parameters: p1, p2, p3 : array_like, optional 2-tuples or Point class instances specifying the Triangle corner points $$p_1=(x_1,y_1)$$, $$p_2=(x_2,y_2)$$, and $$p_3=(x_3, y_3)$$.

Notes

Triangle represents a 2D geometric region consisting of all combinations of corner points $$p_i$$, $$\left\{\lambda_1 p_1+\lambda_2 p_2 + \lambda_3 p_3| \lambda_i\ge0\land\lambda_1+\lambda_2+\lambda_3=1\right\}$$.

Calling Triangle with no parameters is equivalent to Triangle(p1=[0, 0], p2=[0, 1], p3=[1, 0]).

Attributes

 area Triangle area. center Alias for centroid. centroid Triangle centroid, $$(c_x, c_y)$$. fmtstr Format string. measure Alias for area, which is the measure of a 2D geometric region. p1 Corner point $$p_1=(x_1, y_1)$$. p2 Corner point $$p_2=(x_2, y_2)$$. p3 Corner point $$p_3=(x_3, y_3)$$.

Methods

 center_centroid() Center centroid on origin. contains(point) Test region membership of point in Triangle. rotate([angle, axis, anchor_point, ...]) Rotate GeometricRegion points and vectors. todict() Returns a dict of the Triangle constructor parameters. translate(t[, fix_anchor_points]) Translate GeometricRegion points and vectors by Vector t.