jfig.objects
Class FigBezier

java.lang.Object
  extended byjfig.objects.FigPolyline
      extended byjfig.objects.FigBezier
All Implemented Interfaces:
FigDrawable, FigObject

public class FigBezier
extends FigPolyline

Bezier-style interpolated spline objects.

Class FigBezier represents Bezier-styde splines, either open or closed. It supports all standard FIG line attributes, including arrows.

Part of the code for FigBezier was translated directly from the xfig (version 3.1.3) code of w_intspline.c and u_draw.c. That part of the code is protected by the following copyright conditions: FIG : Facility for Interactive Generation of figures Copyright (c) 1985 by Supoj Sutanthavibul Parts Copyright (c) 1994 by Brian V. Smith Parts Copyright (c) 1991 by Paul King Copyright (c) 1996 by Norman F. Hendrich, Univ. of Hamburg Part of the following code was translated directly from the xfig (version 3.1.3) code of w_intspline.c and u_draw.c. That part of the code is protected by the following copyright conditions: FIG : Facility for Interactive Generation of figures Copyright (c) 1985 by Supoj Sutanthavibul Parts Copyright (c) 1994 by Brian V. Smith Parts Copyright (c) 1991 by Paul King The X Consortium, and any party obtaining a copy of these files from the X Consortium, directly or indirectly, is granted, free of charge, a full and unrestricted irrevocable, world-wide, paid up, royalty-free, nonexclusive right and license to deal in this software and documentation files (the "Software"), including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons who receive copies from any such party to do so, with the only requirement being that this copyright notice remain intact. This license includes without limitation a license to do the foregoing actions under any patents of the party supplying this software to the X Consortium.


Nested Class Summary
 class FigBezier.ControlPoint
          ControlPoint: a simple wrapper with double coordinates fields lx, ly, rx, ry.
 
Field Summary
(package private)  double _1dSQR2
           
(package private)  double _2xPI
           
(package private)  double _SQR2
           
(package private)  FigBezier.ControlPoint[] cpp
           
(package private)  int ii
           
(package private)  double M_PI_2
           
(package private) static java.awt.Point[] pp
           
(package private) static int PPMAX
           
(package private)  double[][] stack
           
(package private)  int stack_p
           
(package private)  double T
           
(package private)  java.awt.Point[] wcp_spline
           
(package private)  java.awt.Point[] wcp1
           
 
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
FigBezier(int x0, int y0, boolean is_closed, FigAttribs attribs, FigTrafo2D trafo)
           
 
Method Summary
 FigObject copy()
          build a copy of this FigPolyline.
 void createRenderer()
           
 double[] getControlPoints()
          return a list of double values representing the control points (required for the FIG3.1 file format).
 java.awt.Point[] getSplinePoints()
           
 void rebuild()
          rebuild() re-calculates the bezier spline.
(package private)  int round(double x)
           
(package private)  void set_control_point(double x, double y, double l1, double l2, double theta1, double theta2, double t, FigBezier.ControlPoint cp)
          set one control point cp.
 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

wcp_spline

java.awt.Point[] wcp_spline

wcp1

java.awt.Point[] wcp1

cpp

FigBezier.ControlPoint[] cpp

PPMAX

static final int PPMAX
See Also:
Constant Field Values

pp

static java.awt.Point[] pp

ii

int ii

stack

double[][] stack

stack_p

int stack_p

T

final double T
See Also:
Constant Field Values

_2xPI

final double _2xPI
See Also:
Constant Field Values

_1dSQR2

final double _1dSQR2
See Also:
Constant Field Values

_SQR2

final double _SQR2
See Also:
Constant Field Values

M_PI_2

final double M_PI_2
See Also:
Constant Field Values
Constructor Detail

FigBezier

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

createRenderer

public void createRenderer()
Overrides:
createRenderer in class FigPolyline

round

final int round(double x)

getControlPoints

public double[] getControlPoints()
return a list of double values representing the control points (required for the FIG3.1 file format). The values are cpp[0](lx,ly,rx,ry), cpp[1](lx,ly,rx,ry) ...


getSplinePoints

public java.awt.Point[] getSplinePoints()

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

set_control_point

void set_control_point(double x,
                       double y,
                       double l1,
                       double l2,
                       double theta1,
                       double theta2,
                       double t,
                       FigBezier.ControlPoint cp)
set one control point cp. The parameter t is the tension in the interval 0 (no tension) .. 1 (high tension).


rebuild

public void rebuild()
rebuild() re-calculates the bezier spline.

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

copy

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

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