/** * Creates a new <code>Point</code> from the given control point indices. It will have the name <code>point</code>, * no normals, colour or texture, these can be added to the returned point if needed. * * @param start * The index of the control point to start from, must be greater than or equal to one and less than * <code>end</code>. * @param end * The index of the control point to end with, must be less than {@link #getControlPointCount() * controlPointCount} minus one and greater than <code>start</code>. * @param steps * The number of iterations to perform between control points, the higher this number the more points * will be shown, but it will also contain more vertices, must be greater than one. * @return A <code>Point</code> containing all the curve points, will not be <code>null</code>. */ public Point toRenderablePoint(final int start, final int end, final int steps) { final Vector3[] points = toVector3(start, end, steps); return new Point("point", points, null, null, null); }
/** * Creates a new <code>Point</code> from the given control point indices. It will have the name <code>point</code>, * no normals, colour or texture, these can be added to the returned point if needed. * * @param start * The index of the control point to start from, must be greater than or equal to one and less than * <code>end</code>. * @param end * The index of the control point to end with, must be less than {@link #getControlPointCount() * controlPointCount} minus one and greater than <code>start</code>. * @param steps * The number of iterations to perform between control points, the higher this number the more points * will be shown, but it will also contain more vertices, must be greater than one. * @return A <code>Point</code> containing all the curve points, will not be <code>null</code>. */ public Point toRenderablePoint(final int start, final int end, final int steps) { final Vector3[] points = toVector3(start, end, steps); return new Point("point", points, null, null, null); }
/** * Calculates the length between the given control point indices. * <p> * <strong>Important note:</strong><br /> * See the Javadoc for the {@link #getApproximateLength(int)} method for important information. * </p> * * @param start * The index of the control point to start from, must be greater than or equal to one and less than * <code>end</code>. * @param end * The index of the control point to end with, must be less than {@link #getControlPointCount() * controlPointCount} minus one and greater than <code>start</code>. * @param steps * The number of iterations to perform between control points, the higher this number the more accurate * the returned result will be. * @return The length between the given control points. * @see #getApproximateLength(int) */ public double getApproximateLength(final int start, final int end, final int steps) { double length = 0.0; final Vector3[] vectors = toVector3(start, end, steps); for (int i = 0; i < (vectors.length - 1); i++) { length += vectors[i].distance(vectors[i + 1]); } return length; }
/** * Calculates the length between the given control point indices. * <p> * <strong>Important note:</strong><br /> * See the Javadoc for the {@link #getApproximateLength(int)} method for important information. * </p> * * @param start * The index of the control point to start from, must be greater than or equal to one and less than * <code>end</code>. * @param end * The index of the control point to end with, must be less than {@link #getControlPointCount() * controlPointCount} minus one and greater than <code>start</code>. * @param steps * The number of iterations to perform between control points, the higher this number the more accurate * the returned result will be. * @return The length between the given control points. * @see #getApproximateLength(int) */ public double getApproximateLength(final int start, final int end, final int steps) { double length = 0.0; final Vector3[] vectors = toVector3(start, end, steps); for (int i = 0; i < (vectors.length - 1); i++) { length += vectors[i].distance(vectors[i + 1]); } return length; }
/** * Creates a new <code>Line</code> from the given control point indices. It will have the name <code>curve</code>, * no normals, colour or texture, these can be added to the returned line if needed. * * @param start * The index of the control point to start from, must be greater than or equal to one and less than * <code>end</code>. * @param end * The index of the control point to end with, must be less than {@link #getControlPointCount() * controlPointCount} minus one and greater than <code>start</code>. * @param steps * The number of iterations to perform between control points, the higher this number the smoother the * returned line will be, but it will also contain more vertices, must be greater than one. * @return A <code>Line</code> representing this curve, will not be <code>null</code>. */ public Line toRenderableLine(final int start, final int end, final int steps) { final Vector3[] vertex = toVector3(start, end, steps); final Vector3[] normal = null; final ColorRGBA[] color = null; final Vector2[] texture = null; final Line line = new Line("curve", vertex, normal, color, texture); line.getMeshData().setIndexMode(IndexMode.LineStrip); return line; }
/** * Creates a new <code>Line</code> from the given control point indices. It will have the name <code>curve</code>, * no normals, colour or texture, these can be added to the returned line if needed. * * @param start * The index of the control point to start from, must be greater than or equal to one and less than * <code>end</code>. * @param end * The index of the control point to end with, must be less than {@link #getControlPointCount() * controlPointCount} minus one and greater than <code>start</code>. * @param steps * The number of iterations to perform between control points, the higher this number the smoother the * returned line will be, but it will also contain more vertices, must be greater than one. * @return A <code>Line</code> representing this curve, will not be <code>null</code>. */ public Line toRenderableLine(final int start, final int end, final int steps) { final Vector3[] vertex = toVector3(start, end, steps); final Vector3[] normal = null; final ColorRGBA[] color = null; final Vector2[] texture = null; final Line line = new Line("curve", vertex, normal, color, texture); line.getMeshData().setIndexMode(IndexMode.LineStrip); return line; }