|
Class: EllipticalArc
Object
|
+--Geometric
|
+--EllipticalArc
- Package:
- stx:libbasic2
- Category:
- Graphics-Geometry-Objects
- Version:
- rev:
1.15
date: 2016/09/22 13:07:37
- user: cg
- file: EllipticalArc.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
- Author:
- Claus Gittinger
This class implements an ellipse which is aligned to x and y axes
given a boundingBox, a startAngle and a sweepAngle.
Positive angles are taken clockwise, negative angles are counterclockwise.
Circle
Spline
Curve
LineSegment
Polygon
Rectangle
Arrow
ArrowedSpline
GraphicsContext
StrokingWrapper
FillingWrapper
instance creation
-
boundingBox: aRectangle
-
Return a new EllipticalArc.
-
boundingBox: aRectangle startAngle: startAngle endAngle: endAngle
-
Return a new EllipticalArc.
-
boundingBox: aRectangle startAngle: startAngle sweepAngle: sweepAngle
-
Return a new EllipticalArc.
-
center: centerPoint radius: radius
-
Return a new Circle.
-
center: centerPoint radius: radius startAngle: startAngle endAngle: endAngle
-
Return a new (circular) Arc.
-
center: centerPoint radius: radius startAngle: startAngle sweepAngle: sweepAngle
-
Return a new (circular) Arc.
accessing
-
boundingBox: aRectangle
-
setup the arc, given a bounding rectangle
-
boundingBox: aRectangle startAngle: start sweepAngle: sweep
-
setup the arc, given a bounding rectangle, start and endAngle
-
center: centerPoint radius: radius
-
setup for a circular arc, given center and radius
-
endAngle
-
return the endAngle.
-
startAngle
-
return the startAngle.
-
startAngle: angle
-
set the startAngle.
-
sweepAngle
-
return the sweepAngle.
-
sweepAngle: angle
-
set the sweepAngle.
converting
-
asEllipticalArc
-
convert the receiver into an ellipticalArc - that's the receiver itself
displaying
-
displayFilledOn: aGC
-
draw the receiver as a filled arc in a graphicsContext, aGC
-
displayStrokedOn: aGC
-
draw the receiver as a unfilled arc in a graphicsContext, aGC
queries
-
center
-
return the center
-
computeBounds
-
return the smallest enclosing rectangle
testing
-
canBeFilled
-
return true, if the receiver can be drawn as a filled geometric.
Always true here.
ellipses; filled & unfilled:
|v e|
v := (View extent:200@100) openAndWait.
e := EllipticalArc
boundingBox:(10@10 corner:190@90)
startAngle:0
endAngle:360.
v paint:Color blue.
e displayFilledOn:v.
v paint:Color red.
e displayStrokedOn:v.
| elliptical arcs; filled & unfilled:
|v e|
v := (View extent:200@100) openAndWait.
e := EllipticalArc
boundingBox:(10@10 corner:190@90)
startAngle:0
endAngle:270.
v paint:Color blue.
e displayFilledOn:v.
v paint:Color red.
e displayStrokedOn:v.
| more arcs; filled:
|v ell|
v := View new openAndWait.
ell := EllipticalArc
boundingBox:(10@10 corner:90@90)
startAngle:0
sweepAngle:0.
#(45 90 135 180 225 270 315 360)
keysAndValuesReverseDo:[:index :angle |
index odd ifTrue:[
v paint:Color white
] ifFalse:[
v paint:Color black
].
ell sweepAngle:angle.
ell displayFilledOn:v.
Delay waitForSeconds:0.1.
].
| more arcs; filled:
|v ell|
v := View new openAndWait.
ell := EllipticalArc
boundingBox:(10@10 corner:90@90)
startAngle:0
sweepAngle:45.
#(45 90 135 180 225 270 315 360)
with:#( 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1)
do:[:angle :grey |
ell startAngle:angle-45.
v paint:(ColorValue red:grey green:0 blue:0).
ell displayFilledOn:v.
].
|
|