bounds may be larger than controlPoint-bounds
authorClaus Gittinger <cg@exept.de>
Mon, 13 May 1996 11:19:57 +0200
changeset 332 bb2dd1a968c2
parent 331 9ad8e3f94da5
child 333 785f0e48fdb8
bounds may be larger than controlPoint-bounds
Spline.st
--- a/Spline.st	Mon May 13 01:06:59 1996 +0200
+++ b/Spline.st	Mon May 13 11:19:57 1996 +0200
@@ -255,7 +255,7 @@
     aGC displayPolygon:lines
 
     "Created: 8.5.1996 / 18:44:17 / cg"
-    "Modified: 8.5.1996 / 18:45:49 / cg"
+    "Modified: 13.5.1996 / 11:19:14 / cg"
 ! !
 
 !Spline methodsFor:'private'!
@@ -507,21 +507,26 @@
 bounds
     "return the smallest enclosing rectangle"
 
-    |minX maxX minY maxY|
+    |l minX maxX minY maxY|
 
-    minX := maxX := controlPoints first x.
-    minY := maxY := controlPoints first y.
-    controlPoints do:[:p |
+    lines isNil ifTrue:[
+        lines := self computeLineSegments.
+    ].
+    l := lines.
+
+    minX := maxX := l first x rounded.
+    minY := maxY := l first y rounded.
+    l do:[:p |
         |x y|
 
-        (x := p x) < minX ifTrue:[
+        (x := p x rounded) < minX ifTrue:[
             minX := x
         ] ifFalse:[
             x > maxX ifTrue:[
                 maxX := x
             ]
         ].
-        (y := p y) < minX ifTrue:[
+        (y := p y rounded) < minX ifTrue:[
             minY := y
         ] ifFalse:[
             y > maxY ifTrue:[
@@ -532,8 +537,8 @@
 
     ^ Rectangle left:minX right:maxX top:minY bottom:maxY
 
-    "Modified: 8.5.1996 / 20:50:03 / cg"
     "Created: 13.5.1996 / 00:27:29 / cg"
+    "Modified: 13.5.1996 / 11:02:29 / cg"
 !
 
 isCyclic
@@ -547,5 +552,5 @@
 !Spline class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Spline.st,v 1.9 1996-05-12 23:06:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Spline.st,v 1.10 1996-05-13 09:19:57 cg Exp $'
 ! !