Пример #1
0
//-------------------------------------------------------------------------
// Purpose       : Get the bounding box of the object.
//
// Special Notes :
//
//-------------------------------------------------------------------------
CubitBox OCCSurface::bounding_box() const 
{
  TopoDS_Face face = *myTopoDSFace;
  BRepAdaptor_Surface asurface(face);
  Bnd_Box aBox;
  BndLib_AddSurface::Add(asurface, Precision::Approximation(), aBox);
  double min[3], max[3];
  aBox.Get( min[0], min[1], min[2], max[0], max[1], max[2]);
  return CubitBox(min, max);
}
Пример #2
0
//-------------------------------------------------------------------------
// Purpose       : Return union of bounding boxes of all entities.
//
// Special Notes : 
//
// Creator       : Jason Kraftcheck
//
// Creation Date : 12/19/01
//-------------------------------------------------------------------------
CubitBox CompositeGeom::bounding_box()
{
  if( entityList.size() == 0 )
  {
    return CubitBox();
  }
  
  if( needToUpdateBbox )
    update_data_bbox();
    
  CubitBox box( entityList[0].bbox );
  for( int i = 1; i < entityList.size(); i++ )
    box |= entityList[i].bbox;
  return box;
}
Пример #3
0
static int test_brick()
{
  Body* brick = GeometryModifyTool::instance()->brick(1,2,4);
  if(!brick)
  {
    printf("failed to make brick\n");
    return 1;
  }
  if(!cubit_box_identical(brick->bounding_box(),
        CubitBox(CubitVector(-0.5,-1,-2), CubitVector(0.5,1,2)),
        GEOMETRY_RESABS*2.0, true))
  {
    printf("boxes not identical\n");
    return 1;
  }
  return 0;
}
Пример #4
0
ImprintLineSegment::ImprintLineSegment(ImprintPointData *start_point,
                                       ImprintPointData *end_point,
                                       RefEntity *owner_v)
{
  CubitVector min, max;
  CubitVector p1 = start_point->coordinates();
  CubitVector p2 = end_point->coordinates();
  if ( p1.x() < p2.x() ) {
     min.x(p1.x());
     max.x(p2.x());
  } 
  else {
    min.x(p2.x());
    max.x(p1.x());
  }
  if ( p1.y() < p2.y() ) {
    min.y(p1.y());
    max.y(p2.y());
  } 
  else {
    min.y(p2.y());
    max.y(p1.y());
  }
  if ( p1.z() < p2.z() ) {
    min.z(p1.z());
    max.z(p2.z());
  } 
  else {
    min.z(p2.z());
    max.z(p1.z());
  }
  boundingBox = CubitBox(min, max);
  startPoint = start_point;
  endPoint = end_point;
  nextSeg = NULL;
  prevSeg = NULL;
  myOwner = owner_v;
  inactiveFlag = CUBIT_FALSE;
  segMatches = NULL;
  startPoint->set_next_seg(this);
  endPoint->set_prev_seg(this);
}
Пример #5
0
//-------------------------------------------------------------------------
// Purpose       : Get bounding box
//
// Special Notes : 
//
// Creator       : Jason Kraftcheck
//
// Creation Date : 03/08/02
//-------------------------------------------------------------------------
CubitBox Point::bounding_box() const
  { return CubitBox(coordinates()); }