geom

package
v0.0.0-...-e7bc4dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreVerticesClockwise

func AreVerticesClockwise(polygon []float32, offset, count int) bool

func BarycoordInsideTriangle

func BarycoordInsideTriangle(barycentric *Vector2) bool

Returns true if the barycentric coordinates are inside the triangle.

func Colinear

func Colinear(x1, y1, x2, y2, x3, y3 float32) bool

func EnsureCCW

func EnsureCCW(polygon []float32)

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

func FromBarycoordF(barycentric *Vector2, a, b, c float32) float32

Returns an interpolated value given the barycentric coordinates of a point in a triangle and the values at each vertex. @return interpolatedOut

func LowestPositiveRoot

func LowestPositiveRoot(a, b, c float32) float32

* 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

func PolygonArea(polygon []float32, offset, count int) float32

Computes the area for a convex polygon.

func PolygonCentroid

func PolygonCentroid(polygon []float32, offset, count int, centroid *Vector2) *Vector2

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 TriangleArea(x1, y1, x2, y2, x3, y3 float32) float32

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL