当前位置: 首页>>代码示例>>C++>>正文


C++ ON_BoundingBox::Includes方法代码示例

本文整理汇总了C++中ON_BoundingBox::Includes方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_BoundingBox::Includes方法的具体用法?C++ ON_BoundingBox::Includes怎么用?C++ ON_BoundingBox::Includes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ON_BoundingBox的用法示例。


在下文中一共展示了ON_BoundingBox::Includes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ON_Brep_GetTightFaceBoundingBox_Helper

// Add a face to the partial boundingbox result.
static void ON_Brep_GetTightFaceBoundingBox_Helper( const ON_BrepFace& face, ON_BoundingBox& bbox, const ON_Xform* xform, const ON_Xform* xform_inverse )
{
  ON_BoundingBox loose_box;

  // This should ideally test for planarity inside the OuterLoop() pbox only,
  // but no such function exists in the SDK as far as I can tell.
  if( face.IsPlanar() )
    return;

  // Get loose boundingbox of face.
  if( face.GetBoundingBox(loose_box, false) )
  {
    if( xform_inverse ) 
      loose_box.Transform(*xform_inverse); 

    if( bbox.Includes(loose_box, false) )
      return;
  }

  const TL_Brep* tlbrep = TL_Brep::Promote(face.Brep());
  if( tlbrep )
  {
    ON_Brep_GetTightIsoCurveBoundingBox_Helper( *tlbrep, face, bbox, xform, 0);
    ON_Brep_GetTightIsoCurveBoundingBox_Helper( *tlbrep, face, bbox, xform, 1);
  }
}
开发者ID:JohannesKu,项目名称:rhinocommon,代码行数:27,代码来源:on_geometry.cpp

示例2: ON_Brep_GetTightCurveBoundingBox_Helper

// Add a curve to the partial boundingbox result.
static void ON_Brep_GetTightCurveBoundingBox_Helper( const ON_Curve& crv, ON_BoundingBox& bbox, const ON_Xform* xform, const ON_Xform* xform_inverse )
{
  // Get loose boundingbox of curve.
  ON_BoundingBox tempbox;
  if( !crv.GetBoundingBox(tempbox, false) )
    return;

  // Transform the loose box if necessary. 
  // Note: transforming a box might result in a larger box, 
  //       it's better to transform the curve, 
  //       which might actually result in a smaller box.
  if( xform_inverse )
  {
    tempbox.Transform(*xform_inverse); 
  }

  // If loose boundingbox of curve is inside partial result, return.
  if( bbox.Includes(tempbox, false) )
    return;

  // Get tight boundingbox of curve, grow partial result.
  if( crv.GetTightBoundingBox(tempbox, false, xform) )
    bbox.Union(tempbox);
}
开发者ID:JohannesKu,项目名称:rhinocommon,代码行数:25,代码来源:on_geometry.cpp

示例3: ON_Brep_GetTightIsoCurveBoundingBox_Helper

// Add the isocurves of a BrepFace to the partial boundingbox result.
static void ON_Brep_GetTightIsoCurveBoundingBox_Helper( const TL_Brep& tlbrep, const ON_BrepFace& face, ON_BoundingBox& bbox, const ON_Xform* xform, int dir )
{
  ON_Interval domain = face.Domain(1 - dir);
  int degree =         face.Degree(1 - dir);
  int spancount =      face.SpanCount(1 - dir);
  int spansamples =    degree * (degree + 1) - 1;
  if( spansamples < 2 )
    spansamples = 2;

  // pbox delineates the extremes of the face interior.
  // We can use it to trivially reject spans and isocurves.
  ON_BrepLoop* pOuterLoop = face.OuterLoop();
  if( NULL==pOuterLoop )
    return;

  const ON_BoundingBox& pbox = pOuterLoop->m_pbox;
  double t0 = ((dir == 0) ? pbox.Min().y : pbox.Min().x);
  double t1 = ((dir == 0) ? pbox.Max().y : pbox.Max().x);

  // Get the surface span vector.
  ON_SimpleArray<double> spanvector(spancount + 1);
  spanvector.SetCount(spancount + 1);
  face.GetSpanVector(1 - dir, spanvector.Array());

  // Generate a list of all the sampling parameters.
  ON_SimpleArray<double> samples(spancount * spansamples);
  for( int s = 0; s < spancount; s++)
  {
    double s0 = spanvector[s];
    double s1 = spanvector[s+1];

    // Reject span if it does not intersect the pbox.
    if( s1 < t0 ) { continue; }
    if( s0 > t1 ) { continue; }
    
    ON_Interval span(s0, s1);
    for( int i = 1; i < spansamples; i++ )
    {
      double t = span.ParameterAt((double)i / (double)(spansamples - 1));
      // Reject iso if it does not intersect the pbox.
      if( t < t0 )
        continue;
      if( t > t1 )
        break;
      samples.Append(t);
    }
  }

  //Iterate over samples
  int sample_count = samples.Count();
  ON_BoundingBox loose_box;
  ON_SimpleArray<ON_Interval> intervals;
  ON_NurbsCurve isosubcrv;

  for( int i = 0; i<sample_count; i++)
  {
    // Retrieve iso-curve.
    ON_Curve* isocrv = face.IsoCurve(dir, samples[i]);

    while( NULL!=isocrv )
    {
      // Transform isocurve if necessary, this is better than transforming downstream boundingboxes.
      if( xform )
        isocrv->Transform(*xform);

      // Compute loose box.
      if( !isocrv->GetBoundingBox(loose_box, false))
        break;

      // Determine whether the loose box is already contained within the partial result.
      if( bbox.Includes(loose_box, false) ) 
        break;

      // Solve trimming domains for the iso-curve.
      intervals.SetCount(0);
      if( !tlbrep.GetIsoIntervals(face, dir, samples[i], intervals))
        break;

      // Iterate over trimmed iso-curves.
      int interval_count = intervals.Count();
      for( int k=0; k<interval_count; k++ )
      {
        //this to mask a bug in Rhino4. GetNurbForm does not destroy the Curve Tree. It does now.
        isosubcrv.DestroyCurveTree();
        isocrv->GetNurbForm(isosubcrv, 0.0, &intervals[k]);
        ON_Brep_GetTightCurveBoundingBox_Helper(isosubcrv, bbox, NULL, NULL);
      }
      break;
    }

    if( isocrv )
    {
      delete isocrv;
      isocrv = NULL;
    }
  }
}
开发者ID:JohannesKu,项目名称:rhinocommon,代码行数:98,代码来源:on_geometry.cpp


注:本文中的ON_BoundingBox::Includes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。