Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Area ¶
Area of a shape, signed area may take procession into account. For instance, a triangle with points defined proceeding counter-clockwise wil have a positive area and proceeding clockwise will have a negative area.
type BoundingBoxer ¶
BoundingBoxer returns the corners of a bounding box.
type ConvexHuller ¶
ConvexHuller returns a slice of points that form a convex hull that contains the underlying geometric object.
type Intersection ¶
type Intersection [2]Shape
Intersection takes two Shapes and creates a new Shape that is their intersection.
func (Intersection) Contains ¶
func (a Intersection) Contains(pt d2.Pt) bool
Contains returns true if the point is inside both shapes.
func (Intersection) ConvexHull ¶
func (a Intersection) ConvexHull() []d2.Pt
ConvexHull fulfills shape.ConvexHuller. It returns the convex hull of the Intersection. If the underlying Convex hulls are tight, the result will also be tight.
func (Intersection) LineIntersections ¶
func (a Intersection) LineIntersections(l line.Line, buf []float64) []float64
LineIntersections fulfills line.Intersector returning the intesection points on the perimeter of the Intersection of the shapes.
type Shape ¶
type Shape interface { Container line.Intersector ConvexHuller }
Shape is an interface that is easy to implement for most primitives but allows for complex generic shape functions.
type Subtract ¶
type Subtract [2]Shape
Subtract defines a shape by subtracting the second shape from the first.
func (Subtract) Contains ¶
Contains returns true if the point is inside the first shape but not the second.
func (Subtract) ConvexHull ¶
ConvexHull fulfills shape.ConvexHuller. It returns the convex hull of the Intersection. It just returns the convex hull of the shape being subtracted from, so the result may not be tight.
type Union ¶
type Union [2]Shape
func (Union) ConvexHull ¶
ConvexHull fulfills shape.ConvexHuller. It returns the convex hull of the Intersection. If the underlying Convex hulls are tight, the result will also be tight.