Documentation ¶
Index ¶
- func AreVerticesClockwise(polygon []float32, offset, count int) bool
- func BarycoordInsideTriangle(barycentric *Vector2) bool
- func Colinear(x1, y1, x2, y2, x3, y3 float32) bool
- func EnsureCCW(polygon []float32)
- func FromBarycoord(barycentric, a, b, c, interpolatedOut *Vector2) *Vector2
- func FromBarycoordF(barycentric *Vector2, a, b, c float32) float32
- func LowestPositiveRoot(a, b, c float32) float32
- func PolygonArea(polygon []float32, offset, count int) float32
- func PolygonCentroid(polygon []float32, offset, count int, centroid *Vector2) *Vector2
- func QuadrilateralCentroid(x1, y1, x2, y2, x3, y3, x4, y4 float32, centroid *Vector2) *Vector2
- func ToBarycoord(p, a, b, c, barycentricOut *Vector2) *Vector2
- func TriangleArea(x1, y1, x2, y2, x3, y3 float32) float32
- func TriangleCentroid(x1, y1, x2, y2, x3, y3 float32, centroid *Vector2) *Vector2
- func TriangleCircumcenter(x1, y1, x2, y2, x3, y3 float32, circumcenter *Vector2) *Vector2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreVerticesClockwise ¶
func BarycoordInsideTriangle ¶
func BarycoordInsideTriangle(barycentric *Vector2) bool
Returns true if the barycentric coordinates are inside the triangle.
func FromBarycoord ¶
func FromBarycoord(barycentric, a, b, c, interpolatedOut *Vector2) *Vector2
Returns interpolated values given the barycentric coordinates of a point in a triangle and the values at each vertex. @return interpolatedOut
func FromBarycoordF ¶
Returns an interpolated value given the barycentric coordinates of a point in a triangle and the values at each vertex. @return interpolatedOut
func LowestPositiveRoot ¶
* Returns the lowest positive root of the quadric equation given by a* x * x + b * x + c = 0. If no solution is given
- Float.Nan is returned.
- @param a the first coefficient of the quadric equation
- @param b the second coefficient of the quadric equation
- @param c the third coefficient of the quadric equation
- @return the lowest positive root or Float.Nan
func PolygonArea ¶
Computes the area for a convex polygon.
func PolygonCentroid ¶
Returns the centroid for the specified non-self-intersecting polygon.
func QuadrilateralCentroid ¶
func QuadrilateralCentroid(x1, y1, x2, y2, x3, y3, x4, y4 float32, centroid *Vector2) *Vector2
func ToBarycoord ¶
func ToBarycoord(p, a, b, c, barycentricOut *Vector2) *Vector2
Computes the barycentric coordinates v,w for the specified point in the triangle. If barycentric.X >= 0 && barycentric.Y >= 0 && barycentric.X + barycentric.Y <= 1 then the point is inside the triangle. If vertices a,b,c have values aa,bb,cc then to get an interpolated value at point p:
Barycentric(p, a, b, c, barycentric) u := 1 - barycentric.X - barycentric.Y x := u * aa.x + barycentric.X * bb.x + barycentric.Y * cc.x y := u * aa.y + barycentric.X * bb.y + barycentric.Y * cc.y
func TriangleArea ¶
func TriangleCentroid ¶
func TriangleCentroid(x1, y1, x2, y2, x3, y3 float32, centroid *Vector2) *Vector2
func TriangleCircumcenter ¶
func TriangleCircumcenter(x1, y1, x2, y2, x3, y3 float32, circumcenter *Vector2) *Vector2
Returns the circumcenter of the triangle. The input points must not be colinear
Types ¶
This section is empty.