GeomAPI_ProjectPointOnCurve aProjection(aPnt, aCurve);
- if (aProjection.NbPoints() == 0) {
- return aVertex;
+ if (aProjection.NbPoints() != 0) {
+ gp_Pnt aNearestPoint = aProjection.NearestPoint();
+ aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z()));
}
- gp_Pnt aNearestPoint = aProjection.NearestPoint();
-
- aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z()));
-
return aVertex;
}
{
std::shared_ptr<GeomAPI_Vertex> aVertex;
- if(!theVertex.get() || !theFace.get() || !theFace->isPlanar()) {
- return aVertex;
- }
-
- std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
- std::shared_ptr<GeomAPI_Pln> aProjPln = theFace->getPlane();
+ if (theVertex.get() && theFace.get() && theFace->isPlanar()) {
+ std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
+ std::shared_ptr<GeomAPI_Pln> aProjPln = theFace->getPlane();
- std::shared_ptr<GeomAPI_Pnt> aPnt = aProjPln->project(aProjPnt);
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aProjPln->project(aProjPnt);
- if(!aPnt.get()) {
- return aVertex;
+ if (aPnt.get())
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
}
- aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
-
return aVertex;
}
{
std::shared_ptr<GeomAPI_Vertex> aVertex;
- if(!theEdge1.get() || !theEdge2.get() || !theEdge1->isLine() || !theEdge2->isLine()) {
- return aVertex;
- }
-
- std::shared_ptr<GeomAPI_Lin> aLin1 = theEdge1->line();
- std::shared_ptr<GeomAPI_Lin> aLin2 = theEdge2->line();
-
- std::shared_ptr<GeomAPI_Pnt> aPnt = aLin1->intersect(aLin2);
-
- if(!aPnt.get()) {
- return aVertex;
- }
-
- aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
-
- return aVertex;
-}
-
-//==================================================================================================
-std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByIntersection(
- const std::shared_ptr<GeomAPI_Edge> theEdge,
- const std::shared_ptr<GeomAPI_Face> theFace)
-{
- std::shared_ptr<GeomAPI_Vertex> aVertex;
-
- if(!theEdge.get() || !theFace.get() || !theEdge->isLine() || !theFace->isPlanar()) {
- return aVertex;
- }
-
- std::shared_ptr<GeomAPI_Lin> aLin = theEdge->line();
- std::shared_ptr<GeomAPI_Pln> aPln = theFace->getPlane();
+ if (theEdge1.get() && theEdge2.get() && theEdge1->isLine() && theEdge2->isLine()) {
+ std::shared_ptr<GeomAPI_Lin> aLin1 = theEdge1->line();
+ std::shared_ptr<GeomAPI_Lin> aLin2 = theEdge2->line();
- std::shared_ptr<GeomAPI_Pnt> aPnt = aPln->intersect(aLin);
+ std::shared_ptr<GeomAPI_Pnt> aPnt = aLin1->intersect(aLin2);
- if(!aPnt.get()) {
- return aVertex;
+ if (aPnt.get())
+ aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
}
- aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
-
return aVertex;
}
vertexByIntersection(const std::shared_ptr<GeomAPI_Edge> theEdge1,
const std::shared_ptr<GeomAPI_Edge> theEdge2);
- /// \brief Creates vertex by intersection line and plane.
- /// \param[in] theEdge linear edge.
- /// \param[in] theFace planar face.
- /// \return created vertex.
- static std::shared_ptr<GeomAPI_Vertex>
- vertexByIntersection(const std::shared_ptr<GeomAPI_Edge> theEdge,
- const std::shared_ptr<GeomAPI_Face> theFace);
-
/// Return point by shape vertex
static std::shared_ptr<GeomAPI_Pnt> point(const std::shared_ptr<GeomAPI_Shape> theVertex);
};