Documentation
¶
Index ¶
- type Matrix
- type PossibilititesOpts
- type Triangle
- func (t *Triangle) Area() int
- func (t *Triangle) Bounds() (res image.Rectangle)
- func (t *Triangle) Contains(x, y int) bool
- func (a Triangle) Determinant() int
- func (a Triangle) ExtractEquilateralTriangleFrom(src image.Image) image.Image
- func (a Triangle) InverseMatrix() Matrix
- func (t *Triangle) Len() int
- func (t *Triangle) Less(x, y int) bool
- func (t *Triangle) Swap(x, y int)
- type Triangles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
Matrix is a 3x3 matrix.
A triangle in the matrix form is:
| aa.x ab.x ac.x | A = | aa.y ab.y ac.y | | 1 1 1 |
To transform a triangle into another triangle wee need to find M from :
M * A = B
which simplifies to :
M = B * Inv(A)
type PossibilititesOpts ¶
type PossibilititesOpts struct {
// min distance ratio between two points
LowerThreshold, UpperThreshold int
MinArea int // in pixel
// contains filtered or unexported fields
}
PossibilititesOpts is an option for EveryTriangles func
func (*PossibilititesOpts) DistanceInvalid ¶
func (opts *PossibilititesOpts) DistanceInvalid(one, two image.Point) bool
DistanceInvalid returns true when distance is invalid ( too big or too small )
type Triangle ¶
A Triangle is made of three 2D points. A triangle is also a 3x3 matrix: | x1, x2, x3 | | y1, y2, y3 | | 1, 1, 1 |
func AllPossibilities ¶
func AllPossibilities(opts PossibilititesOpts, points geometry.Points) []Triangle
AllPossibilities returns every possible triangle from the points.
func Unique ¶
Unique sorts input and and returns it with duplicates removed. Unique expects all triangles to have points sorted out. it will sort
func (Triangle) ExtractEquilateralTriangleFrom ¶
ExtractEquilateralTriangleFrom will give you an equilateral triangle extract from src at coordinates of a.
func (Triangle) InverseMatrix ¶
InverseMatrix gives you the matrix inverse of a.