HT_NURBS_Trim

class HT_NURBS_Trim

Does not handle any top level opcodes, but rather only the trim types allowable on nurbs surfaces.

HT_NURBS_Trim is a helper class to handle reading and writing of the nurbs surface trims. Trims may be of type NS_TRIM_POLY, NS_TRIM_CURVE, or NS_TRIM_COLLECTION. In any case, though, all coordinates are specified with respect to the parameterization of the NURBS surface. This parameterization is always from 0 to 1 in each direction. Some solid modelers parameterize with respect to the contents of their knot vectors, meaning that coordinates may need to be rescaled. To do so, the formula is “u = (u - u_knots[u_degree]) / (u_knots[u_control_point_count] - knots[u_degree])”. Values coming out of HOOPS will already be properly scaled.

Inherits from: BBaseOpcodeHandler

Methods

HT_NURBS_Trim::HT_NURBS_Trim()

protected

TK_Status HT_NURBS_Trim::read_collection(BStreamFileToolkit &tk)

protected

internal use; reads the pieces of a collection

TK_Status HT_NURBS_Trim::write_collection(BStreamFileToolkit &tk)

protected

internal use; writes the pieces of a collection

HT_NURBS_Trim::~HT_NURBS_Trim()
void HT_NURBS_Trim::SetPoly(int count, float const points[] = 0)

allocates space for the coordinates (polyline vertices or curve control points), and copies values if they were given. Also handles initializing the type of this trim to NS_TRIM_POLY.

void HT_NURBS_Trim::SetCurve(int degree, int control_count, float const points[] = 0, float const weights[] = 0, float const knots[] = 0, float start_u = 0, float end_u = 1)

Configures *this to handle the reading or writing of a trim curve. Also handles initializing the type of this trim to NS_TRIM_CURVE.

void HT_NURBS_Trim::SetCollection()

Configures *this to read or write a trim collection

HT_NURBS_Trim *HT_NURBS_Trim::PrependCollection()

Prepends a trim to the internal trim collection

void HT_NURBS_Trim::SetOptions(int o)

sets the options bit flags to indicate the presence of all of the optional fields

void HT_NURBS_Trim::SetList(HT_NURBS_Trim *node)

sets the head of the list of a NS_TRIM_COLLECTION.

void HT_NURBS_Trim::SetNext(HT_NURBS_Trim *next)

sets the next pointer of a trim. Used for linked list management

void HT_NURBS_Trim::SetStart(float start)
void HT_NURBS_Trim::SetEnd(float end)
TK_Status HT_NURBS_Trim::Read(BStreamFileToolkit &tk)

virtual

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.
TK_Status HT_NURBS_Trim::Write(BStreamFileToolkit &tk)

virtual

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.
TK_Status HT_NURBS_Trim::ReadAscii(BStreamFileToolkit &tk)

Deprecated.

TK_Status HT_NURBS_Trim::WriteAscii(BStreamFileToolkit &tk)

Deprecated.

TK_Status HT_NURBS_Trim::read_collection_ascii(BStreamFileToolkit &tk)
TK_Status HT_NURBS_Trim::write_collection_ascii(BStreamFileToolkit &tk)
HT_NURBS_Trim *HT_NURBS_Trim::GetNext(void)

gets the next trim in the list

HT_NURBS_Trim const *HT_NURBS_Trim::GetNext(void) const

const

int HT_NURBS_Trim::GetType() const

const

gets an identifier for the trim type. Legal values are NS_TRIM_POLY, NS_TRIM_CURVE, and NS_TRIM_COLLECTION

int HT_NURBS_Trim::GetCount() const

const

(relevant to NS_TRIM_CURVE and NS_TRIM_POLY only), gets the number of vertices in the trim.

float const *HT_NURBS_Trim::GetPoints() const

const

(relevant to NS_TRIM_CURVE and NS_TRIM_POLY only), returns a const pointer to the vertices

float *HT_NURBS_Trim::GetPoints()

(relevant to NS_TRIM_CURVE and NS_TRIM_POLY only), returns a mutable pointer to the vertices

int HT_NURBS_Trim::GetDegree() const

const

(relevant to NS_TRIM_CURVE only), returns the degree of the trim curve. Note that this is not necessarily the same as the degree of the surface to be trimmed. (relevant to NS_TRIM_CURVE only), the start point of the trim curve. Parameter is specified in the range of 0 to 1.

float HT_NURBS_Trim::GetStart() const

const

(relevant to NS_TRIM_CURVE only), the end point of the trim curve. Parameter is specified in the range of 0 to 1.

float HT_NURBS_Trim::GetEnd() const

const

int HT_NURBS_Trim::GetOptions() const

const

(relevant to NS_TRIM_CURVE only), returns the options bit flags to indicate the presence of all of the optional fields

float const *HT_NURBS_Trim::GetWeights() const

const

(relevant to NS_TRIM_CURVE only), returns a const pointer to the control point weights

float *HT_NURBS_Trim::GetWeights()

(relevant to NS_TRIM_CURVE only), returns a mutable pointer to the control point weights

float const *HT_NURBS_Trim::GetKnots() const

const

(relevant to NS_TRIM_CURVE only), returns a const pointer to the trim curve’s knots

float *HT_NURBS_Trim::GetKnots()

(relevant to NS_TRIM_CURVE only), returns a mutable pointer to the trim curve’s knots

HT_NURBS_Trim const *HT_NURBS_Trim::GetList() const

const

(relevant to NS_TRIM_COLLECTION only), returns a const pointer the collection’s linked list

HT_NURBS_Trim *HT_NURBS_Trim::GetList()

(relevant to NS_TRIM_COLLECTION only), returns a mutable pointer the collection’s linked list. Note that SetList, not this function, must be used to make the head of the list point somewhere else.

Variables

int HT_NURBS_Trim::m_substage

protected

int

internal use; tracks progress during reading and writing

HT_NURBS_Trim *HT_NURBS_Trim::m_next

protected

internal use; the next trim in the list. The linked list is null-terminated, at which point a NS_TRIM_END will be written to the file.

unsigned char HT_NURBS_Trim::m_type

protected

unsigned char

internal use; an enumerated type to dictate which sort of trim we are dealing with. Legal values are NS_TRIM_POLY, NS_TRIM_CURVE and NS_TRIM_COLLECTION.

int HT_NURBS_Trim::m_count

protected

int

internal use; (relevant to NS_TRIM_CURVE and NS_TRIM_POLY only), this indicates either the number of points the primitive has

float *HT_NURBS_Trim::m_points

protected

float

internal use; (relevant to NS_TRIM_CURVE and NS_TRIM_POLY only), an array of floats for the points (uv pairs) of a trim curve or polyline. Should be of length 2*m_count.

unsigned char HT_NURBS_Trim::m_degree

protected

unsigned char

internal use; (relevant to NS_TRIM_CURVE only), indicates the degree of the trim curve. Note that this is not necessarily the same as the degree of the surface it is trimming.

unsigned char HT_NURBS_Trim::m_options

protected

unsigned char

internal use; (relevant to NS_TRIM_CURVE only), a bit field to indicate the presence of the various nurbs curve attributes. Anything not present is assumed to fall back to its default value: 0,1 for start and end, linearly increasing knots, and uniform weights.

float *HT_NURBS_Trim::m_weights

protected

float

internal use; (relevant to NS_TRIM_CURVE only), the control point weights of the trim curve. Present only if options contains the NS_TRIM_HAS_WEIGHTS bit

float *HT_NURBS_Trim::m_knots

protected

float

internal use; (relevant to NS_TRIM_CURVE only), the knots of the trim curve. Present only if options contains the NS_TRIM_HAS_KNOTS bit

float HT_NURBS_Trim::m_start_u

protected

float

internal use; (relevant to NS_TRIM_CURVE only), the start point of the trim curve. Parameter is specified in the range of 0 to 1.

float HT_NURBS_Trim::m_end_u

protected

float

internal use; (relevant to NS_TRIM_CURVE only), the end point of the trim curve. Parameter is specified in the range of 0 to 1.

HT_NURBS_Trim *HT_NURBS_Trim::m_list

protected

internal use; (relevant to NS_TRIM_COLLECTION only), the linked list of trims that make up the collection

HT_NURBS_Trim *HT_NURBS_Trim::m_current_trim

protected

internal use; (relevant to NS_TRIM_COLLECTION only), tracks progress during the read or write of a trim collection.