wrap.PointOnTriangle

class wrap.PointOnTriangle(triangleInd, u, v)

Point on triangle class

Position of the point on triangle can be described using 3 values u,v,w in barycentric coordinates system. http://en.wikipedia.org/wiki/Barycentric_coordinate_system If the point is on triangle u >= 0, v >= 0, w >= 0, u <= 1, v <= 1, w <= 1 and u + v + w = 1. From w = 1 - u - v we only need to store only 2 values u and v. The class also holds the index of triangle triangleInd. If geometry contains polygons with arbitrary number of vertices triangleInd is the index of triangle on triangulated geometry. Triangulation is performed by basic triangle fan with the origin placed in first polygon’s vertex.

Examples

Initialization by 3 items:

triangleInd = 5
u = 0.5
v = 0.1
wrap.PointOnTriangle(triangleInd, u, v)

PointOnTriangle can be also initialized by a sequence of 3 items:

items = (trianleInd,u,v)
wrap.PointOnTriangle(items)

Attributes

triangleInd (int) The index of triangle to which the point belongs.
u (float) The first barycentric coordinate of the point inside triangle
v (float) The second barycentric coordinate of the point inside triangle

Methods

asTuple() Convert to tuple (triangleInd,`u`,`v`)