Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Task 3.2. Concealment into multi-level Compounds
[modules/shaper.git]
/
src
/
GeomAlgoAPI
/
GeomAlgoAPI_PointBuilder.cpp
diff --git
a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp
b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp
index 19796f0a2be92a843e839c3f66d4300f6ac81746..7b46a50ff1ed6737d00aa27467175433abe0bdc6 100644
(file)
--- a/
src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp
+++ b/
src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp
@@
-1,4
+1,4
@@
-// Copyright (C) 2014-201
7
CEA/DEN, EDF R&D
+// Copyright (C) 2014-201
9
CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-12,10
+12,9
@@
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
//
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "GeomAlgoAPI_PointBuilder.h"
//
#include "GeomAlgoAPI_PointBuilder.h"
@@
-34,9
+33,11
@@
#include <Geom_Line.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAPI_ExtremaCurveCurve.hxx>
#include <Geom_Line.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAPI_ExtremaCurveCurve.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
//==================================================================================================
#include <TopoDS_Vertex.hxx>
//==================================================================================================
@@
-124,75
+125,72
@@
std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexOnEdge(
//==================================================================================================
std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByProjection(
//==================================================================================================
std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByProjection(
-
const std::shared_ptr<GeomAPI_Vertex> theVertex,
-
const std::shared_ptr<GeomAPI_Face> thePlan
e)
+ const std::shared_ptr<GeomAPI_Vertex> theVertex,
+
const std::shared_ptr<GeomAPI_Edge> theEdg
e)
{
std::shared_ptr<GeomAPI_Vertex> aVertex;
{
std::shared_ptr<GeomAPI_Vertex> aVertex;
- if
(!theVertex.get() || !thePlane.get() || !thePlane->isPlanar
()) {
+ if
(!theVertex.get() || !theEdge.get
()) {
return aVertex;
}
std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
return aVertex;
}
std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
-
std::shared_ptr<GeomAPI_Pln> aProjPln = thePlane->getPlane(
);
+
gp_Pnt aPnt(aProjPnt->x(), aProjPnt->y(), aProjPnt->z()
);
- std::shared_ptr<GeomAPI_Pnt> aPnt = aProjPln->project(aProjPnt);
+ TopoDS_Edge anEdge = TopoDS::Edge(theEdge->impl<TopoDS_Shape>());
+ double aFirstOnCurve, aLastOnCurve;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirstOnCurve, aLastOnCurve);
- if
(!aPnt.get
()) {
+ if
(aCurve.IsNull
()) {
return aVertex;
}
return aVertex;
}
- aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+ GeomAPI_ProjectPointOnCurve aProjection(aPnt, aCurve);
+
+ if (aProjection.NbPoints() != 0) {
+ gp_Pnt aNearestPoint = aProjection.NearestPoint();
+ aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z()));
+ }
return aVertex;
}
//==================================================================================================
return aVertex;
}
//==================================================================================================
-std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexBy
Inters
ection(
- const std::shared_ptr<GeomAPI_
Edge> theEdge1
,
- const std::shared_ptr<GeomAPI_
Edge> theEdge2
)
+std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexBy
Proj
ection(
+ const std::shared_ptr<GeomAPI_
Vertex> theVertex
,
+ const std::shared_ptr<GeomAPI_
Face> theFace
)
{
std::shared_ptr<GeomAPI_Vertex> 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();
+ 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 = aLin1->intersect(aLin2
);
+
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> GeomAlgoAPI_PointBuilder::vertexByIntersection(
return aVertex;
}
//==================================================================================================
std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByIntersection(
- const std::shared_ptr<GeomAPI_Edge> theEdge,
- const std::shared_ptr<GeomAPI_
Face> theFace
)
+ const std::shared_ptr<GeomAPI_Edge> theEdge
1
,
+ const std::shared_ptr<GeomAPI_
Edge> theEdge2
)
{
std::shared_ptr<GeomAPI_Vertex> aVertex;
{
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;
}
return aVertex;
}