Squeak Class Documentation category index | class index  
 
POSimplePolygon
  category: Balloon3D-Pooh
  superclass: Object
  subclasses:

I represent a polygon that is defined by a sequence of vertices. Every vertex is connected to two other vertices.

instance methods
  accessing
  after:
before:
boundingBox
bounds
end
nextButOne:
size
start
vertices
vertices:

  adding
  add:
add:after:
add:before:
addAll:
addLast:

  converting
  asEdgeList
asSortedCollection
normalizedWithin:

  enumerating
  do:

  geometry
  center
length
reverseCirculation

  point reduction
  normalizeTo:
reduceTo:

  private
  assorts

  removing
  remove:

  testing
  circulation
includes:
is:connectedWith:
isSimple

class methods
  examples
  testCircle
testFly
testTriangle

instance methods
  accessing top  
 

after:


 

before:


 

boundingBox


 

bounds


 

end


 

nextButOne:


 

size

Primitive. Answer the number of indexable variables in the receiver.
This value is the same as the largest legal subscript. Essential. See Object
documentation whatIsAPrimitive.


 

start


 

vertices


 

vertices:


  adding top  
 

add:


 

add:after:


 

add:before:


 

addAll:


 

addLast:


  converting top  
 

asEdgeList


 

asSortedCollection

Returns a SortedCollection of my vertices. The sort order is
lexicographically.
This can be used as an eventqueue for sweepline algorithms.


 

normalizedWithin:


  enumerating top  
 

do:


  geometry top  
 

center


 

length


 

reverseCirculation


  point reduction top  
 

normalizeTo:


 

reduceTo:


  private top  
 

assorts

Builds a SortedCollection of my vertices. The sort order is
lexicographically.
This can be used as an eventqueue for sweepline algorithms.


  removing top  
 

remove:


  testing top  
 

circulation

The circulation of a simple polygon can be #left (counterclockwise) or #right (clockwise)


 

includes:


 

is:connectedWith:


 

isSimple

| queue edges event prev next sleeve1 sleeve2 |
queue _ self asSortedCollection removeLast; yourself.
edges _ OrderedCollection new.
[queue isEmpty]
whileFalse:
[event _ queue removeFirst.
prev _ self before: event.
next _ self after: event.
sleeve1 _ prev x <= event x.
sleeve2 _ next x <= event x.
sleeve1 ifTrue: [edges remove: prev].
sleeve2 ifTrue: [edges remove: event].
sleeve1 ifFalse: [edges do: [:origin | ((origin
to: (self after: origin)
intersects: prev
to: event)
and: [prev ~= (self after: origin)])
ifTrue: [^ false]]].
sleeve2 ifFalse: [edges do: [:origin | ((origin
to: (self after: origin)
intersects: event
to: next)
and: [next ~= origin])
ifTrue: [^ false]]].
sleeve1 ifFalse: [edges add: prev].
sleeve2 ifFalse: [edges add: event]].


class methods
  examples top  
 

testCircle

SimplePolygon testCircle


 

testFly

SimplePolygon testFly


 

testTriangle

SimplePolygon testTriangle