Alphabetical Class Index   Class Hierarchy   Compound Members   File Members   File List  

Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
HT_NURBS_Trim Class Reference

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

#include <BOpcodeHandler.h>

Public Member Functions

int GetCount () const
 
int GetDegree () const
 
float const * GetKnots () const
 
float alterGetKnots () alter
 
HT_NURBS_Trim const * GetList () const
 
HT_NURBS_TrimGetList () alter
 
HT_NURBS_TrimGetNext (void)
 
int GetOptions () const
 
float const * GetPoints () const
 
float alterGetPoints () alter
 
int GetType () const
 
float const * GetWeights () const
 
float alterGetWeights () alter
 
TK_Status Read (BStreamFileToolkit &tk) alter
 
TK_Status read_collection_ascii (BStreamFileToolkit &tk) alter
 
TK_Status ReadAscii (BStreamFileToolkit &tk) alter
 Deprecated.
 
void SetCollection () alter
 
void 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) alter
 
void SetList (HT_NURBS_Trim *node) alter
 
void SetNext (HT_NURBS_Trim *next)
 
void SetOptions (int o) alter
 
void SetPoly (int count, float const *points=0) alter
 
TK_Status Write (BStreamFileToolkit &tk) alter
 
TK_Status write_collection_ascii (BStreamFileToolkit &tk) alter
 
TK_Status WriteAscii (BStreamFileToolkit &tk) alter
 Deprecated.
 
- Public Member Functions inherited from BBaseOpcodeHandler
 BBaseOpcodeHandler (int op)
 
virtual TK_Status Clone (BStreamFileToolkit &tk, BBaseOpcodeHandler **handler) const
 
virtual TK_Status Execute (BStreamFileToolkit &tk) alter
 
char const * GetLoggingString () const
 
char alterGetLoggingString () alter
 
virtual TK_Status Interpret (BStreamFileToolkit &tk, ID_Key key, int variant=0) alter
 
virtual TK_Status Interpret (BStreamFileToolkit &tk, ID_Key key, char const *special) alter
 
void LogDebug (BStreamFileToolkit &tk, char const *string=0) alter
 
virtual bool Match_Instance (BStreamFileToolkit const &tk, Recorded_Instance alter *instance) alter
 
virtual bool NeedsContext (BStreamFileToolkit &tk) const
 
bool NeedsTag () const
 
unsigned char Opcode () const
 
int Pass (BStreamFileToolkit &tk) const
 
virtual void Reset () alter
 
void SetLoggingString (char const *segment) alter
 
void SetLoggingString (int length) alter
 
void SetNeedsTag (bool n) alter
 
TK_Status Tag (BStreamFileToolkit &tk, int variant=-1) const
 
bool Tagging (BStreamFileToolkit &tk) const
 
- Public Member Functions inherited from BControlledMemoryObject
void operator delete (void *p)
 force deallocation to happen in the stream toolkit's scope
 
void * operator new (size_t size)
 force allocation to happen in the stream toolkit's scope
 

Protected Member Functions

TK_Status read_collection (BStreamFileToolkit &tk)
 
TK_Status write_collection (BStreamFileToolkit &tk)
 
- Protected Member Functions inherited from BBaseOpcodeHandler
void add_segment (BStreamFileToolkit &tk, ID_Key key) alter
 for internal use only
 
void adjust_written (BStreamFileToolkit &tk, int count) alter
 for internal use only
 
void bytes_to_floats (unsigned char const *in, float alter *out, int count) const
 for internal use only
 
void decrease_nesting (BStreamFileToolkit &tk, int amount=1) alter
 for internal use only
 
bool Find_Instance (BStreamFileToolkit &tk, int val1, int val2, int val3) alter
 
bool Find_Item (BStreamFileToolkit &tk, ID_Key key) const
 
void fix (int *i, int n)
 for internal use only
 
void fix (short *s, int n)
 for internal use only
 
void fix_in (float *f, int n)
 for internal use only
 
void fix_out (float *f, int n)
 for internal use only
 
short flip (short s)
 for internal use only
 
int flip (int i)
 for internal use only
 
void floats_to_bytes (float const *in, unsigned char alter *out, int count) const
 for internal use only
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, int *rInts, unsigned int n) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, unsigned char &value) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, char &value) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, unsigned short &value) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, short &value) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, int &value) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, float &value) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, float *rFloats, unsigned int n) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, char *m_string, unsigned int n) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, unsigned char *m_string, unsigned int n) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, int *rInts, unsigned int n) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, short *rShorts, unsigned int n) alter
 
TK_Status GetAsciiData (BStreamFileToolkit &tk, const char *tag, unsigned short *rShorts, unsigned int n) alter
 
TK_Status GetAsciiHex (BStreamFileToolkit &tk, const char *tag, unsigned char &value) alter
 
TK_Status GetAsciiHex (BStreamFileToolkit &tk, const char *tag, int &value) alter
 
TK_Status GetAsciiHex (BStreamFileToolkit &tk, const char *tag, char &value) alter
 
TK_Status GetAsciiHex (BStreamFileToolkit &tk, const char *tag, unsigned short &value) alter
 
TK_Status GetAsciiImageData (BStreamFileToolkit &tk, const char *tag, unsigned char *rValues, unsigned int n) alter
 
TK_Status GetData (BStreamFileToolkit &tk, char *b, int n) alter
 
TK_Status GetData (BStreamFileToolkit &tk, short *s, int n) alter
 
TK_Status GetData (BStreamFileToolkit &tk, int *i, int n) alter
 
TK_Status GetData (BStreamFileToolkit &tk, float *f, int n) alter
 
TK_Status GetData (BStreamFileToolkit &tk, unsigned char *b, int n) alter
 
TK_Status GetData (BStreamFileToolkit &tk, unsigned short *s, int n) alter
 
TK_Status GetData (BStreamFileToolkit &tk, unsigned int *i, int n) alter
 
TK_Status GetData (BStreamFileToolkit &tk, char &c) alter
 
TK_Status GetData (BStreamFileToolkit &tk, short &s) alter
 
TK_Status GetData (BStreamFileToolkit &tk, int &i) alter
 
TK_Status GetData (BStreamFileToolkit &tk, unsigned char &b) alter
 
TK_Status GetData (BStreamFileToolkit &tk, unsigned short &s) alter
 
TK_Status GetData (BStreamFileToolkit &tk, unsigned int &i) alter
 
TK_Status GetData (BStreamFileToolkit &tk, float &f) alter
 
void increase_nesting (BStreamFileToolkit &tk, int amount=1) alter
 for internal use only
 
ID_Key last_key (BStreamFileToolkit &tk) const
 obsolete
 
void log_opcode (BStreamFileToolkit &tk, unsigned int sequence, unsigned char opcode) alter
 for internal use only
 
TK_Status LookatData (BStreamFileToolkit &tk, unsigned char &b) alter
 
BBaseOpcodeHandler alterOpcode_Handler (BStreamFileToolkit &tk, unsigned char op) const
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, char const *b, int n) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, short const *s, int n) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, int const *i, int n) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, float const *f, int n) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, unsigned char const *b, int n) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, unsigned short const *s, int n) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, unsigned int const *i, int n) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, char const &c) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, short const &s) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, int const &i) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, unsigned char const &b) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, unsigned short const &s) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, unsigned int const &i) alter
 
TK_Status PutAsciiData (BStreamFileToolkit &tk, char const *tag, float const &f) alter
 
TK_Status PutAsciiFlag (BStreamFileToolkit &tk, char const *tag, int const &i) alter
 
TK_Status PutAsciiHex (BStreamFileToolkit &tk, char const *tag, int const &i) alter
 
TK_Status PutAsciiMask (BStreamFileToolkit &tk, char const *tag, int const &i) alter
 
TK_Status PutAsciiOpcode (BStreamFileToolkit &tk, int adjust=1, bool is_end=false, bool want_newline=true) alter
 
TK_Status PutData (BStreamFileToolkit &tk, char const *b, int n) alter
 
TK_Status PutData (BStreamFileToolkit &tk, short const *s, int n) alter
 
TK_Status PutData (BStreamFileToolkit &tk, int const *i, int n) alter
 
TK_Status PutData (BStreamFileToolkit &tk, float const *f, int n) alter
 
TK_Status PutData (BStreamFileToolkit &tk, unsigned char const *b, int n) alter
 
TK_Status PutData (BStreamFileToolkit &tk, unsigned short const *s, int n) alter
 
TK_Status PutData (BStreamFileToolkit &tk, unsigned int const *i, int n) alter
 
TK_Status PutData (BStreamFileToolkit &tk, char const &c) alter
 
TK_Status PutData (BStreamFileToolkit &tk, short const &s) alter
 
TK_Status PutData (BStreamFileToolkit &tk, int const &i) alter
 
TK_Status PutData (BStreamFileToolkit &tk, unsigned char const &b) alter
 
TK_Status PutData (BStreamFileToolkit &tk, unsigned short const &s) alter
 
TK_Status PutData (BStreamFileToolkit &tk, unsigned int const &i) alter
 
TK_Status PutData (BStreamFileToolkit &tk, float const &f) alter
 
TK_Status PutEndXMLTag (BStreamFileToolkit &tk, char const *tag) alter
 
TK_Status PutOpcode (BStreamFileToolkit &tk, int adjust=1) alter
 
TK_Status PutStartXMLTag (BStreamFileToolkit &tk, char const *tag) alter
 
TK_Status Read_Referenced_Segment (BStreamFileToolkit &tk, int &i_progress) alter
 
TK_Status ReadAsciiLine (BStreamFileToolkit &tk, unsigned int *readSize=0) alter
 
TK_Status ReadAsciiWord (BStreamFileToolkit &tk, unsigned int *readSize=0) alter
 
TK_Status ReadEndOpcode (BStreamFileToolkit &tk) alter
 
void Record_Instance (BStreamFileToolkit &tk, ID_Key key, int variant, int val1, int val2, int val3) const
 
void Remember_Item (BStreamFileToolkit &tk, ID_Key key) const
 
ID_Key remove_segment (BStreamFileToolkit &tk) alter
 for internal use only
 
bool RemoveAngularBrackets (char *string) alter
 
bool RemoveQuotes (char *string) alter
 
void Revisit (BStreamFileToolkit &tk, float priority=0.0f, int variant=0) const
 
void set_last_key (BStreamFileToolkit &tk, ID_Key key) alter
 sets the given key as "most recent" on the toolkit for the purposes of associating keys with indices
 
TK_Status SkipNewlineAndTabs (BStreamFileToolkit &tk, unsigned int *readSize=0) alter
 
bool validate_count (int count, int limit=1<< 24) const
 

Protected Attributes

int m_count
 
HT_NURBS_Trimm_current_trim
 
unsigned char m_degree
 
float m_end_u
 
float * m_knots
 
HT_NURBS_Trimm_list
 
HT_NURBS_Trimm_next
 
unsigned char m_options
 
float * m_points
 
float m_start_u
 
int m_substage
 
unsigned char m_type
 
float * m_weights
 
- Protected Attributes inherited from BBaseOpcodeHandler
char * m_ascii_buffer
 
int m_ascii_length
 
int m_ascii_progress
 Tracks the amount of data that has been read/written so far by GetAscii functions.
 
int m_ascii_size
 
int m_ascii_stage
 
unsigned char m_byte
 temporary
 
char m_char
 temporary
 
int m_debug_allocated
 
int m_debug_length
 
char * m_debug_string
 
int m_int
 temporary
 
bool m_needs_tag
 Indicate if this object explicitly needs tagging.
 
unsigned char m_opcode
 The opcode being handled by this particular object.
 
int m_progress
 Tracks the amount of data that has been read/written so far.
 
int m_stage
 The writing stage.
 
unsigned short m_unsigned_short
 temporary
 

Friends

class TK_NURBS_Surface
 

Additional Inherited Members

- Static Protected Member Functions inherited from BBaseOpcodeHandler
static float read_float (char const *cp, char const *alter *newcpp=0)
 
static float read_float (char const *cp, char alter *alter *newcpp)
 for internal use only
 
static char * write_float (char *buffer, double f)
 for internal use only
 

Detailed Description

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.

Member Function Documentation

int HT_NURBS_Trim::GetCount ( ) const
inline

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

int HT_NURBS_Trim::GetDegree ( ) const
inline

(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.

References TK_NURBS_Surface::m_degree.

float const* HT_NURBS_Trim::GetKnots ( ) const
inline

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

float alter* HT_NURBS_Trim::GetKnots ( )
inline

(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
inline

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

HT_NURBS_Trim* HT_NURBS_Trim::GetList ( )
inline

(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.

HT_NURBS_Trim* HT_NURBS_Trim::GetNext ( void  )
inline

gets the next trim in the list

int HT_NURBS_Trim::GetOptions ( ) const
inline

(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::GetPoints ( ) const
inline

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

float alter* HT_NURBS_Trim::GetPoints ( )
inline

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

int HT_NURBS_Trim::GetType ( ) const
inline

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

float const* HT_NURBS_Trim::GetWeights ( ) const
inline

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

References TK_NURBS_Surface::m_weights.

float alter* HT_NURBS_Trim::GetWeights ( )
inline

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

References TK_NURBS_Surface::m_weights.

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
tkA reference to the BStreamFileToolkit object.
Returns
The result of the function call.

Implements BBaseOpcodeHandler.

TK_Status HT_NURBS_Trim::read_collection ( BStreamFileToolkit tk)
protected

internal use; reads the pieces of a collection

void HT_NURBS_Trim::SetCollection ( )

Configures *this to read or write a trim collection

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::SetList ( HT_NURBS_Trim node)
inline

sets the head of the list of a NS_TRIM_COLLECTION.

void HT_NURBS_Trim::SetNext ( HT_NURBS_Trim next)
inline

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

void HT_NURBS_Trim::SetOptions ( int  o)
inline

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

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.

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
tkA reference to the BStreamFileToolkit object.
Returns
The result of the function call.

Implements BBaseOpcodeHandler.

TK_Status HT_NURBS_Trim::write_collection ( BStreamFileToolkit tk)
protected

internal use; writes the pieces of a collection

Member Data Documentation

int HT_NURBS_Trim::m_count
protected

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

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.

unsigned char HT_NURBS_Trim::m_degree
protected

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.

float HT_NURBS_Trim::m_end_u
protected

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. Valid only if options contains the NS_TRIM_HAS_START bit.

float* HT_NURBS_Trim::m_knots
protected

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

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_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_options
protected

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_points
protected

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.

float HT_NURBS_Trim::m_start_u
protected

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. Valid only if options contains the NS_TRIM_HAS_START bit.

int HT_NURBS_Trim::m_substage
protected

internal use; tracks progress during reading and writing

unsigned char HT_NURBS_Trim::m_type
protected

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.

float* HT_NURBS_Trim::m_weights
protected

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


The documentation for this class was generated from the following file: