org.freehep.graphicsio
Class CubicToQuadPathConstructor

java.lang.Object
  extended by org.freehep.graphicsio.AbstractPathConstructor
      extended by org.freehep.graphicsio.CubicToQuadPathConstructor
All Implemented Interfaces:
PathConstructor
Direct Known Subclasses:
SWFPathConstructor

public abstract class CubicToQuadPathConstructor
extends AbstractPathConstructor

Implements the Cubic Bezier Curve PathConstructor functionality in terms of Quadratic Bezier Curves Uses the same algorithm published as ActionScript (SWF) by Robert Penner: ========================== Cubic Bezier Drawing v1.1 ========================== recursive quadratic approximation with adjustable tolerance March 4, 2004 Robert Penner www.robertpenner.com/tools/bezier_cubic.zip file: bezier_draw_cubic.as ==========================

Version:
$Id: CubicToQuadPathConstructor.java 9319 2006-11-13 22:08:58Z duns $
Author:
Mark Donszelmann

Field Summary
 
Fields inherited from class org.freehep.graphicsio.AbstractPathConstructor
currentX, currentY
 
Constructor Summary
protected CubicToQuadPathConstructor(double resolution)
           
 
Method Summary
 void closePath(double x0, double y0)
          Closes the path by drawing a straight line to the last point which was argument to move.
 void cubic(double x1, double y1, double x2, double y2, double x3, double y3)
          Draws a cubic bezier curve from the current point to (x3, y3) using the control points (x1, y1) and (x2, y2) and make (x3, y3) the current point.
static java.awt.geom.Point2D intersect(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3, java.awt.geom.Point2D p4)
           
 void line(double x, double y)
          Draws a line from the current point to (x,y) and make (x,y) the current point.
static void main(java.lang.String[] args)
           
static java.awt.geom.Point2D midPoint(java.awt.geom.Point2D a, java.awt.geom.Point2D b)
           
 void move(double x, double y)
          Makes (x,y) the current point.
 void quadratify(java.awt.geom.Point2D a, java.awt.geom.Point2D b, java.awt.geom.Point2D c, java.awt.geom.Point2D d)
           
 
Methods inherited from class org.freehep.graphicsio.AbstractPathConstructor
addPath, addPath, addPath, flush, isEvenOdd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.freehep.graphicsio.PathConstructor
quad
 

Constructor Detail

CubicToQuadPathConstructor

protected CubicToQuadPathConstructor(double resolution)
Method Detail

move

public void move(double x,
                 double y)
          throws java.io.IOException
Description copied from interface: PathConstructor
Makes (x,y) the current point.

Throws:
java.io.IOException

line

public void line(double x,
                 double y)
          throws java.io.IOException
Description copied from interface: PathConstructor
Draws a line from the current point to (x,y) and make (x,y) the current point.

Throws:
java.io.IOException

cubic

public void cubic(double x1,
                  double y1,
                  double x2,
                  double y2,
                  double x3,
                  double y3)
           throws java.io.IOException
Description copied from interface: PathConstructor
Draws a cubic bezier curve from the current point to (x3, y3) using the control points (x1, y1) and (x2, y2) and make (x3, y3) the current point.

Throws:
java.io.IOException

closePath

public void closePath(double x0,
                      double y0)
               throws java.io.IOException
Description copied from interface: PathConstructor
Closes the path by drawing a straight line to the last point which was argument to move.

Throws:
java.io.IOException

intersect

public static java.awt.geom.Point2D intersect(java.awt.geom.Point2D p1,
                                              java.awt.geom.Point2D p2,
                                              java.awt.geom.Point2D p3,
                                              java.awt.geom.Point2D p4)

midPoint

public static java.awt.geom.Point2D midPoint(java.awt.geom.Point2D a,
                                             java.awt.geom.Point2D b)

quadratify

public void quadratify(java.awt.geom.Point2D a,
                       java.awt.geom.Point2D b,
                       java.awt.geom.Point2D c,
                       java.awt.geom.Point2D d)
                throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2000-2007 FreeHEP. All Rights Reserved.