It's can't take a right result on Boolean common operation on two face

void CTopologyOperationsDoc::OnCommon()
{
AIS_ListOfInteractive aList;
myAISContext->DisplayedObjects(aList);
AIS_ListIteratorOfListOfInteractive aListIterator;
for(aListIterator.Initialize(aList);aListIterator.More();aListIterator.Next()){
myAISContext->Remove(aListIterator.Value());
}

TopoDS_Edge Edge1, Edge2,Edge3,Edge4;
TopoDS_Wire aWire1,aWire2;

Edge1 = BRepBuilderAPI_MakeEdge(gp_Pnt(50,50,0),gp_Pnt(-50,50,0));
Edge2 = BRepBuilderAPI_MakeEdge(gp_Pnt(-50,50,0),gp_Pnt(-50,-50,0));
Edge3 = BRepBuilderAPI_MakeEdge(gp_Pnt(-50,-50,0),gp_Pnt(50,-50,0));
Edge4 = BRepBuilderAPI_MakeEdge(gp_Pnt(50,-50,0),gp_Pnt(50,50,0));
BRepBuilderAPI_MakeWire MW1(Edge1,Edge2,Edge3,Edge4);
if (MW1.IsDone())
aWire1 = MW1;
TopoDS_Face aFace1 = BRepBuilderAPI_MakeFace(aWire1);
Handle(AIS_Shape) ashape1=new AIS_Shape(aFace1);
myAISContext->SetColor(ashape1,Quantity_NOC_YELLOW,Standard_False);
myAISContext->SetDisplayMode(ashape1,0,Standard_False);
myAISContext->Display(ashape1,Standard_False);
myAISContext->SetCurrentObject(ashape1,Standard_False);
Fit();
Sleep(500);

gp_Circ circle2(gp_Ax2(gp_Pnt(50,0,0),gp_Dir(0,0,1)),50.2);
Edge1 = BRepBuilderAPI_MakeEdge(circle2,0.,2*PI);
BRepBuilderAPI_MakeWire MW2(Edge1);
if (MW2.IsDone())
aWire2 = MW2;
TopoDS_Face aFace2 = BRepBuilderAPI_MakeFace(aWire2);
Handle(AIS_Shape) ashape2 = new AIS_Shape(aFace2);
myAISContext->SetColor(ashape2,Quantity_NOC_RED,Standard_False);
myAISContext->SetDisplayMode(ashape2,0,Standard_False);
myAISContext->Display(ashape2,Standard_False);
myAISContext->SetCurrentObject(ashape2,Standard_False);
Fit();
Sleep(500);

TopoDS_Shape theCommonSurface = BRepAlgoAPI_Common(aFace1,aFace2);

//myAISContext->Erase(ashape1,Standard_True,Standard_False);
//myAISContext->Erase(ashape2,Standard_True,Standard_False);

Handle(AIS_Shape) acommon = new AIS_Shape(theCommonSurface);
myAISContext->SetColor(acommon,Quantity_NOC_GREEN,Standard_False);
myAISContext->Display(acommon,Standard_False);
myAISContext->SetCurrentObject(acommon);
}

dong_qu's picture

i'm write wrong at 'gp_Circ circle2(gp_Ax2(gp_Pnt(50,0,0),gp_Dir(0,0,1)),50.2);',
change for 'gp_Circ circle2(gp_Ax2(gp_Pnt(50,0,0),gp_Dir(0,0,1)),50.);'.