Main repository of MikuMikuStudio
Revision | 0a55da2cbe4719e8fbe5711c63c3f56a956343c6 (tree) |
---|---|
Time | 2004-01-07 11:49:38 |
Author | mojomonkey <mojomonkey@75d0...> |
Commiter | mojomonkey |
documentation
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@208 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
@@ -36,18 +36,37 @@ import com.jme.math.Vector3f; | ||
36 | 36 | import com.jme.system.JmeException; |
37 | 37 | |
38 | 38 | /** |
39 | - * <code>Curve</code> | |
39 | + * <code>Curve</code> defines a collection of points that make up a curve. | |
40 | + * How this curve is constructed is undefined, and the job of a subclass. | |
41 | + * <code>Curve</code> is abstract only maintaining the point collection. It | |
42 | + * defines <code>getPoint</code> and <code>getOrientation</code>. Extending | |
43 | + * classes are responsible for implementing these methods in the appropriate | |
44 | + * way. | |
40 | 45 | * @author Mark Powell |
41 | - * @version $Id: Curve.java,v 1.4 2004-01-06 20:54:22 mojomonkey Exp $ | |
46 | + * @version $Id: Curve.java,v 1.5 2004-01-07 02:49:38 mojomonkey Exp $ | |
42 | 47 | */ |
43 | 48 | public abstract class Curve { |
44 | 49 | |
50 | + /** | |
51 | + * The array of control points. | |
52 | + */ | |
45 | 53 | protected Vector3f[] controlPoints; |
46 | 54 | |
55 | + /** | |
56 | + * Constructor creates a default <code>Curve</code> object with a | |
57 | + * zero size array for the points. | |
58 | + * | |
59 | + */ | |
47 | 60 | public Curve() { |
48 | 61 | controlPoints = new Vector3f[0]; |
49 | 62 | } |
50 | 63 | |
64 | + /** | |
65 | + * Constructor creates a <code>Curve</code> object. The control | |
66 | + * point list is set during creation. If the control point list is | |
67 | + * null or has fewer than 2 points, an exception is thrown. | |
68 | + * @param controlPoints the points that define the curve. | |
69 | + */ | |
51 | 70 | public Curve(Vector3f[] controlPoints) { |
52 | 71 | if (null == controlPoints) { |
53 | 72 | throw new JmeException("Control Points may not be null."); |
@@ -60,6 +79,13 @@ public abstract class Curve { | ||
60 | 79 | this.controlPoints = controlPoints; |
61 | 80 | } |
62 | 81 | |
82 | + /** | |
83 | + * | |
84 | + * <code>setControlPoints</code> sets the control point list that | |
85 | + * defines the curve. If the control point list is null or has | |
86 | + * fewer than 2 points, an exception is thrown. | |
87 | + * @param controlPoints the points that define the curve. | |
88 | + */ | |
63 | 89 | public void setControlPoints(Vector3f[] controlPoints) { |
64 | 90 | if (null == controlPoints) { |
65 | 91 | throw new JmeException("Control Points may not be null."); |
@@ -72,12 +98,52 @@ public abstract class Curve { | ||
72 | 98 | this.controlPoints = controlPoints; |
73 | 99 | } |
74 | 100 | |
101 | + /** | |
102 | + * | |
103 | + * <code>getControlPoints</code> retrieves the list of points that | |
104 | + * defines the curve. | |
105 | + * @return the point list that defines the curve. | |
106 | + */ | |
75 | 107 | public Vector3f[] getControlPoints() { |
76 | 108 | return controlPoints; |
77 | 109 | } |
78 | 110 | |
111 | + /** | |
112 | + * | |
113 | + * <code>getPoint</code> calculates a point on the curve based on | |
114 | + * the time, where time is [0, 1]. How the point is calculated is | |
115 | + * defined by the subclass. | |
116 | + * @param time the time frame on the curve, [0, 1]. | |
117 | + * @return the point on the curve at a specified time. | |
118 | + */ | |
79 | 119 | public abstract Vector3f getPoint(float time); |
80 | 120 | |
121 | + /** | |
122 | + * | |
123 | + * <code>getOrientation</code> calculates a rotation matrix that | |
124 | + * defines the orientation along a curve. How the matrix is | |
125 | + * calculated is defined by the subclass. | |
126 | + * @param time the time frame on the curve, [0, 1]. | |
127 | + * @param precision the accuracy of the orientation (lower is more | |
128 | + * precise). Recommended (0.1). | |
129 | + * @return the rotational matrix that defines the orientation of | |
130 | + * along a curve. | |
131 | + */ | |
81 | 132 | public abstract Matrix3f getOrientation(float time, float precision); |
133 | + | |
134 | + /** | |
135 | + * | |
136 | + * <code>getOrientation</code> calculates a rotation matrix that | |
137 | + * defines the orientation along a curve. The up vector is provided | |
138 | + * keeping the orientation from "rolling" along the curve. This is | |
139 | + * useful for camera tracks. How the matrix is calculated is defined | |
140 | + * by the subclass. | |
141 | + * @param time the time frame on the curve, [0, 1]. | |
142 | + * @param precision the accuracy of the orientation (lower is more | |
143 | + * precise). Recommended (0.1). | |
144 | + * @param up the up vector to lock. | |
145 | + * @return the rotational matrix that defines the orientation of | |
146 | + * along a curve. | |
147 | + */ | |
82 | 148 | public abstract Matrix3f getOrientation(float time, float precision, Vector3f up); |
83 | 149 | } |