Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitObject ¶
func InitObject(object *Object2D)
Types ¶
type Bezier3 ¶
type Bezier3 struct { Object2D // contains filtered or unexported fields }
Bezier3 implements a quadratic Bezier curve
func NewBezier3 ¶
NewBezier3 returns a Bezier3 path defined by the given Point2Ds
type Bezier4 ¶
type Bezier4 struct { Object2D // contains filtered or unexported fields }
Bezier4 implements a cubic Bezier curve
func NewBezier4 ¶
NewBezier4 returns a Bezier4 path defined by the given Point2Ds
type Circle ¶
type Circle struct { Object2D // contains filtered or unexported fields }
Circle encapsulates a simple circle shape defined by a center and a radius
func (*Circle) Definition ¶
func (shape *Circle) Definition() []interface{}
type ComposedPath ¶
type ComposedPath struct {
// contains filtered or unexported fields
}
ComposedPath encapsulates a path composed of multiple independent ones
func NewComposedPath ¶
func NewComposedPath(subpaths []Path) *ComposedPath
NewComposedPath returns a ComposedPath path composed of the given Paths
func (*ComposedPath) GetPoint ¶
func (path *ComposedPath) GetPoint(t float64) Point2D
GetPoint returns the point on the path for the given factor
func (*ComposedPath) Rotate ¶
func (path *ComposedPath) Rotate(a float64)
Rotate applies the given rotation to each composing subpath
func (*ComposedPath) Scale ¶
func (path *ComposedPath) Scale(x, y float64)
Scale applies the given scaling to each composing subpath
func (*ComposedPath) Translate ¶
func (path *ComposedPath) Translate(x, y float64)
Translate applies the given translation to each composing subpath
type Hermite ¶
type Hermite struct { Object2D // contains filtered or unexported fields }
Hermite implements a cubic Hermite curve
func NewHermite ¶
NewHermite returns a Hermite path defined by the given Point2Ds
type ModelMatrix2D ¶
type ModelMatrix2D [3][3]float64
func Eye2D ¶
func Eye2D() ModelMatrix2D
func MM2D ¶
func MM2D(p Point2D) ModelMatrix2D
func RotateMatrix ¶
func RotateMatrix(a float64) *ModelMatrix2D
func ScaleMatrix ¶
func ScaleMatrix(sx, sy float64) *ModelMatrix2D
func TranslateMatrix ¶
func TranslateMatrix(tx, ty float64) *ModelMatrix2D
func (*ModelMatrix2D) Apply ¶
func (model *ModelMatrix2D) Apply(p Point2D) Point2D
func (*ModelMatrix2D) Multiply ¶
func (model *ModelMatrix2D) Multiply(other *ModelMatrix2D) ModelMatrix2D
func (*ModelMatrix2D) Rotate ¶
func (model *ModelMatrix2D) Rotate(a float64)
func (*ModelMatrix2D) Scale ¶
func (model *ModelMatrix2D) Scale(x, y float64)
func (*ModelMatrix2D) Translate ¶
func (model *ModelMatrix2D) Translate(x, y float64)
type Object2D ¶
type Object2D struct {
// contains filtered or unexported fields
}
func (*Object2D) Inverse ¶
func (object *Object2D) Inverse() *ModelMatrix2D
func (*Object2D) Model ¶
func (object *Object2D) Model() *ModelMatrix2D
type Path ¶
type Path interface { IObject2D // GetPoint returns the point found at the given ratio // between the two ends of the path GetPoint(float64) Point2D }
Path is an interface that encapsulates any kind of path
type Point2D ¶
type Point2D struct {
X, Y float64
}
Point2D encapsulates the coordinates for a point in 2D space
func (Point2D) Dist ¶
Dist returns the euclidean distance between the current Point2D and the given Point2D
func (Point2D) DistSq ¶
DistSq returns the euclidean distance squared between the current Point2D and the given Point2D
type Polygon ¶
type Polygon struct { Object2D // contains filtered or unexported fields }
Polygon encapsulates a polygon defined by a list of points, where the last is implicitly bound to the first
func NewPolygon ¶
func (*Polygon) Definition ¶
func (shape *Polygon) Definition() []interface{}
type Segment ¶
type Segment struct { Object2D // contains filtered or unexported fields }
Segment encapsulates a simple straight path defined between 2 points
func NewSegment ¶
NewSegment returns a Segment path defined by the given Point2Ds
type Shape ¶
type Shape interface { IObject2D // Definition returns the data needed to define the shape Definition() []interface{} // MBR = Minimum Bounding Rectangle returns the smallest rectangle // that contains the entire shape; should be used to minimize the // Inside method calls MBR() image.Rectangle }
Shape is an interface that encapsulates any kind of 2D shape