Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Usage issues / Boolean operation Failed between a halfspace and a vertical axes cylinder

Boolean operation Failed between a halfspace and a vertical axes cylinder

Boolean operation Failed between a halfspace and a vertical axes cylinder
csaber 2013/04/10 17:34
Hello,everyone. I have a question to discuss with others.
I am using OCC 6.5.4 ,when I use Boolean common operation with a halfspace and a cylinder, the result is not valid. the same to the boolean cut operation. otherwise, the direct of axes of cylinder and the direct of halfspace is vertical.
There is the coding below
/*******************************************/
// create halfspace
gp_Pnt Point = gp_Pnt(24.762251692503,-68.033748177379,0);
gp_Dir PlnDir = gp_Dir(0.342020051002874,-0.939692654388653,0);
gp_Pln Plane = gp_Pln(Point,PlnDir);
gp_Pnt RefPnt = gp_Pnt(Point.X()-PlnDir.X(), Point.Y()-PlnDir.Y(), Point.Z()-PlnDir.Z());
TopoDS_Face Face = BrepBuilderAPI_MakeFace(Plane);
TopoDS_Shape HalfSpace = BrepBuilderAPI_MakeHalfSpace(Face,RefPnt).Solid();

// create cylinder
gp_Pnt Pnt = gp_Pnt(24.7622507021718,-68.0337469973351,-33);
gp_Dir CylDir = gp_Dir(0.939692656878143,0.342020044163052,0);
Standard_Real Radius = 13;
Standard_Real H = 1000;
gp_Ax2 Axes = gp_Ax2(Pnt ,CylDir );
TopoDS_Shape Cyl1 = BrepPrimAPI_MakeCylinder(Axes,Radius ,H);
gp_Dir ReCylDir = gp_Dir(-0.939692656878143,-0.342020044163052,0);
gp_Ax2 ReAxes = gp_Ax2(Pnt ,ReCylDir );
TopoDS_Shape Cyl2 = BrepPrimAPI_MakeCylinder(ReAxes,Radius ,H);
TopoDS_Shape Cylinder = BrepAlgoAPI_Fuse(Cyl1,Cyl2);
// boolean common
TopoDS_Shape ShapeCommon = BrepAlgoAPI_Common(HalfSpace,Cylinder);
Standard_Boolean ShapeIsValid = BrepAlgo::IsValid(ShapeCommon);

/****************************************/
The result of ShapeIsValid is 0 , which means the ShapeCommon is not valid. You can find the PlnDir*CylDir is close to 0, the PlnDir is vertical with CylDir approximate. When I adjust the PlnDir to vertical with CylDir manual,the ShapeIsValid is 1;
So I guess that the reason is the precision of boolean operation maybe. But I don't know how to adjust the precision of boolean operation, and adjust it back when the boolean common end.
Does anyone can answer this problem or other solution?

Regards
 
 
Latest news
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map