本文整理汇总了C++中ON_NurbsSurface::IsRational方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_NurbsSurface::IsRational方法的具体用法?C++ ON_NurbsSurface::IsRational怎么用?C++ ON_NurbsSurface::IsRational使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_NurbsSurface
的用法示例。
在下文中一共展示了ON_NurbsSurface::IsRational方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ON_GL
void ON_GL( const ON_NurbsSurface& s,
GLUnurbsObj* nobj, // created with gluNewNurbsRenderer )
GLenum type, // = 0 (and type is automatically set)
int bPermitKnotScaling,
double* knot_scale0,
double* knot_scale1
)
{
int i, j, k;
// The "bPermitScaling" parameters to the ON_GL() call that
// fills in the knot vectors is set to false because any
// rescaling that is applied to a surface domain must also
// be applied to parameter space trimming curve geometry.
// GL "s" knots
GLint sknot_count = s.KnotCount(0) + 2;
GLfloat* sknot = (GLfloat*)onmalloc( sknot_count*sizeof(*sknot) );
ON_GL( s.Order(0), s.CVCount(0), s.Knot(0), sknot,
bPermitKnotScaling, knot_scale0 );
// GL "t" knots
GLint tknot_count = s.KnotCount(1) + 2;
GLfloat* tknot = (GLfloat*)onmalloc( tknot_count*sizeof(*tknot) );
ON_GL( s.Order(1), s.CVCount(1), s.Knot(1), tknot,
bPermitKnotScaling, knot_scale1 );
// control vertices
const int cv_size= s.CVSize();
const int cv_count[2] = {s.CVCount(0), s.CVCount(1)};
GLint s_stride = cv_size*cv_count[1];
GLint t_stride = cv_size;
GLfloat* ctlarray = (GLfloat*)onmalloc( s_stride*cv_count[0]*sizeof(*ctlarray) );
for ( i = 0; i < cv_count[0]; i++ ) {
for ( j = 0; j < cv_count[1]; j++ ) {
const double* cv = s.CV(i,j);
GLfloat* gl_cv = ctlarray + s_stride*i + t_stride*j;
for ( k = 0; k < cv_size; k++ ) {
gl_cv[k] = (GLfloat)cv[k];
}
}
}
GLint sorder = s.Order(0);
GLint torder = s.Order(1);
if ( type == 0 ) {
// set GL surface type for 3d CVs in homogeneous/euclidean form.
type = ( s.IsRational() ) ? GL_MAP2_VERTEX_4 : GL_MAP2_VERTEX_3;
}
gluNurbsSurface (
nobj,
sknot_count,
sknot,
tknot_count,
tknot,
s_stride,
t_stride,
ctlarray,
sorder,
torder,
type
);
onfree( ctlarray );
onfree( tknot );
onfree( sknot );
}