Geometric.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 20:55:17 +0200
changeset 24417 03b083548da2
parent 21534 137e220de78c
permissions -rw-r--r--
#REFACTORING by exept class: Smalltalk class changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels: Transcript showCR:(... bindWith:...) -> Transcript showCR:... with:...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
356
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
"
5570
e6e14f50d721 category change
Claus Gittinger <cg@exept.de>
parents: 4352
diff changeset
    12
"{ Package: 'stx:libbasic' }"
e6e14f50d721 category change
Claus Gittinger <cg@exept.de>
parents: 4352
diff changeset
    13
19471
b3ae4ee92ecc #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 16745
diff changeset
    14
"{ NameSpace: Smalltalk }"
b3ae4ee92ecc #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 16745
diff changeset
    15
610
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    16
Object subclass:#Geometric
1283
2c533653efa3 commentary
Claus Gittinger <cg@exept.de>
parents: 637
diff changeset
    17
	instanceVariableNames:''
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
    18
	classVariableNames:'Scale InverseScale'
1283
2c533653efa3 commentary
Claus Gittinger <cg@exept.de>
parents: 637
diff changeset
    19
	poolDictionaries:''
7582
279c8f991809 category
Claus Gittinger <cg@exept.de>
parents: 7083
diff changeset
    20
	category:'Graphics-Geometry-Objects'
356
claus
parents:
diff changeset
    21
!
claus
parents:
diff changeset
    22
claus
parents:
diff changeset
    23
!Geometric class methodsFor:'documentation'!
claus
parents:
diff changeset
    24
claus
parents:
diff changeset
    25
copyright
claus
parents:
diff changeset
    26
"
claus
parents:
diff changeset
    27
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
    28
	      All Rights Reserved
claus
parents:
diff changeset
    29
claus
parents:
diff changeset
    30
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    35
 hereby transferred.
claus
parents:
diff changeset
    36
"
claus
parents:
diff changeset
    37
!
claus
parents:
diff changeset
    38
claus
parents:
diff changeset
    39
documentation
claus
parents:
diff changeset
    40
"
claus
parents:
diff changeset
    41
    Abstract superclass for geometric figures.
claus
parents:
diff changeset
    42
    Concrete classes are (currently) Rectangle, Polygon and the classes
claus
parents:
diff changeset
    43
    found in goodies/shape.
claus
parents:
diff changeset
    44
claus
parents:
diff changeset
    45
    These are not graphical objects, but pure mathematical ones.
claus
parents:
diff changeset
    46
    I.e. instances do not carry graphics attributes such as color, lineWidth etc.
1355
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    47
    However, they ``know'' how to display themself as stroked or possibly
1360
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
    48
    filled picture on a graphicsContext (although, the GC's current
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
    49
    paint and lineStyles are used).
1355
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    50
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    51
    Use instances of (subclasses) of DisplayObject or 
1360
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
    52
    of the GeometricWrapper classes for objects which keep the color 
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
    53
    and lineStyle information with them.
356
claus
parents:
diff changeset
    54
1314
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    55
    Notice: 
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    56
        ST/X does not use Geometric instances for drawing (yet).
1355
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    57
        Except for Rectangle, Geometry and its subclasses exists mainly 
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    58
        for ST-80 compatibility and to provide a home when other (PD) 
1314
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    59
        geometry classes are to be filed in.
1290
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
    60
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
    61
    [author:]
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
    62
        Claus Gittinger
1314
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    63
18fabbc0e0a6 examples
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    64
    [see also:]
1355
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
    65
        Rectangle Polygon EllipticalArc Circle Spline Point
1390
Claus Gittinger <cg@exept.de>
parents: 1389
diff changeset
    66
        LineSegment Curve Arrow ArrowedSpline
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
    67
        GraphicsContext
1358
9491e703ca81 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1357
diff changeset
    68
        StrokingWrapper FillingWrapper
356
claus
parents:
diff changeset
    69
"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
    70
!
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
    71
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
    72
examples
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
    73
"
1357
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    74
  line segment:
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    75
                                                                        [exBegin]
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    76
    |v l|
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    77
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    78
    v := (View extent:100@100) openAndWait.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    79
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    80
    l := LineSegment from:10@10 to:90@90. 
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    81
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    82
    v paint:Color red.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    83
    l displayStrokedOn:v.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    84
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    85
    l start:90@10 end:10@90.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    86
    v paint:Color blue.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    87
    l displayStrokedOn:v.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    88
                                                                        [exEnd]
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    89
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    90
  rectangle, unfilled:
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    91
                                                                        [exBegin]
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    92
    |v r|
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    93
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    94
    v := (View extent:100@100) openAndWait.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    95
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    96
    r := Rectangle origin:10@10 corner:90@90. 
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    97
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    98
    v paint:Color red.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
    99
    r displayStrokedOn:v.
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   100
                                                                        [exEnd]
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   101
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   102
  circle; filled and unfilled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   103
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   104
    |v c|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   105
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   106
    v := (View extent:200@100) openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   107
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   108
    c := Circle boundingBox:(10@10 corner:90@90). 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   109
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   110
    v paint:Color blue.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   111
    c displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   112
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   113
    c center:150@50.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   114
    v paint:Color red.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   115
    c displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   116
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   117
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   118
  circle & rectangle; both filled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   119
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   120
    |v c|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   121
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   122
    v := (View extent:100@100) openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   123
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   124
    c := Circle center:50@50 radius:40. 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   125
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   126
    v paint:Color red.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   127
    c asRectangle displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   128
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   129
    v paint:Color blue.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   130
    c displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   131
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   132
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   133
  elliptical arcs; filled & unfilled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   134
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   135
    |v e|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   136
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   137
    v := (View extent:200@100) openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   138
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   139
    e := EllipticalArc 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   140
            boundingBox:(10@10 corner:190@90)
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   141
            startAngle:0
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   142
            endAngle:270. 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   143
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   144
    v paint:Color blue.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   145
    e displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   146
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   147
    v paint:Color red.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   148
    e displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   149
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   150
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   151
  polygon; filled & unfilled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   152
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   153
    |v p|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   154
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   155
    v := (View extent:100@100) openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   156
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   157
    p := Polygon vertices:
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   158
                (Array with:(10@10)
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   159
                       with:(90@90)
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   160
                       with:(10@90)).
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   161
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   162
    v paint:Color blue.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   163
    p displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   164
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   165
    v paint:Color red.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   166
    p displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   167
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   168
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   169
  circles; filled & unfilled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   170
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   171
    |v c|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   172
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   173
    v := View new openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   174
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   175
    c := Circle center:50@50 radius:40.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   176
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   177
    c displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   178
    50 to:1 by:-1 do:[:r |
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   179
        c radius:r.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   180
        v paint:(Color grey:(r * 2)).
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   181
        c displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   182
    ].
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   183
    1 to:50 do:[:r |
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   184
        c radius:r.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   185
        v paint:(Color grey:100-(r * 2)).
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   186
        c displayStrokedOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   187
    ]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   188
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   189
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   190
  arcs; filled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   191
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   192
    |v ell|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   193
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   194
    v := View new openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   195
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   196
    ell := EllipticalArc
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   197
                boundingBox:(10@10 corner:90@90) 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   198
                startAngle:0
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   199
                sweepAngle:0.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   200
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   201
    #(45 90 135 180 225 270 315 360) keysAndValuesDo:[:index :angle |
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   202
        index odd ifTrue:[
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   203
            v paint:Color white
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   204
        ] ifFalse:[
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   205
            v paint:Color black
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   206
        ].
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   207
        ell sweepAngle:angle.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   208
        ell displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   209
        Delay waitForSeconds:0.5.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   210
    ].
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   211
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   212
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   213
  arcs; filled:
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   214
                                                                        [exBegin]
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   215
    |v ell|
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   216
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   217
    v := View new openAndWait.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   218
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   219
    ell := EllipticalArc
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   220
                boundingBox:(10@10 corner:90@90) 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   221
                startAngle:0
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   222
                sweepAngle:45.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   223
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   224
    #(45 90 135 180 225 270 315 360) 
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   225
    with:#( 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1)
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   226
    do:[:angle :grey |
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   227
        ell startAngle:angle-45.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   228
        v paint:(ColorValue red:grey green:0 blue:0).
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   229
        ell displayFilledOn:v.
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   230
    ].
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   231
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   232
                                                                        [exEnd]
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   233
  spline; filled & unfilled:
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   234
                                                                        [exBegin]
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   235
    |v p|
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   236
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   237
    v := (View extent:100@100) openAndWait.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   238
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   239
    p := Spline controlPoints:
1354
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   240
                (Array with:(20@20)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   241
                       with:(80@80)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   242
                       with:(20@80)).
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   243
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   244
    v paint:Color blue.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   245
    p displayFilledOn:v.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   246
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   247
    v paint:Color red.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   248
    p displayStrokedOn:v.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   249
                                                                        [exEnd]
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   250
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   251
  closed spline; filled & unfilled:
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   252
                                                                        [exBegin]
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   253
    |v p|
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   254
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   255
    v := (View extent:100@100) openAndWait.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   256
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   257
    p := Spline controlPoints:
1354
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   258
                (Array with:(20@20)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   259
                       with:(80@80)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   260
                       with:(20@80)
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
   261
                       with:(20@20)).
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   262
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   263
    v paint:Color blue.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   264
    p displayFilledOn:v.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   265
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   266
    v paint:Color red.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   267
    p displayStrokedOn:v.
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   268
                                                                        [exEnd]
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   269
"
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   270
! !
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   271
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   272
!Geometric class methodsFor:'initialization'!
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   273
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   274
initialize
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   275
    "setup class constants"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   276
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   277
    "/ these are note used in ST/X;
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   278
    "/ (acc. to a testers note, ST-80 internally uses
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   279
    "/  integer valued coordinates, scaling coordinates by
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   280
    "/  the Scale constant. ST/X does not do this. However,
2382
78182edd332e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2381
diff changeset
   281
    "/  user supplied subclasses may depend on those values being
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   282
    "/  present ...)
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   283
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   284
    Scale := 4096.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   285
    InverseScale := 1.0 / Scale
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   286
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   287
    "
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   288
     Geometric initialize
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   289
    "
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   290
2382
78182edd332e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2381
diff changeset
   291
    "Modified: 12.2.1997 / 14:11:49 / cg"
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   292
! !
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   293
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   294
!Geometric class methodsFor:'helper functions'!
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   295
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   296
boundingRectangleForPoints:aSequencableCollectionOfPoints
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   297
    "given a bunch of point, compute the boundingRectangle
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   298
     (i.e. the smallest rectangle which encloses all of those points)"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   299
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   300
    |p minX minY maxX maxY n "{ Class: SmallInteger }"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   301
     x y |
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   302
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   303
    p := aSequencableCollectionOfPoints first.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   304
    minX := maxX := p x.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   305
    minY := maxY := p y.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   306
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   307
    n := aSequencableCollectionOfPoints size.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   308
    1 to:n do:[:idx | 
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   309
        p := aSequencableCollectionOfPoints at:idx.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   310
        x := p x.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   311
        y := p y.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   312
        x < minX ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   313
            minX := x
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   314
        ] ifFalse:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   315
            x > maxX ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   316
                maxX := x
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   317
            ]
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   318
        ].
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   319
        y < minY ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   320
            minY := y
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   321
        ] ifFalse:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   322
            y > maxY ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   323
                maxY := y
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   324
            ]
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   325
        ].
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   326
    ].
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   327
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   328
    ^ Rectangle left:minX top:minY right:maxX bottom:maxY
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   329
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   330
    "Modified: 12.2.1997 / 12:10:12 / cg"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   331
! !
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   332
21395
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   333
!Geometric class methodsFor:'queries'!
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   334
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   335
isAbstract
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   336
    "Return if this class is an abstract class.
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   337
     True is returned here for myself only; false for subclasses.
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   338
     Abstract subclasses must redefine this again."
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   339
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   340
    ^ self == Geometric.
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   341
! !
6e516ccae030 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20801
diff changeset
   342
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   343
!Geometric methodsFor:'converting'!
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   344
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   345
asFiller
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   346
    "return a wrapper which displays the receiver in its filled form"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   347
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   348
    self canBeFilled ifTrue:[
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   349
        ^ FillingWrapper on:self
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   350
    ].
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   351
    ^ self shouldNotImplement
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   352
6065
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   353
    "
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   354
     |v r|
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   355
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   356
     v := View new.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   357
     v extent:200@200.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   358
     v openAndWait.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   359
     r := Rectangle origin:10@10 corner:100@100.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   360
     r asFiller displayOn:v.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   361
    "
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   362
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   363
    "Modified: 12.2.1997 / 11:47:22 / cg"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   364
!
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   365
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   366
asRectangle
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   367
    "return the enclosing rectangle; same as #bounds"
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   368
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   369
    ^ self bounds
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   370
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   371
    "Created: 8.5.1996 / 14:36:35 / cg"
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   372
!
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   373
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   374
asStroker
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   375
    "return a wrapper which displays the receiver as stroked outline"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   376
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   377
    ^ StrokingWrapper on:self
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   378
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   379
    "Created: 8.5.1996 / 14:38:09 / cg"
1353
cab0fdd4f08e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1350
diff changeset
   380
    "Modified: 8.5.1996 / 18:23:00 / cg"
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   381
!
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   382
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   383
asVisualComponent
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   384
    "return a wrapper on the receiver, which responds to VisualComponent messages."
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   385
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   386
    ^ self asStroker
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   387
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   388
    "Created: 10.2.1997 / 12:04:27 / cg"
356
claus
parents:
diff changeset
   389
! !
claus
parents:
diff changeset
   390
claus
parents:
diff changeset
   391
!Geometric methodsFor:'displaying'!
claus
parents:
diff changeset
   392
7083
16019f54bdb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6925
diff changeset
   393
ascentOn:aGC
16019f54bdb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6925
diff changeset
   394
    "displayOn: does not draw above baseline"
16019f54bdb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6925
diff changeset
   395
16019f54bdb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6925
diff changeset
   396
    ^ 0
16019f54bdb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6925
diff changeset
   397
!
16019f54bdb8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6925
diff changeset
   398
610
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   399
displayFilledOn:aGC
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   400
    "display myself filled on a graphicsContext; the current graphics
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   401
     attributes are used. Since we do not know how to do it, nothing is
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   402
     drawn here."
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   403
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   404
    ^ self subclassResponsibility
610
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   405
6065
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   406
    "
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   407
     |v r|
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   408
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   409
     v := View new.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   410
     v extent:200@200.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   411
     v openAndWait.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   412
     r := Rectangle origin:10@10 corner:100@100.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   413
     r displayFilledOn:v.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   414
    "
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   415
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   416
    "Modified: 8.5.1996 / 09:07:02 / cg"
610
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   417
!
cadd76cb5fb0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   418
6925
2b3cb570b7b8 displayOn confusion
Claus Gittinger <cg@exept.de>
parents: 6065
diff changeset
   419
displayOn:aGCOrStream
356
claus
parents:
diff changeset
   420
    "display myself on a graphicsContext; the current graphics
claus
parents:
diff changeset
   421
     attributes are used. The default here is to display the outline."
claus
parents:
diff changeset
   422
6925
2b3cb570b7b8 displayOn confusion
Claus Gittinger <cg@exept.de>
parents: 6065
diff changeset
   423
    "/ what a kludge - Dolphin and Squeak mean: printOn:;
21534
137e220de78c #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 21395
diff changeset
   424
    "/ old ST80 means: draw-yourself on a GC.
16745
64cf7619ded9 displayOn: cleanup
Claus Gittinger <cg@exept.de>
parents: 15729
diff changeset
   425
    (aGCOrStream isStream) ifTrue:[
6925
2b3cb570b7b8 displayOn confusion
Claus Gittinger <cg@exept.de>
parents: 6065
diff changeset
   426
        ^ super displayOn:aGCOrStream
2b3cb570b7b8 displayOn confusion
Claus Gittinger <cg@exept.de>
parents: 6065
diff changeset
   427
    ].
2b3cb570b7b8 displayOn confusion
Claus Gittinger <cg@exept.de>
parents: 6065
diff changeset
   428
    ^ self displayStrokedOn:aGCOrStream
6065
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   429
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   430
    "
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   431
     |v r|
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   432
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   433
     v := View new.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   434
     v extent:200@200.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   435
     v openAndWait.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   436
     r := Rectangle origin:10@10 corner:100@100.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   437
     r displayOn:v.
f30cdb1edc0c comment
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   438
    "
21534
137e220de78c #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 21395
diff changeset
   439
137e220de78c #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 21395
diff changeset
   440
    "Modified (comment): / 22-02-2017 / 16:48:07 / cg"
356
claus
parents:
diff changeset
   441
!
claus
parents:
diff changeset
   442
claus
parents:
diff changeset
   443
displayStrokedOn:aGC
claus
parents:
diff changeset
   444
    "display my outline on a graphicsContext; the current graphics
1357
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   445
     attributes are used. Since we do not know how to do it, nothing is
356
claus
parents:
diff changeset
   446
     drawn here."
claus
parents:
diff changeset
   447
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   448
    ^ self subclassResponsibility
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   449
1357
c3681028c7f4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   450
    "Modified: 8.5.1996 / 21:20:19 / cg"
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   451
! !
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   452
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   453
!Geometric methodsFor:'queries'!
356
claus
parents:
diff changeset
   454
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   455
bounds
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   456
    "return the smallest enclosing rectangle.
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   457
     This resends computeBounds, to allow caching of bounds in
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   458
     case this computation is expensive."
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   459
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   460
    ^ self computeBounds
1350
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   461
85eec07b093b doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   462
    "Created: 8.5.1996 / 13:56:08 / cg"
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   463
    "Modified: 12.2.1997 / 11:41:38 / cg"
1446
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   464
!
fabdc1d2598c added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
   465
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   466
computeBounds
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   467
    "return the smallest enclosing rectangle."
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   468
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   469
    ^ self subclassResponsibility
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   470
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   471
    "Created: 12.2.1997 / 11:41:58 / cg"
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   472
!
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   473
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   474
outlineIntersects:aRectangle
19471
b3ae4ee92ecc #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 16745
diff changeset
   475
    "return true, if the receiver's image intersects
2376
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   476
     aRectangle, when drawn as an outline.
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   477
     Here, all we can do is to ask the boundary rectangle;
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   478
     subclasses should reimplement better checks."
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   479
2376
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   480
    ^ self bounds intersects:aRectangle
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   481
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   482
    "Modified: 10.2.1997 / 13:40:36 / cg"
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   483
!
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   484
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   485
regionIntersects:aRectangle
19471
b3ae4ee92ecc #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 16745
diff changeset
   486
    "return true, if the receiver's image intersects
2376
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   487
     aRectangle, when drawn as a filled version.
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   488
     Here, all we can do is to ask the boundary rectangle;
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   489
     subclasses should reimplement better checks."
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   490
2376
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   491
    ^ self bounds intersects:aRectangle
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   492
d4326d046be4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   493
    "Modified: 10.2.1997 / 13:40:00 / cg"
356
claus
parents:
diff changeset
   494
! !
claus
parents:
diff changeset
   495
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   496
!Geometric methodsFor:'testing'!
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   497
11744
c15b974b69a1 category changes
Claus Gittinger <cg@exept.de>
parents: 7582
diff changeset
   498
canBeFilled
c15b974b69a1 category changes
Claus Gittinger <cg@exept.de>
parents: 7582
diff changeset
   499
    "return true, if the receiver can be drawn as a filled geometric.
20801
705f8006e386 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19471
diff changeset
   500
     Return false here, since we don't know."
11744
c15b974b69a1 category changes
Claus Gittinger <cg@exept.de>
parents: 7582
diff changeset
   501
c15b974b69a1 category changes
Claus Gittinger <cg@exept.de>
parents: 7582
diff changeset
   502
    ^ false
c15b974b69a1 category changes
Claus Gittinger <cg@exept.de>
parents: 7582
diff changeset
   503
c15b974b69a1 category changes
Claus Gittinger <cg@exept.de>
parents: 7582
diff changeset
   504
    "Created: 1.6.1996 / 11:28:58 / cg"
c15b974b69a1 category changes
Claus Gittinger <cg@exept.de>
parents: 7582
diff changeset
   505
!
c15b974b69a1 category changes
Claus Gittinger <cg@exept.de>
parents: 7582
diff changeset
   506
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   507
isBezier2Segment
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   508
    "return true, if the receiver is a quadratic bezier segment"
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   509
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   510
    ^ false
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   511
!
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   512
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   513
isLineSegment
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   514
    "return true, if the receiver is a line segment"
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   515
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   516
    ^ false
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   517
! !
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   518
5570
e6e14f50d721 category change
Claus Gittinger <cg@exept.de>
parents: 4352
diff changeset
   519
!Geometric methodsFor:'transformations'!
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   520
15729
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   521
align:offset with:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   522
    self subclassResponsibility
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   523
!
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   524
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   525
alignBottomLeftWith:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   526
    "return a copy of myself where its bottomLeft is aligned with someCoordinate"
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   527
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   528
    ^ self align:(self bounds bottomLeft) with:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   529
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   530
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   531
     |r1 r2 r3 v|
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   532
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   533
     r1 := 0@0 corner:10@10.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   534
     r2 := 100@100 corner:200@200.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   535
     r3 := r1 copy alignBottomLeftWith:r2 corner.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   536
     v := (View extent:300@300) openAndWait.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   537
     r2 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   538
     r3 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   539
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   540
!
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   541
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   542
alignBottomRightWith:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   543
    "return a copy of myself where its bottomRight is aligned with someCoordinate.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   544
     Same as alignCorner"
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   545
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   546
    ^ self align:(self bounds corner) with:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   547
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   548
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   549
     |r1 r2 r3 v|
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   550
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   551
     r1 := 0@0 corner:10@10.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   552
     r2 := 100@100 corner:200@200.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   553
     r3 := r1 copy alignBottomRightWith:r2 corner.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   554
     v := (View extent:300@300) openAndWait.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   555
     r2 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   556
     r3 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   557
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   558
!
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   559
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   560
alignCenterWith:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   561
    "return a copy of myself where its center is aligned with someCoordinate.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   562
     Same as alignOrigin"
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   563
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   564
    ^ self align:(self bounds center) with:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   565
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   566
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   567
     |r1 r2 r3 v|
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   568
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   569
     r1 := 0@0 corner:10@10.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   570
     r2 := 100@100 corner:200@200.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   571
     r3 := r1 copy alignCenterWith:r2 corner.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   572
     v := (View extent:300@300) openAndWait.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   573
     r2 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   574
     r3 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   575
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   576
!
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   577
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   578
alignCornerWith:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   579
    "return a copy of myself where its corner is aligned with someCoordinate"
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   580
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   581
    ^ self align:(self bounds corner) with:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   582
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   583
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   584
     |r1 r2 r3 v|
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   585
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   586
     r1 := 0@0 corner:10@10.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   587
     r2 := 100@100 corner:200@200.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   588
     r3 := r1 copy alignCornerWith:r2 corner.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   589
     v := (View extent:300@300) openAndWait.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   590
     r2 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   591
     r3 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   592
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   593
!
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   594
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   595
alignOriginWith:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   596
    "return a copy of myself where its origin is aligned with someCoordinate"
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   597
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   598
    ^ self align:(self bounds origin) with:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   599
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   600
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   601
     |r1 r2 r3 v|
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   602
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   603
     r1 := 0@0 corner:10@10.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   604
     r2 := 100@100 corner:200@200.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   605
     r3 := r1 copy alignOriginWith:r2 corner.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   606
     v := (View extent:300@300) openAndWait.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   607
     r2 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   608
     r3 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   609
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   610
!
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   611
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   612
alignTopLeftWith:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   613
    "return a copy of myself where its topLeft is aligned with someCoordinate.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   614
     Same as alignOrigin"
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   615
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   616
    ^ self align:(self bounds origin) with:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   617
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   618
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   619
     |r1 r2 r3 v|
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   620
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   621
     r1 := 0@0 corner:10@10.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   622
     r2 := 100@100 corner:200@200.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   623
     r3 := r1 copy alignTopLeftWith:r2 corner.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   624
     v := (View extent:300@300) openAndWait.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   625
     r2 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   626
     r3 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   627
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   628
!
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   629
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   630
alignTopRightWith:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   631
    "return a copy of myself where its topRight is aligned with someCoordinate.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   632
     Same as alignOrigin"
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   633
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   634
    ^ self align:(self bounds topRight) with:someCoordinate
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   635
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   636
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   637
     |r1 r2 r3 v|
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   638
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   639
     r1 := 0@0 corner:10@10.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   640
     r2 := 100@100 corner:200@200.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   641
     r3 := r1 copy alignTopRightWith:r2 corner.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   642
     v := (View extent:300@300) openAndWait.
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   643
     r2 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   644
     r3 displayOn:v.   
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   645
    "
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   646
!
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   647
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   648
scaledBy:scaleAmount 
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   649
    "return a copy of the receiver, which is scaled by the argument,
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   650
     a point or number"
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   651
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   652
    ^ self subclassResponsibility
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   653
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   654
    "Created: 10.2.1997 / 12:05:45 / cg"
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   655
!
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   656
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   657
translatedBy:scaleAmount 
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   658
    "return a copy of the receiver, which is translated by the argument,
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   659
     a point or number"
4352
65a2c4a05292 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
   660
2377
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   661
    ^ self subclassResponsibility
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   662
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   663
    "Created: 10.2.1997 / 12:05:56 / cg"
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   664
! !
83a8f10a1234 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   665
637
f71df465819c version at the end
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   666
!Geometric class methodsFor:'documentation'!
f71df465819c version at the end
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   667
f71df465819c version at the end
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   668
version
19471
b3ae4ee92ecc #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 16745
diff changeset
   669
    ^ '$Header$'
637
f71df465819c version at the end
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   670
! !
6925
2b3cb570b7b8 displayOn confusion
Claus Gittinger <cg@exept.de>
parents: 6065
diff changeset
   671
15729
72bb494f9a13 class: Geometric
Claus Gittinger <cg@exept.de>
parents: 11744
diff changeset
   672
2381
10af98758a49 added dummy Scale & InverseScale classVars.
Claus Gittinger <cg@exept.de>
parents: 2377
diff changeset
   673
Geometric initialize!