# TK_NURBS_Surface

## Functions

| `TK_NURBS_Surface`
| `~TK_NURBS_Surface`
`TK_Status` | `Read`
`TK_Status` | `Write`
`TK_Status` | `Clone`
`TK_Status` | `ReadAscii`
`TK_Status` | `WriteAscii`
void | `Reset`
void | `SetSurface`
void | `SetDSurface`
float const * | `GetPoints`
float * | `GetPoints`
double const * | `GetDPoints`
double * | `GetDPoints`
int | `GetUDegree`
int | `GetVDegree`
int | `GetUSize`
int | `GetVSize`
float const * | `GetWeights`
float * | `GetWeights`
float const * | `GetUKnots`
float * | `GetUKnots`
float const * | `GetVKnots`
float * | `GetVKnots`
void | `SetOptions`
int | `GetOptions`
HT_NURBS_Trim * | `NewTrim`
HT_NURBS_Trim * | `GetTrims`

## Detailed Description

class TK_NURBS_Surface : public BBaseOpcodeHandler

  Handles the TKE_NURBS_Surface opcode.

  TK_NURBS_Surface provides support for writing/reading the TKE_NURBS_Surface opcode object to/from an HSF file.

  The HOOPS/3dGS scene-graph supports NURBS surface primitives

  Public Functions

  TK_NURBS_Surface()
  ~TK_NURBS_Surface()
  virtual TK_Status Read(BStreamFileToolkit &tk)

    Reads data from the toolkit buffer, decodes/decompresses it, and maps it to the opcode handlers data members. User-defined classes which need to write out custom data should utilize one of the available GetData() methods.

    Parameters

      tk – A reference to the BStreamFileToolkit object.

    Returns

      The result of the function call.

  virtual TK_Status Write(BStreamFileToolkit &tk)

    Encodes/compresses data and writes data to the toolkit buffer. User-defined classes which need to write out custom data should utilize one of the available PutData() methods, and first write out the opcode associated with the group of binary data followed by the data itself.

    Parameters

      tk – A reference to the BStreamFileToolkit object.

    Returns

      The result of the function call.

  virtual TK_Status Clone(BStreamFileToolkit &tk, BBaseOpcodeHandler **handler) const

    Copies the opcode handler

    Parameters

      - tk – A reference to the BStreamFileToolkit object.

      - handler – A pointer to the opcode handler object. Passed by reference.

    Returns

      The result of the function call.

  TK_Status ReadAscii(BStreamFileToolkit &tk)

    Deprecated.

  TK_Status WriteAscii(BStreamFileToolkit &tk)

    Deprecated.

  virtual void Reset()

    prepares the handler for reuse during reading or writing

  void SetSurface(int u_degree, int v_degree, int u_size, int v_size, float const points[] = 0, float const weights[] = 0, float const u_knots[] = 0, float const v_knots[] = 0)

    allocates all of the arrays that could be present in a nurbs surface (even if they are eventually left unused), and copies whatever data is given.

  void SetDSurface(int u_degree, int v_degree, int u_size, int v_size, double const points[] = 0, float const weights[] = 0, float const u_knots[] = 0, float const v_knots[] = 0)

    allocates all of the arrays that could be present in a nurbs surface (even if they are eventually left unused), and copies whatever data is given.

  inline float const *GetPoints() const

    returns a const pointer to the array of floats for control point coordinates

  inline float *GetPoints()

    returns a mutable pointer to the array of floats for control point coordinates

  inline double const *GetDPoints() const

    returns a const pointer to the array of doubles for control point coordinates

  inline double *GetDPoints()

    returns a mutable pointer to the array of doubles for control point coordinates

  inline int GetUDegree() const

    gets the degree in the U direction of the NURBS Surface.

  inline int GetVDegree() const

    gets the degree in the V direction of the NURBS Surface. Note that it need not be the same as the U direction (e.g. a cylinder is linear in one direction)

  inline int GetUSize() const

    gets the number of control points in the U direction

  inline int GetVSize() const

    gets the number of control points in the V direction

  inline float const *GetWeights() const

    returns a const pointer to the array of weights to apply to the control points

  inline float *GetWeights()

    returns a mutable pointer to the array of weights to apply to the control points

  inline float const *GetUKnots() const

    returns a const pointer to the array of floats for the surface knot vector in the u direction. Of length GetUDegree() + GetUSize() + 1.

  inline float *GetUKnots()

    returns a mutable pointer to the array of floats for the surface knot vector in the u direction. Of length GetUDegree() + GetUSize() + 1.

  inline float const *GetVKnots() const

    returns a const pointer to the array of floats for the surface knot vector in the v direction. Of length GetVDegree() + GetVSize() + 1.

  inline float *GetVKnots()

    returns a mutable pointer to the array of floats for the surface knot vector in the v direction. Of length GetVDegree() + GetVSize() + 1.

  inline void SetOptions(int o)

    sets the bit flags to indicate the presence of the various optional values of the NURBS Surface. Currently defined bit values are NS_HAS_WEIGHTS, NS_HAS_KNOTS, and NS_HAS_TRIMS.

  inline int GetOptions() const

    gets the bit flags to indicate the presence of the various optional values of the NURBS Surface. Currently defined bit values are NS_HAS_WEIGHTS, NS_HAS_KNOTS, and NS_HAS_TRIMS.

  HT_NURBS_Trim *NewTrim(int type = 0)

    creates a new instance of an HT_NURBS_Trim object to handle trims

  inline HT_NURBS_Trim *GetTrims()

    returns a mutable pointer to the head of the linked list of trims