Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type P ¶
type P struct {
X, Y float64
}
P represents a point on the plane
type Polygon ¶
type Polygon struct {
Points []P // counterclockwise list of points
// contains filtered or unexported fields
}
Polygon represents a polygon on the plane
func MergeRects ¶
type Rect ¶
type Rect struct {
TL P // top-left vertex of the rectangle
BR P // bottom-right vertex of the rectangle
}
Rect represents a rectangle
type Tri ¶
Tri represents a triangle
func Triangulate ¶
Triangulate returns a list of triangles resulting from the triangulation of the polygon obtained by merging the rectangles (the rectangles aren't actually merged). Since the polygon's internal angles are all fractions of π, the triangulation is special-cased to run in O(n). Note that the polygon is y-monotone but isn't also strictly y-monotone, therefore the left and right vertex chains can't be considered sorted. For each output triangle, the segment (A,B) is a diagonal of the polygon.
func (Tri) Barycenter ¶
func (Tri) OrderedSide ¶
Click to show internal directories.
Click to hide internal directories.