0
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1988/89/90 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
Array subclass:#Polygon
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Graphics-Primitives'
|
|
18 |
!
|
|
19 |
|
|
20 |
Polygon comment:'
|
|
21 |
Polygon - an array of points
|
|
22 |
|
2
|
23 |
$Header: /cvs/stx/stx/libbasic2/Polygon.st,v 1.3 1993-10-13 00:16:58 claus Exp $
|
0
|
24 |
'!
|
|
25 |
|
|
26 |
!Polygon methodsFor: 'accessing'!
|
|
27 |
|
|
28 |
top
|
|
29 |
|minY|
|
|
30 |
|
|
31 |
(self size == 0) ifTrue: [^ nil].
|
|
32 |
minY := (self at:1) y.
|
|
33 |
self do:[:p |
|
|
34 |
(p y < minY) ifTrue:[minY := p y].
|
|
35 |
0 "stc hint"
|
|
36 |
].
|
|
37 |
^ minY
|
|
38 |
!
|
|
39 |
|
|
40 |
bottom
|
|
41 |
|maxY|
|
|
42 |
|
|
43 |
(self size == 0) ifTrue: [^ nil].
|
|
44 |
maxY := (self at:1) y.
|
|
45 |
self do:[:p |
|
|
46 |
(p y > maxY) ifTrue:[maxY := p y].
|
|
47 |
0 "stc hint"
|
|
48 |
].
|
|
49 |
^ maxY
|
|
50 |
!
|
|
51 |
|
|
52 |
left
|
|
53 |
|minX|
|
|
54 |
|
|
55 |
(self size == 0) ifTrue: [^ nil].
|
|
56 |
minX := (self at:1) x.
|
|
57 |
self do:[:p |
|
|
58 |
(p x < minX) ifTrue:[minX := p x].
|
|
59 |
0 "stc hint"
|
|
60 |
].
|
|
61 |
^ minX
|
|
62 |
!
|
|
63 |
|
|
64 |
right
|
|
65 |
|maxX|
|
|
66 |
|
|
67 |
(self size == 0) ifTrue: [^ nil].
|
|
68 |
maxX := (self at:1) x.
|
|
69 |
self do:[:p |
|
|
70 |
(p x > maxX) ifTrue:[maxX := p x].
|
|
71 |
0 "stc hint"
|
|
72 |
].
|
|
73 |
^ maxX
|
|
74 |
! !
|