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