capi1.01
所属分类:图形图象
开发工具:Java
文件大小:501KB
下载次数:20
上传日期:2009-09-28 14:17:08
上 传 者:
gavinshen
说明: JAVA版本的spline,nurbs等代码,非常好用
(JAVA version of the spline, nurbs, etc. code, very easy to use)
文件列表:
capi\api (0, 2005-04-01)
capi\api\allclasses-frame.html (11142, 2005-08-10)
capi\api\allclasses-noframe.html (9602, 2005-08-10)
capi\api\com (0, 2005-04-01)
capi\api\com\graphbuilder (0, 2005-04-01)
capi\api\com\graphbuilder\curve (0, 2005-04-01)
capi\api\com\graphbuilder\curve\BezierCurve.html (22636, 2005-08-10)
capi\api\com\graphbuilder\curve\BinaryCurveApproximationAlgorithm.html (13177, 2005-08-10)
capi\api\com\graphbuilder\curve\BSpline.html (35210, 2005-08-10)
capi\api\com\graphbuilder\curve\CardinalSpline.html (18798, 2005-08-10)
capi\api\com\graphbuilder\curve\CatmullRomSpline.html (17072, 2005-08-10)
capi\api\com\graphbuilder\curve\ControlPath.html (25626, 2005-08-10)
capi\api\com\graphbuilder\curve\ControlStringParseException.html (18039, 2005-08-10)
capi\api\com\graphbuilder\curve\CubicBSpline.html (20586, 2005-08-10)
capi\api\com\graphbuilder\curve\Curve.html (24945, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files (0, 2005-04-01)
capi\api\com\graphbuilder\curve\doc-files\basic_idea.gif (2048, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\bezier1.gif (3913, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\bspline1.gif (4678, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\bspline2.gif (3745, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\cardinal1.gif (3079, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\cubicb1.gif (3465, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\cubicb2.gif (3244, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\cubicb3.gif (3467, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\lagrange1.gif (3552, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\lagrange2.gif (3506, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\lagrange3.gif (3271, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\lagrange4.gif (3904, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\natcubic1.gif (3200, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\natcubic2.gif (3444, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\nurbs1.gif (4264, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\nurbs2.gif (4583, 2005-08-10)
capi\api\com\graphbuilder\curve\doc-files\problem_case.gif (1747, 2005-08-10)
capi\api\com\graphbuilder\curve\GroupIterator.html (26158, 2005-08-10)
capi\api\com\graphbuilder\curve\LagrangeCurve.html (29253, 2005-08-10)
capi\api\com\graphbuilder\curve\MultiPath.html (24936, 2005-08-10)
capi\api\com\graphbuilder\curve\NaturalCubicSpline.html (19626, 2005-08-10)
capi\api\com\graphbuilder\curve\NURBSpline.html (24278, 2005-08-10)
capi\api\com\graphbuilder\curve\package-frame.html (3525, 2005-08-10)
capi\api\com\graphbuilder\curve\package-summary.html (12074, 2005-08-10)
... ...
Useful Information
------------------
The copyfiles.bat file is not required. It is used to copy only
the necessary files from the com.graphbuilder package hierarchy
that are required for the Curve API.
In the src directory, there is a makejar.bat file. This file will
compile the nested Java files and create a Jar file called Capi.jar.
Compilation requires Java 1.2 or higher. After the Jar file is
created, add it to the classpath. Note: CAPI comes with MESP (Math
Expression String Parser).
The following is a sample program:
import com.graphbuilder.curve.*;
public class CurveTest {
public static void main(String[] args) {
ControlPath cp = new ControlPath();
cp.addPoint(createPoint(0,0));
cp.addPoint(createPoint(10,10));
cp.addPoint(createPoint(20, 10));
cp.addPoint(createPoint(30,0));
cp.addCurve(new BezierCurve(cp, new GroupIterator("0:n-1", cp.numPoints())));
int dimension = 2;
MultiPath mp = new MultiPath(dimension);
mp.setFlatness(1.0); // default flatness is 1.0
for (int i = 0; i < cp.numCurves(); i++)
cp.getCurve(i).appendTo(mp);
for (int i = 0; i < mp.getNumPoints(); i++) {
double[] p = mp.get(i);
System.out.println(p[0] + ", " + p[1]);
}
}
private static Point createPoint(double x, double y) {
final double[] arr = new double[] { x, y };
return new Point() {
public double[] getLocation() {
return arr;
}
public void setLocation(double[] loc) {
arr[0] = loc[0];
arr[1] = loc[1];
}
};
}
}
The demo directory contains a GUI to the API. To run it first compile the
files and then run java CurveDemo. The demo also requires Java 1.2 or higher.
近期下载者:
相关文件:
收藏者: