Documentation ¶
Overview ¶
Package winding provides primitives for determining the winding order of a set of points
Index ¶
- func Orient(pts ...[2]float64) int8
- type Order
- func (Order) Clockwise() Winding
- func (Order) Colinear() Winding
- func (Order) Collinear() Winding
- func (Order) CounterClockwise() Winding
- func (order Order) OfGeomPoints(points ...geom.Point) Winding
- func (order Order) OfInt64Points(ipts ...[2]int64) Winding
- func (order Order) OfPoints(pts ...[2]float64) Winding
- func (order Order) RectifyPolygon(plyg2r [][][2]float64) [][][2]float64
- func (order Order) ThreePointsAreColinear(pt1, pt2, pt3 geom.Point) bool
- type Winding
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Orient ¶
Orient will take the points and calculate the Orientation of the points. by summing the normal vectors. It will return 0 of the given points are colinear or 1, or -1 for clockwise and counter clockwise depending on the direction of the y axis. If the y axis increase as you go up on the graph then clockwise will be -1, otherwise it will be 1; vice versa for counter-clockwise.
Types ¶
type Order ¶
type Order struct {
YPositiveDown bool
}
Order configures how the orientation of a set of points is determined
func (Order) CounterClockwise ¶
CounterClockwise returns a counter clockwise winding
func (Order) OfGeomPoints ¶
OfGeomPoints returns the winding of the given geom points
func (Order) OfInt64Points ¶
OfInt64Points returns the winding of the given int64 points
func (Order) RectifyPolygon ¶
RectifyPolygon will make sure that the rings are of the correct orientation, if not it will reverse them Colinear rings are dropped
type Winding ¶
type Winding int8
Winding is the clockwise direction of a set of points.
const ( // Clockwise indicates that the winding order is in the clockwise direction Clockwise Winding = -1 // Colinear indicates that the points are colinear to each other Colinear Winding = 0 // CounterClockwise indicates that the winding order is in the counter clockwise direction CounterClockwise Winding = 1 // Collinear alternative spelling of Colinear Collinear = Colinear )
func OfGeomPoints ¶
OfGeomPoints is the same as OfPoints, just a convenience to unwrap geom.Point
func Orientation ¶
Orientation returns the orientation of the set of the points given the direction of the positive values of the y axis
func (Winding) IsClockwise ¶
IsClockwise checks if winding is clockwise
func (Winding) IsColinear ¶
IsColinear check if the points are colinear
func (Winding) IsCounterClockwise ¶
IsCounterClockwise checks if winding is counter clockwise
func (Winding) Not ¶
Not returns the inverse of the winding, clockwise <-> counter-clockwise, colinear is it's own inverse