Documentation ¶
Index ¶
- Variables
- type Circle
- type Ellipse
- func (e Ellipse) Arc() *ellipsearc.EllipseArc
- func (e Ellipse) Area() float64
- func (e Ellipse) BoundingBox() (min d2.Pt, max d2.Pt)
- func (e Ellipse) Centroid() d2.Pt
- func (e Ellipse) Contains(pt d2.Pt) bool
- func (e Ellipse) ConvexHull() []d2.Pt
- func (e Ellipse) LineIntersections(l line.Line, buf []float64) []float64
- func (e Ellipse) Perimeter() float64
- func (e Ellipse) PerimeterSeries(terms int) float64
- func (e Ellipse) Pt1(t0 float64) d2.Pt
- func (e Ellipse) Pt2(t0, t1 float64) d2.Pt
- func (e Ellipse) Pt2c1(t0 float64) d2.Pt1
- func (e Ellipse) PtApprox(n int) []d2.Pt
- func (e Ellipse) SignedArea() float64
- type FillCurve
Constants ¶
This section is empty.
Variables ¶
var ConvexHullPoints = 12
ConvexHullPoints sets the number of points Ellipse.ConvexHull returns.
Functions ¶
This section is empty.
Types ¶
type Circle ¶
type Circle struct {
Ellipse
}
Circle fulfills Shape.
func CircumscribeCircle ¶
CircumscribeCircle creates a circle where all three verticies lie on the perimeter.
type Ellipse ¶
type Ellipse struct {
// contains filtered or unexported fields
}
Ellipse fulfills Shape
func New ¶
New returns an Ellipse with foci f1 and f2 and a minor radius of r. The perimeter point that corresponds to an angle of 0 will be 1/4 rotation going from f1 to f2, which will lie along the minor axis. So an ellipse with foci (0,0) and (0,2) with a minor radius of 1 will have angle 0 at point (1,1).
func (Ellipse) Arc ¶
func (e Ellipse) Arc() *ellipsearc.EllipseArc
Arc returns the EllipseArc defined by the perimeter
func (Ellipse) BoundingBox ¶
BoundingBox fulfills shape.BoundingBoxer. It returns the corners of a Box that will exactly contain the Ellipse. It is a wrapper around EllipseArc.BoundingBox.
func (Ellipse) ConvexHull ¶
ConvexHull fulfills shape.ConvexHuller. It returns a polygon with the number of points set by ConvexHullPoints. The sides of the polygon will intersect the ellipse at a single tangent point.
func (Ellipse) LineIntersections ¶
LineIntersections fulfills line.LineIntersector.
func (Ellipse) Perimeter ¶
Perimeter returns the length of the perimeter of the ellipse. This value may have a slight error that will grow as the ellipse is elongated.
func (Ellipse) PerimeterSeries ¶
PerimeterSeries approximates the perimeter using a series
func (Ellipse) Pt1 ¶
Pt1 fulfils d2.Pt1 taking one parametric point and returning a point on the perimeter.
func (Ellipse) Pt2 ¶
Pt2 fulfils d2.Pt2 taking two parametric points and returning a point in the ellipse. It does so by mapping the ellipse onto a unit square with points on the perimeter every 1/4 rotation corresponding to a corner of the square.
func (Ellipse) Pt2c1 ¶
Pt2c1 returns a curve that lies inside of the ellipse. All curves in the range 0.0 to 1.0 will fill the entire ellipse.
func (Ellipse) PtApprox ¶
PtApprox returns a polygon approximation of the ellipse. All points are outside the polygon and the lines between them intersect the ellipse at a single tangent point.
func (Ellipse) SignedArea ¶
SignedArea returns the area of the ellipse, though the value may be negative depending on polarity.