0027720: HLRBrep_Algo BSpline missing edges
[occt.git] / src / HLRTest / HLRTest.cxx
index 2af070d..6379df6 100644 (file)
@@ -501,6 +501,61 @@ static Standard_Integer hlrin3d(Draw_Interpretor& , Standard_Integer n, const ch
   return 0;
 }
 
+//=======================================================================
+//function : hlrin2d
+//purpose  : 
+//=======================================================================
+
+static Standard_Integer hlrin2d(Draw_Interpretor& , Standard_Integer n, const char** a)
+{
+  if (n < 9)
+    return 1;
+
+  TopoDS_Shape aShape =  DBRep::Get(a[2]);
+  if (aShape.IsNull())
+    return 1;
+
+  Standard_Real anAISViewProjX = atof(a[3]);
+  Standard_Real anAISViewProjY = atof(a[4]);
+  Standard_Real anAISViewProjZ = atof(a[5]);
+
+  Standard_Real Eye_X = atof(a[6]);
+  Standard_Real Eye_Y = atof(a[7]);
+  Standard_Real Eye_Z = atof(a[8]);
+
+
+  
+  gp_Pnt anOrigin(0.,0.,0.);
+  gp_Dir aNormal(anAISViewProjX, anAISViewProjY, anAISViewProjZ);
+  gp_Dir aDX(Eye_X, Eye_Y, Eye_Z);
+  
+  HLRAppli_ReflectLines Reflector(aShape);
+
+  Reflector.SetAxes(aNormal.X(), aNormal.Y(), aNormal.Z(),
+                    anOrigin.X(), anOrigin.Y(), anOrigin.Z(),
+                    aDX.X(), aDX.Y(), aDX.Z());
+
+  Reflector.Perform();
+
+  TopoDS_Compound Result;
+  BRep_Builder BB;
+  BB.MakeCompound(Result);
+  
+  TopoDS_Shape SharpEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Sharp, Standard_True, Standard_False);
+  if (!SharpEdges.IsNull())
+    BB.Add(Result, SharpEdges);
+  TopoDS_Shape OutLines = Reflector.GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True, Standard_False);
+  if (!OutLines.IsNull())
+    BB.Add(Result, OutLines);
+  TopoDS_Shape SmoothEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Rg1Line, Standard_True, Standard_False);
+  if (!SmoothEdges.IsNull())
+    BB.Add(Result, SmoothEdges);
+  
+  DBRep::Set(a[1], Result);
+
+  return 0;
+}
+
 //=======================================================================
 //function : Commands
 //purpose  : 
@@ -533,6 +588,10 @@ void HLRTest::Commands (Draw_Interpretor& theCommands)
                   "hlrin3d res shape proj_X proj_Y proj_Z",
                   __FILE__, hlrin3d, g);
   
+  theCommands.Add("hlrin2d",
+                  "hlrin2d res shape proj_X proj_Y proj_Z eye_x eye_y eye_z",
+                  __FILE__, hlrin2d, g);
+  
   hider = new HLRBRep_Algo();
 }