EllipticalArc.st
author Claus Gittinger <cg@exept.de>
Thu, 09 Jun 2016 12:42:07 +0200
changeset 3900 d9f7c0265cc0
parent 2157 b8368addde0d
child 4088 d43c1faedb32
permissions -rw-r--r--
class: HTMLPrinterStream changed: #initialize lazy package dependency
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
78
claus
parents:
diff changeset
     1
"
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
     3
	      All Rights Reserved
claus
parents:
diff changeset
     4
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    10
 hereby transferred.
claus
parents:
diff changeset
    11
"
1303
6ca5f36cdc63 category
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    12
"{ Package: 'stx:libbasic2' }"
6ca5f36cdc63 category
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    13
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    14
Geometric subclass:#EllipticalArc
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    15
	instanceVariableNames:'boundingBox startAngle sweepAngle'
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    16
	classVariableNames:''
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    17
	poolDictionaries:''
1303
6ca5f36cdc63 category
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    18
	category:'Graphics-Geometry-Objects'
78
claus
parents:
diff changeset
    19
!
claus
parents:
diff changeset
    20
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
    21
!EllipticalArc class methodsFor:'documentation'!
78
claus
parents:
diff changeset
    22
claus
parents:
diff changeset
    23
copyright
claus
parents:
diff changeset
    24
"
claus
parents:
diff changeset
    25
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
    26
	      All Rights Reserved
claus
parents:
diff changeset
    27
claus
parents:
diff changeset
    28
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    33
 hereby transferred.
claus
parents:
diff changeset
    34
"
claus
parents:
diff changeset
    35
!
claus
parents:
diff changeset
    36
claus
parents:
diff changeset
    37
documentation
claus
parents:
diff changeset
    38
"
claus
parents:
diff changeset
    39
     This class implements an ellipse which is aligned to x and y axes
claus
parents:
diff changeset
    40
     given a boundingBox, a startAngle and a sweepAngle.
claus
parents:
diff changeset
    41
     Positive angles are taken clockwise, negative angles are counterclockwise.
281
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    42
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    43
    [author:]
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    44
        Claus Gittinger
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    45
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    46
    [see also:]
331
Claus Gittinger <cg@exept.de>
parents: 289
diff changeset
    47
        Circle Spline Curve LineSegment Polygon Rectangle Arrow
Claus Gittinger <cg@exept.de>
parents: 289
diff changeset
    48
        ArrowedSpline
281
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    49
        GraphicsContext
288
5d79dc613999 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 284
diff changeset
    50
        StrokingWrapper FillingWrapper
78
claus
parents:
diff changeset
    51
"
289
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    52
!
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    53
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    54
examples
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    55
"
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    56
  ellipses; filled & unfilled:
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    57
                                                                        [exBegin]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    58
    |v e|
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    59
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    60
    v := (View extent:200@100) openAndWait.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    61
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    62
    e := EllipticalArc 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    63
            boundingBox:(10@10 corner:190@90)
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    64
            startAngle:0
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    65
            endAngle:360. 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    66
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    67
    v paint:Color blue.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    68
    e displayFilledOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    69
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    70
    v paint:Color red.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    71
    e displayStrokedOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    72
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    73
                                                                        [exEnd]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    74
  elliptical arcs; filled & unfilled:
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    75
                                                                        [exBegin]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    76
    |v e|
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    77
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    78
    v := (View extent:200@100) openAndWait.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    79
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    80
    e := EllipticalArc 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    81
            boundingBox:(10@10 corner:190@90)
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    82
            startAngle:0
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    83
            endAngle:270. 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    84
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    85
    v paint:Color blue.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    86
    e displayFilledOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    87
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    88
    v paint:Color red.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    89
    e displayStrokedOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    90
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    91
                                                                        [exEnd]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    92
  more arcs; filled:
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    93
                                                                        [exBegin]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    94
    |v ell|
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    95
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    96
    v := View new openAndWait.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    97
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    98
    ell := EllipticalArc
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    99
                boundingBox:(10@10 corner:90@90) 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   100
                startAngle:0
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   101
                sweepAngle:0.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   102
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   103
    #(45 90 135 180 225 270 315 360) 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   104
    keysAndValuesReverseDo:[:index :angle |
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   105
        index odd ifTrue:[
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   106
            v paint:Color white
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   107
        ] ifFalse:[
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   108
            v paint:Color black
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   109
        ].
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   110
        ell sweepAngle:angle.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   111
        ell displayFilledOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   112
        Delay waitForSeconds:0.1.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   113
    ].
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   114
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   115
                                                                        [exEnd]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   116
  more arcs; filled:
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   117
                                                                        [exBegin]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   118
    |v ell|
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   119
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   120
    v := View new openAndWait.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   121
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   122
    ell := EllipticalArc
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   123
                boundingBox:(10@10 corner:90@90) 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   124
                startAngle:0
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   125
                sweepAngle:45.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   126
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   127
    #(45 90 135 180 225 270 315 360) 
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   128
    with:#( 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1)
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   129
    do:[:angle :grey |
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   130
        ell startAngle:angle-45.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   131
        v paint:(ColorValue red:grey green:0 blue:0).
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   132
        ell displayFilledOn:v.
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   133
    ].
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   134
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   135
                                                                        [exEnd]
c4a61914a9a0 more examples & comments
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   136
"
78
claus
parents:
diff changeset
   137
! !
claus
parents:
diff changeset
   138
claus
parents:
diff changeset
   139
!EllipticalArc class methodsFor:'instance creation'!
claus
parents:
diff changeset
   140
claus
parents:
diff changeset
   141
boundingBox:aRectangle
claus
parents:
diff changeset
   142
    "Return a new EllipticalArc."
claus
parents:
diff changeset
   143
claus
parents:
diff changeset
   144
    ^ self new boundingBox:aRectangle
claus
parents:
diff changeset
   145
!
claus
parents:
diff changeset
   146
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   147
boundingBox:aRectangle startAngle:startAngle endAngle:endAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   148
    "Return a new EllipticalArc."
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   149
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   150
    ^ self boundingBox:aRectangle startAngle:startAngle sweepAngle:(endAngle - startAngle)
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   151
!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   152
78
claus
parents:
diff changeset
   153
boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle
claus
parents:
diff changeset
   154
    "Return a new EllipticalArc."
claus
parents:
diff changeset
   155
claus
parents:
diff changeset
   156
    ^ self new boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle
claus
parents:
diff changeset
   157
!
claus
parents:
diff changeset
   158
claus
parents:
diff changeset
   159
center:centerPoint radius:radius
claus
parents:
diff changeset
   160
    "Return a new Circle."
claus
parents:
diff changeset
   161
claus
parents:
diff changeset
   162
    ^ self new center:centerPoint radius:radius
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   163
!
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   164
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   165
center:centerPoint radius:radius startAngle:startAngle endAngle:endAngle
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   166
    "Return a new (circular) Arc."
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   167
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   168
    ^ (self new center:centerPoint radius:radius)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   169
        startAngle:startAngle; sweepAngle:(endAngle - startAngle)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   170
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   171
    "Created: 17.5.1996 / 09:58:36 / cg"
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   172
    "Modified: 17.5.1996 / 09:59:16 / cg"
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   173
!
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   174
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   175
center:centerPoint radius:radius startAngle:startAngle sweepAngle:sweepAngle
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   176
    "Return a new (circular) Arc."
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   177
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   178
    ^ (self new center:centerPoint radius:radius)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   179
        startAngle:startAngle; sweepAngle:sweepAngle
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   180
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   181
    "Created: 17.5.1996 / 09:59:08 / cg"
78
claus
parents:
diff changeset
   182
! !
claus
parents:
diff changeset
   183
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   184
!EllipticalArc methodsFor:'accessing'!
78
claus
parents:
diff changeset
   185
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   186
boundingBox:aRectangle
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   187
    "setup the arc, given a bounding rectangle"
78
claus
parents:
diff changeset
   188
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   189
    boundingBox := aRectangle.
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   190
    startAngle := 0.
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   191
    sweepAngle := 360
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   192
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   193
    "Modified: 17.5.1996 / 10:05:06 / cg"
78
claus
parents:
diff changeset
   194
!
claus
parents:
diff changeset
   195
claus
parents:
diff changeset
   196
boundingBox:aRectangle startAngle:start sweepAngle:sweep
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   197
    "setup the arc, given a bounding rectangle, start and endAngle"
78
claus
parents:
diff changeset
   198
claus
parents:
diff changeset
   199
    boundingBox := aRectangle.
claus
parents:
diff changeset
   200
    startAngle := start.
claus
parents:
diff changeset
   201
    sweepAngle := sweep
346
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   202
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   203
    "Modified: 17.5.1996 / 10:05:27 / cg"
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   204
!
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   205
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   206
center:centerPoint radius:radius
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   207
    "setup for a circular arc, given center and radius"
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   208
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   209
    boundingBox := Rectangle
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   210
                        left:(centerPoint x - radius)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   211
                        top:(centerPoint y - radius)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   212
                        width:(radius * 2)
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   213
                        height:(radius * 2).
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   214
    startAngle := 0.
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   215
    sweepAngle := 360.
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   216
d263792e62f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 331
diff changeset
   217
    "Created: 17.5.1996 / 10:07:35 / cg"
78
claus
parents:
diff changeset
   218
!
claus
parents:
diff changeset
   219
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   220
endAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   221
    "return the endAngle."
78
claus
parents:
diff changeset
   222
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   223
    ^ startAngle + sweepAngle
78
claus
parents:
diff changeset
   224
!
claus
parents:
diff changeset
   225
claus
parents:
diff changeset
   226
startAngle
claus
parents:
diff changeset
   227
    "return the startAngle."
claus
parents:
diff changeset
   228
claus
parents:
diff changeset
   229
    ^ startAngle
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   230
!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   231
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   232
startAngle:angle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   233
    "set the startAngle."
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   234
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   235
    startAngle := angle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   236
!
78
claus
parents:
diff changeset
   237
claus
parents:
diff changeset
   238
sweepAngle
claus
parents:
diff changeset
   239
    "return the sweepAngle."
claus
parents:
diff changeset
   240
claus
parents:
diff changeset
   241
    ^ sweepAngle
claus
parents:
diff changeset
   242
!
claus
parents:
diff changeset
   243
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   244
sweepAngle:angle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   245
    "set the sweepAngle."
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   246
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   247
    sweepAngle := angle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   248
! !
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   249
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   250
!EllipticalArc methodsFor:'converting'!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   251
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   252
asEllipticalArc
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   253
    "convert the receiver into an ellipticalArc - thats the receiver itself"
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   254
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   255
    ^ self 
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   256
! !
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   257
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   258
!EllipticalArc methodsFor:'displaying'!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   259
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   260
displayFilledOn:aGC
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   261
    "draw the receiver as a filled arc in a graphicsContext, aGC"
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   262
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   263
    aGC fillArcX:boundingBox left
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   264
               y:boundingBox top
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   265
           width:boundingBox width
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   266
          height:boundingBox height
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   267
            from:startAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   268
              to:(startAngle+sweepAngle)
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   269
!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   270
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   271
displayStrokedOn:aGC
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   272
    "draw the receiver as a unfilled arc in a graphicsContext, aGC"
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   273
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   274
    aGC displayArcX:boundingBox left
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   275
                  y:boundingBox top
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   276
              width:boundingBox width
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   277
             height:boundingBox height
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   278
               from:startAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   279
              angle:sweepAngle
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   280
! !
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   281
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   282
!EllipticalArc methodsFor:'queries'!
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   283
78
claus
parents:
diff changeset
   284
center
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   285
    "return the center"
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   286
78
claus
parents:
diff changeset
   287
    ^ boundingBox center
490
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   288
!
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   289
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   290
computeBounds
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   291
    "return the smallest enclosing rectangle"
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   292
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   293
    ^ boundingBox
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   294
ef43c7a69346 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   295
    "Created: 12.2.1997 / 11:43:00 / cg"
78
claus
parents:
diff changeset
   296
! !
claus
parents:
diff changeset
   297
2157
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   298
!EllipticalArc methodsFor:'testing'!
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   299
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   300
canBeFilled
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   301
    "return true, if the receiver can be drawn as a filled geometric.
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   302
     Always true here."
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   303
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   304
    ^ true
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   305
! !
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   306
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   307
!EllipticalArc class methodsFor:'documentation'!
78
claus
parents:
diff changeset
   308
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   309
version
2157
b8368addde0d category changes
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
   310
    ^ '$Header: /cvs/stx/stx/libbasic2/EllipticalArc.st,v 1.14 2009-06-06 10:12:23 cg Exp $'
275
4a9fed506144 doku, comments & more functionality
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   311
! !