edu.mssm.crover.domain2d
Class NBezierPath

java.lang.Object
  |
  +--edu.mssm.crover.domain2d.NBezierPath
All Implemented Interfaces:
java.lang.Cloneable

public class NBezierPath
extends java.lang.Object
implements java.lang.Cloneable

Path along a Bezier curve of n control points. NBezierPath iterate along a path made of a BezierCurve of N control points and return the caller the successive positions at which a glyph can be positionned along the path given a certain inter-glyph distance.


Constructor Summary
NBezierPath(java.awt.geom.Point2D[] controls)
           
 
Method Summary
 void atStart()
          Sets the engine on the starting line.
 double B(int i, int n, double t)
          Returns the Bernstein polynomial value.
 boolean endReached()
          Returns true when the end of the path has been reached.
static void main(java.lang.String[] args)
           
 java.awt.geom.Point2D nextPoint()
          Returns the next point of the path.
 int optimalNumberOfGlyphs(int num_pos)
          Computes an optimal number of glyphs.
 int optimalNumberOfGlyphs(int num_pos, java.awt.geom.Point2D[] positions)
          Computes an optimal number of glyphs.
 void separationDistance(double distance)
          Sets the separation distance between two points returned by the engine.
protected  void setNumberOfGlyphs(int num_pos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NBezierPath

public NBezierPath(java.awt.geom.Point2D[] controls)
            throws java.lang.IllegalArgumentException
Method Detail

atStart

public void atStart()
Sets the engine on the starting line.


separationDistance

public void separationDistance(double distance)
Sets the separation distance between two points returned by the engine.


setNumberOfGlyphs

protected void setNumberOfGlyphs(int num_pos)

optimalNumberOfGlyphs

public int optimalNumberOfGlyphs(int num_pos)
Computes an optimal number of glyphs. This optimal number is defined as the number of glyphs that can hold on this curve, separated by separationDistance. The number of position given in argument is used as a hint for the approximation of equal distance. It is important to provide a non null number.


optimalNumberOfGlyphs

public int optimalNumberOfGlyphs(int num_pos,
                                 java.awt.geom.Point2D[] positions)
Computes an optimal number of glyphs. Same as optimalNumberOfGlyphs() but stores the positions of the glyphs in positions if that array is not null.


nextPoint

public java.awt.geom.Point2D nextPoint()
Returns the next point of the path.


B

public final double B(int i,
                      int n,
                      double t)
Returns the Bernstein polynomial value.


endReached

public boolean endReached()
Returns true when the end of the path has been reached.


main

public static void main(java.lang.String[] args)


Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.