Triangle¶
- class Triangle(*args, **kwargs)¶
Bases:
pybind11_object
Defines a 2D triangle.
A triangle is internally represented by three 2D points.
By default the three coordinates in the \((i,j)\) frame (see vpImagePoint class documentation for more details about the frame.) are \((0,0)\) , \((1,0)\) and \((0,1)\) .
Overloaded function.
__init__(self: visp._visp.core.Triangle) -> None
Basic constructor.
By default, the three 2D points coordinates which define the triangle are \((0,0)\) , \((1,0)\) and \((0,1)\) .
__init__(self: visp._visp.core.Triangle, tri: visp._visp.core.Triangle) -> None
Copy constructor
- Parameters:
- tri
The triangle used for the initialisation.
__init__(self: visp._visp.core.Triangle, iP1: visp._visp.core.ImagePoint, iP2: visp._visp.core.ImagePoint, iP3: visp._visp.core.ImagePoint) -> None
Constructor which initialise the triangle thanks to the three 2D points \(iP1\) , \(iP2\) and \(iP3\)
- Parameters:
- iP1
The first apex of the triangle.
- iP2
The first apex of the triangle.
- iP3
The first apex of the triangle.
Methods
Overloaded function.
Initialise the triangle thanks to the three 2D points \(iP1\) , \(iP2\) and \(iP3\)
Return the area of the triangle.
Get the apexes of the triangle.
Check if the 2D point \(iP\) is inside the triangle.
Inherited Methods
Operators
__doc__
Overloaded function.
__module__
Attributes
__annotations__
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.core.Triangle) -> None
Basic constructor.
By default, the three 2D points coordinates which define the triangle are \((0,0)\) , \((1,0)\) and \((0,1)\) .
__init__(self: visp._visp.core.Triangle, tri: visp._visp.core.Triangle) -> None
Copy constructor
- Parameters:
- tri
The triangle used for the initialisation.
__init__(self: visp._visp.core.Triangle, iP1: visp._visp.core.ImagePoint, iP2: visp._visp.core.ImagePoint, iP3: visp._visp.core.ImagePoint) -> None
Constructor which initialise the triangle thanks to the three 2D points \(iP1\) , \(iP2\) and \(iP3\)
- Parameters:
- iP1
The first apex of the triangle.
- iP2
The first apex of the triangle.
- iP3
The first apex of the triangle.
- buildFrom(self, iP1: visp._visp.core.ImagePoint, iP2: visp._visp.core.ImagePoint, iP3: visp._visp.core.ImagePoint) visp._visp.core.Triangle ¶
Initialise the triangle thanks to the three 2D points \(iP1\) , \(iP2\) and \(iP3\)
- Parameters:
- iP1: visp._visp.core.ImagePoint¶
The first apex of the triangle.
- iP2: visp._visp.core.ImagePoint¶
The first apex of the triangle.
- iP3: visp._visp.core.ImagePoint¶
The first apex of the triangle.
- getArea(self) float ¶
Return the area of the triangle. The area is computed when the triangle is built from three image points.
- Returns:
The area of the triangle.
- getTriangleApexes(self, iP1: visp._visp.core.ImagePoint, iP2: visp._visp.core.ImagePoint, iP3: visp._visp.core.ImagePoint) None ¶
Get the apexes of the triangle.
- Parameters:
- iP1: visp._visp.core.ImagePoint¶
first apex.
- iP2: visp._visp.core.ImagePoint¶
second apex.
- iP3: visp._visp.core.ImagePoint¶
third apex.
- inTriangle(self, iP: visp._visp.core.ImagePoint, threshold: float = 0.00001) bool ¶
Check if the 2D point \(iP\) is inside the triangle.
- Parameters:
- iP: visp._visp.core.ImagePoint¶
The point which coulb be inside the triangle.
- threshold: float = 0.00001¶
A threshold used to define the accuracy of the computation when the point is very near from the edges of the triangle. 0 is the smallest value.
- Returns:
Returns true if the point is inside the triangle. Returns false otherwise.