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 * | GetKnots () |
HT_NURBS_Trim const * | GetList () const |
HT_NURBS_Trim * | GetList () |
HT_NURBS_Trim * | GetNext (void) |
int | GetOptions () const |
float const * | GetPoints () const |
float * | GetPoints () |
int | GetType () const |
float const * | GetWeights () const |
float * | GetWeights () |
TK_Status | Read (BStreamFileToolkit &tk) |
TK_Status | read_collection_ascii (BStreamFileToolkit &tk) |
TK_Status | ReadAscii (BStreamFileToolkit &tk) |
Deprecated. | |
void | SetCollection () |
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) |
void | SetList (HT_NURBS_Trim *node) |
void | SetNext (HT_NURBS_Trim *next) |
void | SetOptions (int o) |
void | SetPoly (int count, float const *points=0) |
TK_Status | Write (BStreamFileToolkit &tk) |
TK_Status | write_collection_ascii (BStreamFileToolkit &tk) |
TK_Status | WriteAscii (BStreamFileToolkit &tk) |
Deprecated. | |
Protected Member Functions | |
TK_Status | read_collection (BStreamFileToolkit &tk) |
TK_Status | write_collection (BStreamFileToolkit &tk) |
Protected Attributes | |
int | m_count |
HT_NURBS_Trim * | m_current_trim |
unsigned char | m_degree |
float | m_end_u |
float * | m_knots |
HT_NURBS_Trim * | m_list |
HT_NURBS_Trim * | m_next |
unsigned char | m_options |
float * | m_points |
float | m_start_u |
int | m_substage |
unsigned char | m_type |
float * | m_weights |
Friends | |
class | TK_NURBS_Surface |
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.
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* 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* 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* 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.
tk | A reference to the BStreamFileToolkit object. |
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.
tk | A reference to the BStreamFileToolkit object. |
Implements BBaseOpcodeHandler.
TK_Status HT_NURBS_Trim::write_collection | ( | BStreamFileToolkit & | tk | ) | [protected] |
internal use; writes the pieces of a collection
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