jfig.objects
Class FigXSpline

java.lang.Object
  extended byjfig.objects.FigPolyline
      extended byjfig.objects.FigXSpline
All Implemented Interfaces:
FigDrawable, FigObject
Direct Known Subclasses:
FigBezierXSpline, FigGeneralXSpline, FigNormalXSpline

public class FigXSpline
extends FigPolyline

X-spline objects, which allow to specify the spline behaviour at each spline control point via a "scale factor" for that point.

This code relies on jfig.utils.Xspline for building the spline. Please see the Copyright note in that class for details about the underlying algorithm and implementation from xfig u_draw.c


Field Summary
protected  double[] sfactors
          array with one sfactor value between [-1.0 ..
protected  java.awt.Point[] wcp_spline
           
 
Fields inherited from class jfig.objects.FigPolyline
attribs, bbox, comment, debug, is_closed, min_i, min_num_points, painter, renderer, selected, showPoints, syncRedrawFlag, trafo, visible, wcp
 
Constructor Summary
FigXSpline()
           
FigXSpline(int x0, int y0, boolean is_closed, FigAttribs attribs, FigTrafo2D trafo)
           
FigXSpline(int x0, int y0, FigAttribs attribs, FigTrafo2D trafo)
           
 
Method Summary
 FigObject copy()
          build a copy of this FigXSpline.
 void createRenderer()
           
 void createSfactors()
          default method to create the interpolation control sfactors.
 void dumpSfactors()
           
 void dumpXsplinePoints()
          print the array of interpolated spline points to stdout for debugging purposes.
 double[] getSFactors()
          return the array of s-factors, one s-factor per spline control point.
 java.awt.Point[] getSplinePoints()
          return the (possibly quite large) array of interpolated spline points calculated by jfig.utils.Xspline.compute_spline.
 void rebuild()
          rebuild all internal data-structures for this polyline.
 void setSFactors(double[] sfactors)
           
 java.lang.String toString()
          toString() for debug purposes.
 
Methods inherited from class jfig.objects.FigPolyline
appendPoint, calc_dist, canRotate, deletePoint, deselect, get_min_dist_index, get_sc_bbox, getAttributes, getBbox, getComment, getLayer, getMinDistPoint1, getMinDistPoint2, getMinPerpendicularDistance, getMinPerpendicularDistance, getMovePointNeighbors, getNearestPoint, getNeighborPoints, getObjectPainter, getPoints, getPosition, getSegmentDistance, getSyncRedrawFlag, getText, getTrafo, indexOfNearestNeighbor, initialize, insertPoint, isClosed, isSelected, isShowPoints, isVisible, isVisible, keyPressed, manhattan, message, minDistance, minDistanceEuclid, mirrorX, mirrorY, move, movePoint, nearerPoint, numPoints, paint, paint, paintSave, printCost, reset_debug, rotate, scale, select, set_debug, setArrowMode, setAttributes, setBackwardArrow, setComment, setFillColor, setFillStyle, setForwardArrow, setIsClosed, setLayer, setLineColor, setLineStyle, setLineWidth, setObjectPainter, setPoints, setSyncRedrawFlag, setText, setTrafo, setVisible, showPoints, supportsPointOps, update_bbox, update, updateAttributes, writeAsResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sfactors

protected double[] sfactors
array with one sfactor value between [-1.0 .. 1.0] per spline vertex, where 1.0 means approximated, -1.0 means Bezier, 0.0 is sharp edge.


wcp_spline

protected java.awt.Point[] wcp_spline
Constructor Detail

FigXSpline

public FigXSpline()

FigXSpline

public FigXSpline(int x0,
                  int y0,
                  FigAttribs attribs,
                  FigTrafo2D trafo)

FigXSpline

public FigXSpline(int x0,
                  int y0,
                  boolean is_closed,
                  FigAttribs attribs,
                  FigTrafo2D trafo)
Method Detail

createRenderer

public void createRenderer()
Overrides:
createRenderer in class FigPolyline

createSfactors

public void createSfactors()
default method to create the interpolation control sfactors. We use 1.0 (approximated) everywhere except for the end points.


toString

public java.lang.String toString()
Description copied from class: FigPolyline
toString() for debug purposes.

Specified by:
toString in interface FigObject
Overrides:
toString in class FigPolyline

rebuild

public void rebuild()
Description copied from class: FigPolyline
rebuild all internal data-structures for this polyline. This method re-calculates all internal data required for fast rendering from the world-coordinate control points, attributes, and FigTrafo2D coordinate transformation data. Therefore, this method is computationally expensive and should only be called when necessary.

Specified by:
rebuild in interface FigObject
Overrides:
rebuild in class FigPolyline

getSFactors

public double[] getSFactors()
return the array of s-factors, one s-factor per spline control point.


setSFactors

public void setSFactors(double[] sfactors)

getSplinePoints

public java.awt.Point[] getSplinePoints()
return the (possibly quite large) array of interpolated spline points calculated by jfig.utils.Xspline.compute_spline.


dumpXsplinePoints

public void dumpXsplinePoints()
print the array of interpolated spline points to stdout for debugging purposes.


dumpSfactors

public void dumpSfactors()

copy

public FigObject copy()
build a copy of this FigXSpline.

Specified by:
copy in interface FigObject
Overrides:
copy in class FigPolyline