org.apache.batik.ext.awt.geom
Class PathLength
java.lang.Object
|
+--org.apache.batik.ext.awt.geom.PathLength
- public class PathLength
- extends java.lang.Object
PathLength is a utility class for calculating the length
of a path, the location of a point at a particular length
along the path, and the angle of the tangent to the path
at a given length.
It uses a FlatteningPathIterator to create a flattened version
of the Path. This means the values returned are not always
exact (in fact, they rarely are), but in most cases they
are reasonably accurate.
Constructor Summary |
PathLength(java.awt.Shape path)
Construct a PathLength utility class to operate on the
particular Shape. |
Method Summary |
float |
angleAtLength(float length)
|
java.awt.Shape |
getPath()
Get the path to use in calculations. |
protected void |
initialise()
|
float |
lengthOfPath()
Returns the length of the path used by this PathLength object. |
static void |
main(java.lang.String[] args)
|
java.awt.geom.Point2D |
pointAtLength(float length)
Return the point that is at the given length
along the path. |
void |
setPath(java.awt.Shape v)
Set the path to use in calculations. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PathLength
public PathLength(java.awt.Shape path)
- Construct a PathLength utility class to operate on the
particular Shape.
- Parameters:
path
- The Path (or Shape) to use.
getPath
public java.awt.Shape getPath()
- Get the path to use in calculations.
- Returns:
- Path used in calculations.
setPath
public void setPath(java.awt.Shape v)
- Set the path to use in calculations.
- Parameters:
v
- Path to be used in calculations.
lengthOfPath
public float lengthOfPath()
- Returns the length of the path used by this PathLength object.
- Returns:
- The length of the path.
initialise
protected void initialise()
pointAtLength
public java.awt.geom.Point2D pointAtLength(float length)
- Return the point that is at the given length
along the path.
- Parameters:
length
- The length along the path- Returns:
- The point at the given length
angleAtLength
public float angleAtLength(float length)
main
public static void main(java.lang.String[] args)
Copyright © 2002 Apache Software Foundation. All Rights Reserved.