Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.graph.dot.impl
Class DotSpline  view DotSpline download DotSpline.java

java.lang.Object
  extended bycom.port80.graph.dot.impl.DotSpline

public class DotSpline
extends java.lang.Object

Spline class represent a spline of n-Bezier segments with 3n+1 points. //TODO: Should use int[] x,y instead IntPoint.


Field Summary
private static boolean DEBUG
           
(package private)  DotPoint ep
          Tail end point (ie.
(package private)  boolean isReversed
          Head end point (ie.
private static java.lang.String NAME
           
(package private)  DotPoint[] pts
           
(package private)  int size
           
(package private)  DotPoint sp
           
private static boolean VERBOSE
           
private  double[][] xs
          Temp.
private  double[][] ys
           
 
Constructor Summary
DotSpline()
           
DotSpline(DotSpline s)
           
DotSpline(DotSpline s, int start, int end)
          Create a new spline from the given segment.
DotSpline(int n)
           
DotSpline(int n, int size)
           
 
Method Summary
 void add(DotPoint p)
           
 void add(DotPolyline segment)
          Add a new Spline segment of n points to the spline.
 void add(double x, double y)
           
 void bezierAt(int index, double t, DotPoint ret)
          Evaluate Bezier point on segment start at 'index' at parameter value 't'.
 IntPoint bezierAtY(int y)
           
 DotPoint get(int n)
           
 java.awt.Rectangle getBounds()
          Determine the bounding rectange for the curve from Control 'c' to this control.
 void grow(int n)
           
 boolean intersection(DotPoint ret, java.awt.Shape shape, int index)
          Binary search in 't' domain for intersection of the spline segment starting from 'index' with shape.
 boolean isReversed()
           
 void reset()
           
 void resize(int newsize, int offset)
          Splice point array and keep only points from offset to offset+newsize.
 int size()
           
 void splitAt(double t, int index, DotSpline left, DotSpline right, DotPoint ret)
          Split the Bezier curve, started at given index, at a particular parameter value.
 java.lang.String toGeneralPath()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

VERBOSE

private static final boolean VERBOSE
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

pts

DotPoint[] pts

size

int size

sp

DotPoint sp

ep

DotPoint ep
Tail end point (ie. tail arrow head).


isReversed

boolean isReversed
Head end point (ie. head arrow head).


xs

private double[][] xs
Temp. variables for splitAt().


ys

private double[][] ys
Constructor Detail

DotSpline

public DotSpline()

DotSpline

public DotSpline(int n)

DotSpline

public DotSpline(int n,
                 int size)

DotSpline

public DotSpline(DotSpline s)

DotSpline

public DotSpline(DotSpline s,
                 int start,
                 int end)
Create a new spline from the given segment.

Method Detail

resize

public void resize(int newsize,
                   int offset)
Splice point array and keep only points from offset to offset+newsize.


reset

public void reset()

getBounds

public java.awt.Rectangle getBounds()
Determine the bounding rectange for the curve from Control 'c' to this control. The bounding polygon is given by the 7 control points when dividing the curve into half (t=0.5): P0(R0)->R1->R2->R3(S0)->S1->S2->S3(P3). The bounding rectangle is the bounds of the bounding polygon.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


toGeneralPath

public java.lang.String toGeneralPath()

add

public void add(DotPolyline segment)
Add a new Spline segment of n points to the spline. The first point of the segment should be same as the last point of the current spline.


add

public void add(DotPoint p)

add

public void add(double x,
                double y)

grow

public void grow(int n)

size

public int size()

get

public DotPoint get(int n)

isReversed

public boolean isReversed()

bezierAtY

public IntPoint bezierAtY(int y)

bezierAt

public void bezierAt(int index,
                     double t,
                     DotPoint ret)
Evaluate Bezier point on segment start at 'index' at parameter value 't'.


intersection

public boolean intersection(DotPoint ret,
                            java.awt.Shape shape,
                            int index)
Binary search in 't' domain for intersection of the spline segment starting from 'index' with shape.


splitAt

public void splitAt(double t,
                    int index,
                    DotSpline left,
                    DotSpline right,
                    DotPoint ret)
Split the Bezier curve, started at given index, at a particular parameter value. Fill in control points for resulting sub-curves if 'left' and/or 'right' are not null. (From Glassner's Graphics Gems).