Documentation ¶
Overview ¶
Copyright 2010 The draw2d Authors. All rights reserved. created: 21/11/2010 by Laurent Le Goff
Copyright 2010 The draw2d Authors. All rights reserved. created: 17/05/2011 by Laurent Le Goff
Copyright 2010 The draw2d Authors. All rights reserved. created: 17/05/2011 by Laurent Le Goff
Copyright 2010 The draw2d Authors. All rights reserved. created: 17/05/2011 by Laurent Le Goff
Index ¶
- Constants
- func SegmentArc(t LineTracer, x, y, rx, ry, start, angle, scale float64)
- type CubicCurveFloat64
- func (curve *CubicCurveFloat64) AdaptiveSegment(t LineTracer, approximationScale, angleTolerance, cuspLimit float64)
- func (c *CubicCurveFloat64) AdaptiveSegmentRec(t LineTracer, approximationScale, angleTolerance, cuspLimit float64)
- func (c *CubicCurveFloat64) ArbitraryPoint(mu float64) (x, y float64)
- func (c *CubicCurveFloat64) EstimateDistance() float64
- func (c *CubicCurveFloat64) ParabolicSegment(t LineTracer, flattening_threshold float64)
- func (curve *CubicCurveFloat64) Segment(t LineTracer, flattening_threshold float64)
- func (c *CubicCurveFloat64) SegmentRec(t LineTracer, flattening_threshold float64)
- func (c *CubicCurveFloat64) Subdivide(c1, c2 *CubicCurveFloat64) (x23, y23 float64)
- func (c *CubicCurveFloat64) SubdivideAt(c1, c2 *CubicCurveFloat64, t float64) (x23, y23 float64)
- type LineTracer
- type QuadCurveFloat64
Constants ¶
View Source
const ( CurveCollinearityEpsilon = 1e-30 CurveAngleToleranceEpsilon = 0.01 )
View Source
const (
CurveRecursionLimit = 32
)
Variables ¶
This section is empty.
Functions ¶
func SegmentArc ¶
func SegmentArc(t LineTracer, x, y, rx, ry, start, angle, scale float64)
Types ¶
type CubicCurveFloat64 ¶
type CubicCurveFloat64 [8]float64
X1, Y1, X2, Y2, X3, Y3, X4, Y4 float64
func (*CubicCurveFloat64) AdaptiveSegment ¶
func (curve *CubicCurveFloat64) AdaptiveSegment(t LineTracer, approximationScale, angleTolerance, cuspLimit float64)
func (*CubicCurveFloat64) AdaptiveSegmentRec ¶
func (c *CubicCurveFloat64) AdaptiveSegmentRec(t LineTracer, approximationScale, angleTolerance, cuspLimit float64)
The function has the following parameters:
approximationScale : Eventually determines the approximation accuracy. In practice we need to transform points from the World coordinate system to the Screen one. It always has some scaling coefficient. The curves are usually processed in the World coordinates, while the approximation accuracy should be eventually in pixels. Usually it looks as follows: curved.approximationScale(transform.scale()); where transform is the affine matrix that includes all the transformations, including viewport and zoom. angleTolerance : You set it in radians. The less this value is the more accurate will be the approximation at sharp turns. But 0 means that we don't consider angle conditions at all. cuspLimit : An angle in radians. If 0, only the real cusps will have bevel cuts. If more than 0, it will restrict the sharpness. The more this value is the less sharp turns will be cut. Typically it should not exceed 10-15 degrees.
func (*CubicCurveFloat64) ArbitraryPoint ¶
func (c *CubicCurveFloat64) ArbitraryPoint(mu float64) (x, y float64)
mu ranges from 0 to 1, start to end of curve
func (*CubicCurveFloat64) EstimateDistance ¶
func (c *CubicCurveFloat64) EstimateDistance() float64
func (*CubicCurveFloat64) ParabolicSegment ¶
func (c *CubicCurveFloat64) ParabolicSegment(t LineTracer, flattening_threshold float64)
func (*CubicCurveFloat64) Segment ¶
func (curve *CubicCurveFloat64) Segment(t LineTracer, flattening_threshold float64)
func (*CubicCurveFloat64) SegmentRec ¶
func (c *CubicCurveFloat64) SegmentRec(t LineTracer, flattening_threshold float64)
subdivide the curve in straight lines using line approximation and Casteljau recursive subdivision
func (*CubicCurveFloat64) Subdivide ¶
func (c *CubicCurveFloat64) Subdivide(c1, c2 *CubicCurveFloat64) (x23, y23 float64)
func (*CubicCurveFloat64) SubdivideAt ¶
func (c *CubicCurveFloat64) SubdivideAt(c1, c2 *CubicCurveFloat64, t float64) (x23, y23 float64)
type LineTracer ¶
type LineTracer interface {
LineTo(x, y float64)
}
type QuadCurveFloat64 ¶
type QuadCurveFloat64 [6]float64
X1, Y1, X2, Y2, X3, Y3 float64
func (*QuadCurveFloat64) Segment ¶
func (curve *QuadCurveFloat64) Segment(t LineTracer, flattening_threshold float64)
func (*QuadCurveFloat64) Subdivide ¶
func (c *QuadCurveFloat64) Subdivide(c1, c2 *QuadCurveFloat64)
Click to show internal directories.
Click to hide internal directories.