equal
deleted
inserted
replaced
253 |
253 |
254 "/ Plot the lines |
254 "/ Plot the lines |
255 aGC displayPolygon:lines |
255 aGC displayPolygon:lines |
256 |
256 |
257 "Created: 8.5.1996 / 18:44:17 / cg" |
257 "Created: 8.5.1996 / 18:44:17 / cg" |
258 "Modified: 8.5.1996 / 18:45:49 / cg" |
258 "Modified: 13.5.1996 / 11:19:14 / cg" |
259 ! ! |
259 ! ! |
260 |
260 |
261 !Spline methodsFor:'private'! |
261 !Spline methodsFor:'private'! |
262 |
262 |
263 computeCurve |
263 computeCurve |
505 !Spline methodsFor:'queries'! |
505 !Spline methodsFor:'queries'! |
506 |
506 |
507 bounds |
507 bounds |
508 "return the smallest enclosing rectangle" |
508 "return the smallest enclosing rectangle" |
509 |
509 |
510 |minX maxX minY maxY| |
510 |l minX maxX minY maxY| |
511 |
511 |
512 minX := maxX := controlPoints first x. |
512 lines isNil ifTrue:[ |
513 minY := maxY := controlPoints first y. |
513 lines := self computeLineSegments. |
514 controlPoints do:[:p | |
514 ]. |
|
515 l := lines. |
|
516 |
|
517 minX := maxX := l first x rounded. |
|
518 minY := maxY := l first y rounded. |
|
519 l do:[:p | |
515 |x y| |
520 |x y| |
516 |
521 |
517 (x := p x) < minX ifTrue:[ |
522 (x := p x rounded) < minX ifTrue:[ |
518 minX := x |
523 minX := x |
519 ] ifFalse:[ |
524 ] ifFalse:[ |
520 x > maxX ifTrue:[ |
525 x > maxX ifTrue:[ |
521 maxX := x |
526 maxX := x |
522 ] |
527 ] |
523 ]. |
528 ]. |
524 (y := p y) < minX ifTrue:[ |
529 (y := p y rounded) < minX ifTrue:[ |
525 minY := y |
530 minY := y |
526 ] ifFalse:[ |
531 ] ifFalse:[ |
527 y > maxY ifTrue:[ |
532 y > maxY ifTrue:[ |
528 maxY := y |
533 maxY := y |
529 ] |
534 ] |
530 ]. |
535 ]. |
531 ]. |
536 ]. |
532 |
537 |
533 ^ Rectangle left:minX right:maxX top:minY bottom:maxY |
538 ^ Rectangle left:minX right:maxX top:minY bottom:maxY |
534 |
539 |
535 "Modified: 8.5.1996 / 20:50:03 / cg" |
|
536 "Created: 13.5.1996 / 00:27:29 / cg" |
540 "Created: 13.5.1996 / 00:27:29 / cg" |
|
541 "Modified: 13.5.1996 / 11:02:29 / cg" |
537 ! |
542 ! |
538 |
543 |
539 isCyclic |
544 isCyclic |
540 "return true, if this spline represents a closed curve" |
545 "return true, if this spline represents a closed curve" |
541 |
546 |
545 ! ! |
550 ! ! |
546 |
551 |
547 !Spline class methodsFor:'documentation'! |
552 !Spline class methodsFor:'documentation'! |
548 |
553 |
549 version |
554 version |
550 ^ '$Header: /cvs/stx/stx/libbasic2/Spline.st,v 1.9 1996-05-12 23:06:59 cg Exp $' |
555 ^ '$Header: /cvs/stx/stx/libbasic2/Spline.st,v 1.10 1996-05-13 09:19:57 cg Exp $' |
551 ! ! |
556 ! ! |