modify tests

This commit is contained in:
Laurent Le Goff 2011-05-18 23:34:41 +02:00
parent d98f67d85d
commit e6327f74e8
2 changed files with 7 additions and 7 deletions

View File

@ -82,8 +82,7 @@ func (c *CubicCurveFloat64) EstimateDistance() float64 {
return math.Sqrt(dx1*dx1+dy1*dy1) + math.Sqrt(dx2*dx2+dy2*dy2) + math.Sqrt(dx3*dx3+dy3*dy3)
}
// subdivide the curve in straight lines using straight line approximation and Casteljau recursive subdivision
// and computing minimal distance tolerance
// subdivide the curve in straight lines using line approximation and Casteljau recursive subdivision
func (c *CubicCurveFloat64) SegmentRec(segments []float64) []float64 {
// reinit segments
segments = segments[0 : len(segments)+2]

View File

@ -15,7 +15,8 @@ import (
var (
testsFloat64 = []CubicCurveFloat64{
CubicCurveFloat64{100, 100, 200, 100, 100, 200, 200, 200},
CubicCurveFloat64{100, 100, 300, 200, 200, 200, 200, 100},
CubicCurveFloat64{100, 100, 300, 200, 200, 200, 300, 100},
CubicCurveFloat64{100, 100, 0, 300, 200, 0, 300, 300},
}
)
@ -56,7 +57,7 @@ func savepng(filePath string, m image.Image) {
}
func TestCubicCurveCasteljauRec(t *testing.T) {
func TestCubicCurveRec(t *testing.T) {
for i, curve := range testsFloat64 {
d := curve.EstimateDistance()
log.Printf("Distance estimation: %f\n", d)
@ -71,7 +72,7 @@ func TestCubicCurveCasteljauRec(t *testing.T) {
}
}
func TestCubicCurveCasteljau(t *testing.T) {
func TestCubicCurve(t *testing.T) {
for i, curve := range testsFloat64 {
d := curve.EstimateDistance()
log.Printf("Distance estimation: %f\n", d)
@ -87,7 +88,7 @@ func TestCubicCurveCasteljau(t *testing.T) {
}
func BenchmarkCubicCurveCasteljauRec(b *testing.B) {
func BenchmarkCubicCurveRec(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, curve := range testsFloat64 {
d := curve.EstimateDistance()
@ -98,7 +99,7 @@ func BenchmarkCubicCurveCasteljauRec(b *testing.B) {
}
}
func BenchmarkCubicCurveCasteljau(b *testing.B) {
func BenchmarkCubicCurve(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, curve := range testsFloat64 {
d := curve.EstimateDistance()