Class BasicNurbsCurve

java.lang.Object
toxi.geom.nurbs.BasicNurbsCurve
All Implemented Interfaces:
Cloneable, NurbsCurve

public class BasicNurbsCurve extends Object implements NurbsCurve, Cloneable
A Basic implementation of a NurbsCurve.
Version:
1.0
Author:
sg
  • Constructor Details

    • BasicNurbsCurve

      public BasicNurbsCurve(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]
      Parameters:
      cps - Array of Controlpoints
      uK - Knot values
      degree - Degree of the Nurbs Curve
    • BasicNurbsCurve

      public BasicNurbsCurve(Vec4D[] cps, KnotVector uKnots)
      Generate a Nurbs from the given Controlpoints and the given Knotvector.
      [TODO validate input]
      Parameters:
      cps - Array of Controlpoints
      uKnots - Knotvector of the Nurbs
  • Method Details

    • curveDerivCpts

      public Vec4D[][] curveDerivCpts(int d, int r1, int r2)
      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 interface NurbsCurve
      Parameters:
      d - - dth derivative
      r1 - - 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

      public Vec3D[] derivativesOnCurve(float u, int grade)
      Specified by:
      derivativesOnCurve in interface NurbsCurve
    • derivativesOnCurve

      public Vec3D[] derivativesOnCurve(float u, int grade, Vec3D[] derivs)
      Specified by:
      derivativesOnCurve in interface NurbsCurve
    • getControlPoints

      public Vec4D[] getControlPoints()
      Description copied from interface: NurbsCurve
      Get the ControlPoints of this curve
      Specified by:
      getControlPoints in interface NurbsCurve
      Returns:
      the ordered ControlPoints
    • getDegree

      public int getDegree()
      Description copied from interface: NurbsCurve
      Get the Degree of the curve
      Specified by:
      getDegree in interface NurbsCurve
      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 interface NurbsCurve
      Returns:
      knot values
    • getKnotVector

      public KnotVector getKnotVector()
      Specified by:
      getKnotVector in interface NurbsCurve
    • pointOnCurve

      public Vec3D pointOnCurve(float u)
      Description copied from interface: NurbsCurve
      Calculate point on surface for the given u value
      Specified by:
      pointOnCurve in interface NurbsCurve
      Parameters:
      u - value to calculate point of
      Returns:
      calculated Point
    • pointOnCurve

      public Vec3D pointOnCurve(float u, Vec3D out)
      Description copied from interface: NurbsCurve
      Calculate point on surface for the given u value
      Specified by:
      pointOnCurve in interface NurbsCurve
      Parameters:
      u - value to calculate point of
      out - Point to place result in
    • toPolygon2D

      public Polygon2D toPolygon2D(int res)
      Specified by:
      toPolygon2D in interface NurbsCurve