eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'EllipticalArc':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: EllipticalArc


Inheritance:

   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

Description:


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.


Related information:

    Circle
    Spline
    Curve
    LineSegment
    Polygon
    Rectangle
    Arrow
    ArrowedSpline
    GraphicsContext
    StrokingWrapper
    FillingWrapper

Class protocol:

instance creation
o  boundingBox: aRectangle
Return a new EllipticalArc.

o  boundingBox: aRectangle startAngle: startAngle endAngle: endAngle
Return a new EllipticalArc.

o  boundingBox: aRectangle startAngle: startAngle sweepAngle: sweepAngle
Return a new EllipticalArc.

o  center: centerPoint radius: radius
Return a new Circle.

o  center: centerPoint radius: radius startAngle: startAngle endAngle: endAngle
Return a new (circular) Arc.

o  center: centerPoint radius: radius startAngle: startAngle sweepAngle: sweepAngle
Return a new (circular) Arc.


Instance protocol:

accessing
o  boundingBox: aRectangle
setup the arc, given a bounding rectangle

o  boundingBox: aRectangle startAngle: start sweepAngle: sweep
setup the arc, given a bounding rectangle, start and endAngle

o  center: centerPoint radius: radius
setup for a circular arc, given center and radius

o  endAngle
return the endAngle.

o  startAngle
return the startAngle.

o  startAngle: angle
set the startAngle.

o  sweepAngle
return the sweepAngle.

o  sweepAngle: angle
set the sweepAngle.

converting
o  asEllipticalArc
convert the receiver into an ellipticalArc - that's the receiver itself

displaying
o  displayFilledOn: aGC
draw the receiver as a filled arc in a graphicsContext, aGC

o  displayStrokedOn: aGC
draw the receiver as a unfilled arc in a graphicsContext, aGC

queries
o  center
return the center

o  computeBounds
return the smallest enclosing rectangle

testing
o  canBeFilled
return true, if the receiver can be drawn as a filled geometric.
Always true here.


Examples:


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.
  ].



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sun, 22 Jul 2018 12:52:43 GMT