Package toxi.geom.nurbs
Class BasicNurbsCurve
java.lang.Object
toxi.geom.nurbs.BasicNurbsCurve
- All Implemented Interfaces:
Cloneable
,NurbsCurve
A Basic implementation of a NurbsCurve.
- Version:
- 1.0
- Author:
- sg
-
Constructor Summary
ConstructorDescriptionBasicNurbsCurve
(Vec4D[] cps, float[] uK, int degree) Create a Nurbs Curve from the given Controlpoints, Knots and degree.
[TODO Validate Input, part of it is done by creating the KnotVector]BasicNurbsCurve
(Vec4D[] cps, KnotVector uKnots) Generate a Nurbs from the given Controlpoints and the given Knotvector.
[TODO validate input] -
Method Summary
Modifier and TypeMethodDescriptionVec4D[][]
curveDerivCpts
(int d, int r1, int r2) Computes control points of dth derivative
Piegel, L.Vec3D[]
derivativesOnCurve
(float u, int grade) Vec3D[]
derivativesOnCurve
(float u, int grade, Vec3D[] derivs) Vec4D[]
Get the ControlPoints of this curveint
Get the Degree of the curvefloat[]
getKnots()
Gets the Knot values of the Nurbs curvepointOnCurve
(float u) Calculate point on surface for the given u valuepointOnCurve
(float u, Vec3D out) Calculate point on surface for the given u valuetoPolygon2D
(int res)
-
Constructor Details
-
BasicNurbsCurve
Create a Nurbs Curve from the given Controlpoints, Knots and degree.
[TODO Validate Input, part of it is done by creating the KnotVector]- Parameters:
cps
- Array of ControlpointsuK
- Knot valuesdegree
- Degree of the Nurbs Curve
-
BasicNurbsCurve
Generate a Nurbs from the given Controlpoints and the given Knotvector.
[TODO validate input]- Parameters:
cps
- Array of ControlpointsuKnots
- Knotvector of the Nurbs
-
-
Method Details
-
curveDerivCpts
Description copied from interface:NurbsCurve
Computes control points of dth derivative
Piegel, L. The Nurbs Book
Algorithm A3.3 -> Page 98
- Specified by:
curveDerivCpts
in interfaceNurbsCurve
- Parameters:
d
- - dth derivativer1
- - from control point (0 for all control points)r2
- - to control point (n for all control points)- Returns:
- Vec4D[k][i] kth derivative, ith control point
-
derivativesOnCurve
- Specified by:
derivativesOnCurve
in interfaceNurbsCurve
-
derivativesOnCurve
- Specified by:
derivativesOnCurve
in interfaceNurbsCurve
-
getControlPoints
Description copied from interface:NurbsCurve
Get the ControlPoints of this curve- Specified by:
getControlPoints
in interfaceNurbsCurve
- Returns:
- the ordered ControlPoints
-
getDegree
public int getDegree()Description copied from interface:NurbsCurve
Get the Degree of the curve- Specified by:
getDegree
in interfaceNurbsCurve
- Returns:
- degree of curve
-
getKnots
public float[] getKnots()Description copied from interface:NurbsCurve
Gets the Knot values of the Nurbs curve- Specified by:
getKnots
in interfaceNurbsCurve
- Returns:
- knot values
-
getKnotVector
- Specified by:
getKnotVector
in interfaceNurbsCurve
-
pointOnCurve
Description copied from interface:NurbsCurve
Calculate point on surface for the given u value- Specified by:
pointOnCurve
in interfaceNurbsCurve
- Parameters:
u
- value to calculate point of- Returns:
- calculated Point
-
pointOnCurve
Description copied from interface:NurbsCurve
Calculate point on surface for the given u value- Specified by:
pointOnCurve
in interfaceNurbsCurve
- Parameters:
u
- value to calculate point ofout
- Point to place result in
-
toPolygon2D
- Specified by:
toPolygon2D
in interfaceNurbsCurve
-