Squeak Class Documentation category index | class index  
 
StrokeSimplifier
  category: Graphics-Tools-Simplification
  superclass: Object
  subclasses:

I represent a very simple algorithm for simplifying an input stroke. See class side for an example.

instance methods
  initialize
  initialize
reset

  private
  asStrokePoint:

  public
  add:
closeStroke
currentStroke
finalStroke
finalizeStroke
firstPoint
next
pointsDo:

  simplification
  addFirstPoint
addLastPoint
addNextPoint
addPoint:
simplifyIncrementally
simplifyLineFrom:

class methods
  examples
  flattenExample

  instance creation
  new

instance methods
  initialize top  
 

initialize


 

reset


  private top  
 

asStrokePoint:


  public top  
 

add:


 

closeStroke

Close the current stroke


 

currentStroke

Return a copy of the current stroke.
As far as we have it, that is.


 

finalStroke

Return the final stroke


 

finalizeStroke

Finalize the current stroke, e.g., remove the last point(s) if necessary


 

firstPoint


 

next

Returns the next 'final' point, e.g., one that will not be affected by simplification later


 

pointsDo:


  simplification top  
 

addFirstPoint

No points in stroke yet. Add the very first point.


 

addLastPoint


 

addNextPoint


 

addPoint:


 

simplifyIncrementally

Simplify the last point that was added


 

simplifyLineFrom:

Remove a point if it represents the intermediate point of a line.
We only remove 'inner' points of a line, that is, for a sequence of points like

p1----p2----p3----p4---p5

we will remove only p3. This is so that any curve can be adequately represented, e.g., so that for a stroke running like:

p0
|
p1----p2----p3----p4----p5
|
|
p6
we will neither touch p2 (required for the curve p0,p1,p2) nor p5 yet (the shape of the curve relies on p6 which is not yet recorded.


class methods
  examples top  
 

flattenExample

StrokeSimplifier flattenExample


  instance creation top  
 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.