本文整理汇总了C++中ON_BoundingBox::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_BoundingBox::IsValid方法的具体用法?C++ ON_BoundingBox::IsValid怎么用?C++ ON_BoundingBox::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_BoundingBox
的用法示例。
在下文中一共展示了ON_BoundingBox::IsValid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetBoundingBox
bool ON_Arc::GetBoundingBox(
ON_BoundingBox& bbox,
int bGrowBox
) const
{
if (bGrowBox)
{
ON_BoundingBox arc_bbox = BoundingBox();
bbox.Union(arc_bbox);
}
else
bbox = BoundingBox();
return bbox.IsValid();
}
示例2: ON_Brep_GetTightBoundingBox_Helper
static bool ON_Brep_GetTightBoundingBox_Helper( const ON_Brep& brep, ON_BoundingBox& bbox, ON_Xform* xform )
{
ON_Xform xform_inverse;
ON_Xform* inverse = NULL;
if( xform )
{
xform_inverse = xform->Inverse();
inverse = &xform_inverse;
}
// make sure we have an empty/invalid bbox
bbox.Destroy();
// Compute Vertex bounding box.
int vertex_count = brep.m_V.Count();
if( xform )
{
ON_3dPointArray vtx(vertex_count);
for( int i=0; i<vertex_count; i++ )
vtx.Append(brep.m_V[i].point);
vtx.GetTightBoundingBox(bbox, false, xform);
}
else
{
for( int i=0; i<vertex_count; i++ )
bbox.Set(brep.m_V[i].point,true);
}
// Grow partial result with Edge bounding boxes.
int edge_count = brep.m_E.Count();
for( int i=0; i<edge_count; i++)
ON_Brep_GetTightCurveBoundingBox_Helper(brep.m_E[i], bbox, xform, inverse);
// Grow partial result with Face bounding boxes.
int face_count = brep.m_F.Count();
for( int i=0; i<face_count; i++)
ON_Brep_GetTightFaceBoundingBox_Helper(brep.m_F[i], bbox, xform, inverse);
return bbox.IsValid();
}
示例3: GetTightBoundingBox
bool ON_PointGrid::GetTightBoundingBox(
ON_BoundingBox& tight_bbox,
int bGrowBox,
const ON_Xform* xform
) const
{
if ( bGrowBox && !tight_bbox.IsValid() )
{
bGrowBox = false;
}
if ( !bGrowBox )
{
tight_bbox.Destroy();
}
int i;
for ( i = 0; i < m_point_count[0]; i++ )
{
if ( ON_GetPointListBoundingBox( 3, 0, m_point_count[1], 3, &m_point[i].x, tight_bbox, bGrowBox, xform ) )
bGrowBox = true;
}
return bGrowBox?true:false;
}
示例4: GetTightBoundingBox
bool ON_Geometry::GetTightBoundingBox(
ON_BoundingBox& tight_bbox,
int bGrowBox,
const ON_Xform* xform
) const
{
// This implementation should be overridden by classes devived
// from ON_Geometry
if ( bGrowBox && !tight_bbox.IsValid() )
{
bGrowBox = false;
}
if ( !bGrowBox )
{
tight_bbox.Destroy();
}
if ( xform && !xform->IsIdentity() )
{
ON_3dPointArray corners(8);
ON_BoundingBox world_bbox;
if ( GetBoundingBox(world_bbox,false) )
{
world_bbox.GetCorners(corners);
if ( corners.GetTightBoundingBox(tight_bbox,bGrowBox,xform) )
bGrowBox = true;
}
}
else
{
if ( GetBoundingBox(tight_bbox,bGrowBox) )
bGrowBox = true;
}
return bGrowBox?true:false;
}
示例5: ON_ArePointsOnPlane
int ON_ArePointsOnPlane( // returns 0=no, 1 = yes, 2 = pointset is (to tolerance) a single point on the line
int dim, // 2 or 3
int is_rat,
int count,
int stride, const double* point,
const ON_BoundingBox& bbox, // if needed, use ON_GetBoundingBox(dim,is_rat,count,stride,point)
const ON_Plane& plane, // line to test
double tolerance
)
{
double w;
int i, j, k;
if ( count < 1 )
return 0;
if ( !plane.IsValid() )
{
ON_ERROR("plane parameter is not valid");
return 0;
}
if ( !bbox.IsValid() )
{
ON_ERROR("bbox parameter is not valid");
return 0;
}
if ( !ON_IsValid(tolerance) || tolerance < 0.0 )
{
ON_ERROR("tolerance must be >= 0.0");
return 0;
}
if ( dim < 2 || dim > 3 )
{
ON_ERROR("dim must be 2 or 3");
return 0;
}
if ( stride < (is_rat?(dim+1):dim) )
{
ON_ERROR("stride parameter is too small");
return 0;
}
if ( 0 == point )
{
ON_ERROR("point parameter is null");
return 0;
}
int rc = 0;
if ( tolerance == 0.0 ) {
tolerance = bbox.Tolerance();
}
ON_3dPoint Q;
// test bounding box to quickly detect the common coordinate axis cases
rc = (count == 1 || bbox.Diagonal().Length() <= tolerance) ? 2 : 1;
for ( i = 0; rc && i < 2; i++ ) {
Q.x = bbox[i].x;
for ( j = 0; rc && j < 2; j++) {
Q.y = bbox[j].y;
for ( k = 0; rc && k < 2; k++) {
Q.z = bbox[k].z;
if ( Q.DistanceTo( plane.ClosestPointTo( Q ) ) > tolerance )
rc = 0;
}
}
}
if ( !rc ) {
// test points one by one
Q.Zero();
rc = (count == 1 || bbox.Diagonal().Length() <= tolerance) ? 2 : 1;
if ( is_rat ) {
for ( i = 0; i < count; i++ ) {
w = point[dim];
if ( w == 0.0 ) {
ON_ERROR("rational point has zero weight");
return 0;
}
ON_ArrayScale( dim, 1.0/w, point, &Q.x );
if ( Q.DistanceTo( plane.ClosestPointTo( Q ) ) > tolerance ) {
rc = 0;
break;
}
point += stride;
}
}
else {
for ( i = 0; i < count; i++ ) {
memcpy( &Q.x, point, dim*sizeof(Q.x) );
if ( Q.DistanceTo( plane.ClosestPointTo( Q ) ) > tolerance ) {
rc = 0;
break;
}
point += stride;
}
}
}
return rc;
//.........这里部分代码省略.........