diff --git a/draw2d/curve/curve_float64.go b/draw2d/curve/curve_float64.go index a8e21ea..c34c3ae 100644 --- a/draw2d/curve/curve_float64.go +++ b/draw2d/curve/curve_float64.go @@ -43,6 +43,8 @@ func (c *CubicCurveFloat64) Subdivide() (c1, c2 *CubicCurveFloat64) { return } +// subdivide the curve in straight lines using Casteljau subdivision +// and computing minimal distance tolerance func (c *CubicCurveFloat64) SegmentCasteljau() []float64{ // reinit segments c.segments = make([]float64, 0, 2) diff --git a/draw2d/curve/curve_test.go b/draw2d/curve/curve_test.go index 97b687a..787f51b 100644 --- a/draw2d/curve/curve_test.go +++ b/draw2d/curve/curve_test.go @@ -7,11 +7,10 @@ import ( var ( - - cf64Test1 = NewCubicCurveFloat64(0, 0, 20000, 0, 0, 20000, 20000, 20000) + cf64Test1 = NewCubicCurveFloat64(100, 100, 200, 100, 100, 200, 200, 200) ) -func BenchmarkCubicCurveCasteljauFloat64(b *testing.B) { +func BenchmarkCubicCurveCasteljauTest1(b *testing.B) { var s []float64 for i := 0; i < b.N; i++ { s = cf64Test1.SegmentCasteljau()