return aResultPoints;
}
-//==================================================================================================
-std::shared_ptr<GeomAPI_Shape>
- GeomAlgoAPI_ShapeTools::faceToInfinitePlane(const std::shared_ptr<GeomAPI_Shape> theFace)
-{
- if (!theFace.get())
- return std::shared_ptr<GeomAPI_Shape>();
-
- TopoDS_Face aPlaneFace = TopoDS::Face(theFace->impl<TopoDS_Shape>());
- if (aPlaneFace.IsNull())
- return std::shared_ptr<GeomAPI_Shape>();
-
- Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(aPlaneFace));
- if (aPlane.IsNull())
- return std::shared_ptr<GeomAPI_Shape>();
-
- // make an infinity face on the plane
- TopoDS_Shape anInfiniteFace = BRepBuilderAPI_MakeFace(aPlane->Pln()).Shape();
-
- std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape);
- aResult->setImpl(new TopoDS_Shape(anInfiniteFace));
- return aResult;
-}
-
//==================================================================================================
std::shared_ptr<GeomAPI_Face> GeomAlgoAPI_ShapeTools::fitPlaneToBox(
const std::shared_ptr<GeomAPI_Shape> thePlane,
std::shared_ptr<GeomAPI_Vertex>& theV1,
std::shared_ptr<GeomAPI_Vertex>& theV2)
{
- if(!theShape.get()) {
- std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex);
+ static GeomVertexPtr aVertex;
+ if (!aVertex) {
+ aVertex = GeomVertexPtr(new GeomAPI_Vertex);
aVertex->setImpl(new TopoDS_Vertex());
- theV1 = aVertex;
- theV2 = aVertex;
- return;
}
- const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
- TopoDS_Vertex aV1, aV2;
- ShapeAnalysis::FindBounds(aShape, aV1, aV2);
-
- std::shared_ptr<GeomAPI_Vertex> aGeomV1(new GeomAPI_Vertex()), aGeomV2(new GeomAPI_Vertex());
- aGeomV1->setImpl(new TopoDS_Vertex(aV1));
- aGeomV2->setImpl(new TopoDS_Vertex(aV2));
- theV1 = aGeomV1;
- theV2 = aGeomV2;
+ theV1 = aVertex;
+ theV2 = aVertex;
+
+ if (theShape) {
+ const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+ TopoDS_Vertex aV1, aV2;
+ ShapeAnalysis::FindBounds(aShape, aV1, aV2);
+
+ std::shared_ptr<GeomAPI_Vertex> aGeomV1(new GeomAPI_Vertex()), aGeomV2(new GeomAPI_Vertex());
+ aGeomV1->setImpl(new TopoDS_Vertex(aV1));
+ aGeomV2->setImpl(new TopoDS_Vertex(aV2));
+ theV1 = aGeomV1;
+ theV2 = aGeomV2;
+ }
}
//==================================================================================================
}
//==================================================================================================
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
std::shared_ptr<GeomAPI_Dir> GeomAlgoAPI_ShapeTools::buildDirFromAxisAndShape(
const std::shared_ptr<GeomAPI_Shape> theBaseShape,
const std::shared_ptr<GeomAPI_Ax1> theAxis)
aCentreOfMassPoint.Z()-aPoint.Z()));
return aDir;
}
+#endif
//==================================================================================================
static TopoDS_Wire fixParametricGaps(const TopoDS_Wire& theWire)