本文整理汇总了C++中ON_NurbsSurface::ReserveKnotCapacity方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_NurbsSurface::ReserveKnotCapacity方法的具体用法?C++ ON_NurbsSurface::ReserveKnotCapacity怎么用?C++ ON_NurbsSurface::ReserveKnotCapacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_NurbsSurface
的用法示例。
在下文中一共展示了ON_NurbsSurface::ReserveKnotCapacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IncreaseDimension
void nurbsfit::IncreaseDimension( const ON_NurbsSurface& src, ON_NurbsSurface& dest, int dim )
{
dest.m_dim = dim;
dest.m_is_rat = src.m_is_rat;
dest.m_order[0] = src.m_order[0];
dest.m_order[1] = src.m_order[1];
dest.m_cv_count[0] = src.m_cv_count[0];
dest.m_cv_count[1] = src.m_cv_count[1];
dest.m_cv_stride[1] = dest.m_is_rat ? dest.m_dim+1 : dest.m_dim;
dest.m_cv_stride[0] = dest.m_cv_count[1]*dest.m_cv_stride[1];
if ( src.m_knot[0] )
{
// copy knot array
dest.ReserveKnotCapacity( 0, dest.KnotCount(0) );
memcpy( dest.m_knot[0], src.m_knot[0], dest.KnotCount(0)*sizeof(*dest.m_knot[0]) );
}
if ( src.m_knot[1] )
{
// copy knot array
dest.ReserveKnotCapacity( 1, dest.KnotCount(1) );
memcpy( dest.m_knot[1], src.m_knot[1], dest.KnotCount(1)*sizeof(*dest.m_knot[1]) );
}
if ( src.m_cv )
{
// copy cv array
dest.ReserveCVCapacity( dest.m_cv_count[0]*dest.m_cv_count[1]*dest.m_cv_stride[1] );
const int dst_cv_size = dest.CVSize()*sizeof(*dest.m_cv);
const int src_stride[2] = {src.m_cv_stride[0],src.m_cv_stride[1]};
if ( src_stride[0] == dest.m_cv_stride[0] && src_stride[1] == dest.m_cv_stride[1] )
{
memcpy( dest.m_cv, src.m_cv, dest.m_cv_count[0]*dest.m_cv_count[1]*dest.m_cv_stride[1]*sizeof(*dest.m_cv) );
}
else
{
const double *src_cv;
double *dst_cv = dest.m_cv;
int i, j;
for ( i = 0; i < dest.m_cv_count[0]; i++ )
{
src_cv = src.CV(i,0);
for ( j = 0; j < dest.m_cv_count[1]; j++ )
{
memcpy( dst_cv, src_cv, dst_cv_size );
dst_cv += dest.m_cv_stride[1];
src_cv += src_stride[1];
}
}
}
}
}
示例2: IsValid
int
ON_PlaneSurface::GetNurbForm( // returns 0: unable to create NURBS representation
// with desired accuracy.
// 1: success - returned NURBS parameterization
// matches the surface's to wthe desired accuracy
// 2: success - returned NURBS point locus matches
// the surfaces's to the desired accuracy but, on
// the interior of the surface's domain, the
// surface's parameterization and the NURBS
// parameterization may not match to the
// desired accuracy.
ON_NurbsSurface& nurbs,
double tolerance
) const
{
ON_BOOL32 rc = IsValid();
if( !rc )
{
if ( m_plane.origin.x != ON_UNSET_VALUE
&& m_plane.xaxis.x != ON_UNSET_VALUE
&& m_plane.yaxis.x != ON_UNSET_VALUE
&& m_domain[0].IsIncreasing() && m_domain[1].IsIncreasing()
&& m_extents[0].Length() > 0.0 && m_extents[1].Length() > 0.0
)
{
ON_3dVector N = ON_CrossProduct(m_plane.xaxis,m_plane.yaxis);
if ( N.Length() <= 1.0e-4 )
{
ON_WARNING("ON_PlaneSurface::GetNurbForm - using invalid surface.");
rc = true;
}
}
}
if ( rc )
{
nurbs.m_dim = 3;
nurbs.m_is_rat = 0;
nurbs.m_order[0] = nurbs.m_order[1] = 2;
nurbs.m_cv_count[0] = nurbs.m_cv_count[1] = 2;
nurbs.m_cv_stride[1] = nurbs.m_dim;
nurbs.m_cv_stride[0] = nurbs.m_cv_stride[1]*nurbs.m_cv_count[1];
nurbs.ReserveCVCapacity(12);
nurbs.ReserveKnotCapacity(0,2);
nurbs.ReserveKnotCapacity(1,2);
nurbs.m_knot[0][0] = m_domain[0][0];
nurbs.m_knot[0][1] = m_domain[0][1];
nurbs.m_knot[1][0] = m_domain[1][0];
nurbs.m_knot[1][1] = m_domain[1][1];
nurbs.SetCV( 0, 0, PointAt( m_domain[0][0], m_domain[1][0] ));
nurbs.SetCV( 0, 1, PointAt( m_domain[0][0], m_domain[1][1] ));
nurbs.SetCV( 1, 0, PointAt( m_domain[0][1], m_domain[1][0] ));
nurbs.SetCV( 1, 1, PointAt( m_domain[0][1], m_domain[1][1] ));
}
return rc;
}