.TH "SoNurbsCurve" 3 "Sat Oct 12 2013" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoNurbsCurve \- .PP The \fBSoNurbsCurve\fP class is a node for representing smooth curves\&. .PP A general explanation of NURBS is beyond the scope of the Coin documentation\&. For detailed information, refer to the specialized literature on the topic (for example 'An Introduction to NURBS: With Historical Perspective' by David F\&. Rogers)\&. A basic overview of curve and surface rendering using NURBS can be found in chapter 8 of 'The Inventor Mentor'\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBSoShape\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "virtual \fBSoType\fP \fBgetTypeId\fP (void) const " .br .RI "\fIReturns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. \fP" .ti -1c .RI "\fBSoNurbsCurve\fP (void)" .br .ti -1c .RI "virtual void \fBGLRender\fP (\fBSoGLRenderAction\fP *action)" .br .ti -1c .RI "virtual void \fBrayPick\fP (\fBSoRayPickAction\fP *action)" .br .ti -1c .RI "virtual void \fBgetPrimitiveCount\fP (\fBSoGetPrimitiveCountAction\fP *action)" .br .ti -1c .RI "virtual void \fBgetBoundingBox\fP (\fBSoGetBoundingBoxAction\fP *action)" .br .ti -1c .RI "void \fBsendPrimitive\fP (\fBSoAction\fP *, \fBSoPrimitiveVertex\fP *)" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static \fBSoType\fP \fBgetClassTypeId\fP (void)" .br .RI "\fIThis static method returns the \fBSoType\fP object associated with objects of this class\&. \fP" .ti -1c .RI "static void \fBinitClass\fP (void)" .br .RI "\fISets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system\&. \fP" .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "\fBSoSFInt32\fP \fBnumControlPoints\fP" .br .ti -1c .RI "\fBSoMFFloat\fP \fBknotVector\fP" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual const \fBSoFieldData\fP * \fBgetFieldData\fP (void) const " .br .ti -1c .RI "virtual \fB~SoNurbsCurve\fP ()" .br .ti -1c .RI "virtual void \fBgeneratePrimitives\fP (\fBSoAction\fP *action)" .br .ti -1c .RI "virtual void \fBcomputeBBox\fP (\fBSoAction\fP *action, \fBSbBox3f\fP &box, \fBSbVec3f\fP ¢er)" .br .ti -1c .RI "virtual \fBSoDetail\fP * \fBcreateLineSegmentDetail\fP (\fBSoRayPickAction\fP *action, const \fBSoPrimitiveVertex\fP *v1, const \fBSoPrimitiveVertex\fP *v2, \fBSoPickedPoint\fP *pp)" .br .in -1c .SS "Static Protected Member Functions" .in +1c .ti -1c .RI "static const \fBSoFieldData\fP ** \fBgetFieldDataPtr\fP (void)" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP The \fBSoNurbsCurve\fP class is a node for representing smooth curves\&. .PP A general explanation of NURBS is beyond the scope of the Coin documentation\&. For detailed information, refer to the specialized literature on the topic (for example 'An Introduction to NURBS: With Historical Perspective' by David F\&. Rogers)\&. A basic overview of curve and surface rendering using NURBS can be found in chapter 8 of 'The Inventor Mentor'\&. Note that knot values should be specified as [0, 1, 2,\&.\&.\&., a] rather than [0, 1/a, 2/a,\&.\&.\&., 1] to avoid tesselation errors due to floating point precision problems\&. (Even if the rendered curve \fIlooks\fP correct, such issues might surface when e\&.g\&. doing picking, since the tesselated representation used internally is not the same as the one you see rendered by OpenGL on-screen\&.) .PP Each control point has a weight that changes the shape of its basis function\&. Weight is analogous to having magnets pulling on the curve\&. Coordinate3 sets control points to have an equal weight of 1\&.0 (nonrational)\&. Use Coordinate4 to specify x, y, z and weight values (rational)\&. .PP A small usage example (drawing a circle using a rational curve): .PP .PP .nf #Inventor V2\&.1 ascii Coordinate4 { point [ 0\&.0 -5\&.0 0\&.0 1\&.0, 2\&.5 -2\&.5 0\&.0 0\&.5, 2\&.5 -0\&.66987 0\&.0 1\&.0, 0\&.0 1\&.94013 0\&.0 0\&.5, -2\&.5 -0\&.66987 0\&.0 1\&.0, -2\&.5 -2\&.5 0\&.0 0\&.5, 0\&.0 -5\&.0 0\&.0 1\&.0 ] } NurbsCurve { numControlPoints 7 knotVector [ 0, 0, 0, 1, 1, 2, 2, 3, 3, 3 ] } # debug: show all the control points BaseColor { rgb 1 1 0 } DrawStyle { pointSize 3 } PointSet { numPoints 7 } .fi .PP .PP .PP \fBFILE FORMAT/DEFAULTS:\fP .PP .nf NurbsCurve { numControlPoints 0 knotVector 0 } .fi .PP .SH "Constructor & Destructor Documentation" .PP .SS "SoNurbsCurve::SoNurbsCurve (void)" Constructor\&. .SS "SoNurbsCurve::~SoNurbsCurve ()\fC [protected]\fP, \fC [virtual]\fP" Destructor\&. .SH "Member Function Documentation" .PP .SS "\fBSoType\fP SoNurbsCurve::getTypeId (void) const\fC [virtual]\fP" .PP Returns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. Usage example: .PP .PP .nf void foo(SoNode * node) { if (node->getTypeId() == SoFile::getClassTypeId()) { SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type } } .fi .PP .PP For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in \fIall\fP subclasses\&. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance \fBInventor/nodes/SoSubNode\&.h\fP (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine\&.h (for engine classes) and so on\&. .PP For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups\&. .PP Reimplemented from \fBSoShape\fP\&. .SS "const \fBSoFieldData\fP ** SoNurbsCurve::getFieldDataPtr (void)\fC [static]\fP, \fC [protected]\fP" \fIThis API member is considered internal to the library, as it is not likely to be of interest to the application programmer\&.\fP .PP Reimplemented from \fBSoShape\fP\&. .SS "const \fBSoFieldData\fP * SoNurbsCurve::getFieldData (void) const\fC [protected]\fP, \fC [virtual]\fP" Returns a pointer to the class-wide field data storage object for this instance\&. If no fields are present, returns \fCNULL\fP\&. .PP Reimplemented from \fBSoShape\fP\&. .SS "void SoNurbsCurve::GLRender (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP" Action method for the \fBSoGLRenderAction\fP\&. .PP This is called during rendering traversals\&. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method\&. .PP Reimplemented from \fBSoShape\fP\&. .SS "void SoNurbsCurve::rayPick (\fBSoRayPickAction\fP *action)\fC [virtual]\fP" Calculates picked point based on primitives generated by subclasses\&. .PP Reimplemented from \fBSoShape\fP\&. .SS "void SoNurbsCurve::getPrimitiveCount (\fBSoGetPrimitiveCountAction\fP *action)\fC [virtual]\fP" Action method for the \fBSoGetPrimitiveCountAction\fP\&. .PP Calculates the number of triangle, line segment and point primitives for the node and adds these to the counters of the \fIaction\fP\&. .PP Nodes influencing how geometry nodes calculates their primitive count also overrides this method to change the relevant state variables\&. .PP Reimplemented from \fBSoShape\fP\&. .SS "void SoNurbsCurve::getBoundingBox (\fBSoGetBoundingBoxAction\fP *action)\fC [virtual]\fP" Redefined to notify open caches that this shape contains lines\&. .PP Reimplemented from \fBSoShape\fP\&. .SS "void SoNurbsCurve::sendPrimitive (\fBSoAction\fP *, \fBSoPrimitiveVertex\fP *)" This method is part of the original SGI Inventor API, but not implemented in Coin, as it looks like a method that should probably have been private in Open Inventor\&. .SS "void SoNurbsCurve::generatePrimitives (\fBSoAction\fP *action)\fC [protected]\fP, \fC [virtual]\fP" The method implements action behavior for shape nodes for \fBSoCallbackAction\fP\&. It is invoked from \fBSoShape::callback()\fP\&. (Subclasses should \fInot\fP override \fBSoNode::callback()\fP\&.) .PP The subclass implementations uses the convenience methods \fBSoShape::beginShape()\fP, \fBSoShape::shapeVertex()\fP, and \fBSoShape::endShape()\fP, with \fBSoDetail\fP instances, to pass the primitives making up the shape back to the caller\&. .PP Implements \fBSoShape\fP\&. .SS "void SoNurbsCurve::computeBBox (\fBSoAction\fP *action, \fBSbBox3f\fP &box, \fBSbVec3f\fP ¢er)\fC [protected]\fP, \fC [virtual]\fP" Calculates the bounding box of all control points, and sets the center to the average of these points\&. .PP Implements \fBSoShape\fP\&. .SS "\fBSoDetail\fP * SoNurbsCurve::createLineSegmentDetail (\fBSoRayPickAction\fP *action, const \fBSoPrimitiveVertex\fP *v1, const \fBSoPrimitiveVertex\fP *v2, \fBSoPickedPoint\fP *pp)\fC [protected]\fP, \fC [virtual]\fP" Will create line detail for a \fBSoPickedPoint\fP\&. This method will only be called internally, when \fBgeneratePrimitives()\fP is used for picking (\fBSoShape::rayPick()\fP is not overridden)\&. .PP This method returns \fCNULL\fP in Open Inventor, and subclasses will need to override this method to create details for a \fBSoPickedPoint\fP\&. .PP This is not necessary with Coin\&. Of course, if you choose to override it, it will work in the same way as Open Inventor\&. .PP For this to work, you must supply a face or line detail when generating primitives\&. If you supply \fCNULL\fP for the detail argument in \fBSoShape::beginShape()\fP, you'll have to override this method\&. .PP Reimplemented from \fBSoShape\fP\&. .SH "Member Data Documentation" .PP .SS "\fBSoSFInt32\fP SoNurbsCurve::numControlPoints" Number of control points to use in this NURBS curve\&. .SS "\fBSoMFFloat\fP SoNurbsCurve::knotVector" The knot vector\&. .PP Values should be specified as [0, 1, 2,\&.\&.\&., a] rather than [0, 1/a, 2/a,\&.\&.\&., 1] to avoid tesselation errors due to floating point precision problems\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.