6 #include <TopoDS_Shape.hxx>
7 #include <TopoDS_Shell.hxx>
8 #include <TopoDS_Face.hxx>
9 #include <BRepTools.hxx>
10 #include <TopTools_SequenceOfShape.hxx>
11 #include <Handle_Standard_Transient.hxx>
12 #include <TColStd_SequenceOfTransient.hxx>
13 #include <TColStd_HSequenceOfTransient.hxx>
14 #include <TopExp_Explorer.hxx>
17 #include <GeomAPI_ProjectPointOnSurf.hxx>
18 #include <GeomAPI_ProjectPointOnCurve.hxx>
19 #include <Standard_Real.hxx>
20 #include <Standard_Integer.hxx>
21 #include <BRep_Tool.hxx>
22 #include <Geom_Surface.hxx>
23 #include <Geom_Plane.hxx>
24 #include <Prs3d_ShapeTool.hxx>
25 #include <Bnd_Box.hxx>
28 #include <BRepBuilderAPI_MakeFace.hxx>
29 #include <BRepBuilderAPI_MakeEdge.hxx>
30 #include <GeomAPI_IntSS.hxx>
31 #include <TopoDS_Wire.hxx>
32 #include <BRepBuilderAPI_MakePolygon.hxx>
33 #include <Geom_Curve.hxx>
34 #include <Geom_BoundedCurve.hxx>
35 #include <Geom_TrimmedCurve.hxx>
36 #include <TColGeom_Array1OfCurve.hxx>
37 #include <GeomAPI_IntCS.hxx>
38 #include <BRepBuilderAPI_MakeEdge.hxx>
39 #include <GeomLib_Tool.hxx>
40 #include <GCPnts_AbscissaPoint.hxx>
41 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
42 #include <ShapeAnalysis_Curve.hxx>
43 #include <BRepAdaptor_Curve.hxx>
63 TopExp_Explorer edgeExplorer(sh , TopAbs_EDGE);
64 unsigned int n_edges = 0;
65 while (edgeExplorer.More())
72 "split your geometry."));
85 ExcMessage(
"Distance should be between 0. and 1."));
87 gp_Pnt P0(p0(0),p0(1),p0(2));
88 gp_Pnt P1(p1(0),p1(1),p1(2));
90 TopExp_Explorer edgeExplorer(sh , TopAbs_EDGE);
93 edge = TopoDS::Edge(edgeExplorer.Current());
94 TopLoc_Location L = sh.Location();
104 BRepAdaptor_Curve gg_curve(edge);
105 First = gg_curve.FirstParameter();
106 Last = gg_curve.LastParameter();
122 ShapeAnalysis_Curve curve_analysis;
124 double off = curve_analysis.Project(gg_curve, P0, tolerance, proj, t0, Standard_True);
125 AssertThrow( (off < 1000*tolerance),
ExcMessage(
"Point of the edge to be refined is not on curve."));
126 off = curve_analysis.Project(gg_curve, P1, tolerance, proj, t1, Standard_True);
127 AssertThrow( (off < 1000*tolerance),
ExcMessage(
"Point of the edge to be refined is not on curve."));
139 (t0 <= Last+1000*tolerance),
142 (t1 <= Last+1000*tolerance),
151 double direction = t1 > t0 ? 1.0 : -1.0;
154 Standard_Real arcLength = GCPnts_AbscissaPoint::Length(gg_curve,t0,t1);
156 GCPnts_AbscissaPoint AP(gg_curve, direction*arcLength*distance, t0);
165 gp_Pnt P2 = gg_curve.Value(t2);
170 projected_point(0) = P2.X();
171 projected_point(1) = P2.Y();
172 projected_point(2) = P2.Z();
174 return projected_point;
181 return arclength_projection(line->vertex(0), line->vertex(1));
virtual Point< 3 > get_new_point_on_line(const Triangulation< 2, 3 >::line_iterator &line) const
Point< 3 > arclength_projection(const Point< 3 > &p0, const Point< 3 > &p1, const double distance=.5) const
#define AssertThrow(cond, exc)
static::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
ArclengthProjection(const TopoDS_Shape &sh, double tolerance=1e-7)
We collect in this namespace all utilities which operate on OpenCascade entities which don't need cla...