1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include <Standard_Stream.hxx>
25 #include <GEOMImpl_ProjectionDriver.hxx>
27 #include <GEOMImpl_IMirror.hxx>
28 #include <GEOMImpl_IProjection.hxx>
29 #include <GEOMImpl_IProjOnCyl.hxx>
30 #include <GEOMImpl_Types.hxx>
31 #include <GEOM_Function.hxx>
32 #include <GEOMUtils.hxx>
33 #include <GEOMUtils_HTrsfCurve2d.hxx>
35 #include <Approx_Curve2d.hxx>
36 #include <Bnd_Box2d.hxx>
37 #include <BndLib_Add2dCurve.hxx>
38 #include <BRep_Tool.hxx>
39 #include <BRepAdaptor_Curve2d.hxx>
40 #include <BRepBuilderAPI_Transform.hxx>
41 #include <BRepBuilderAPI_MakeEdge.hxx>
42 #include <BRepBuilderAPI_MakeFace.hxx>
43 #include <BRepBuilderAPI_MakeVertex.hxx>
44 #include <BRepBuilderAPI_MakeWire.hxx>
45 #include <BRepClass_FaceClassifier.hxx>
46 #include <BRepExtrema_DistShapeShape.hxx>
47 #include <BRepLib.hxx>
48 #include <BRepOffsetAPI_NormalProjection.hxx>
49 #include <BRepTools.hxx>
50 #include <BRepTools_WireExplorer.hxx>
55 #include <TopoDS_Shape.hxx>
56 #include <TopoDS_Edge.hxx>
57 #include <TopoDS_Face.hxx>
58 #include <TopoDS_Vertex.hxx>
59 #include <TopoDS_Wire.hxx>
60 #include <TopTools_ListIteratorOfListOfShape.hxx>
62 #include <GeomAPI_ProjectPointOnSurf.hxx>
63 #include <Geom_Curve.hxx>
64 #include <Geom_CylindricalSurface.hxx>
65 #include <Geom_Plane.hxx>
66 #include <Geom2d_TrimmedCurve.hxx>
68 #include <gp_Trsf.hxx>
72 //=======================================================================
75 //=======================================================================
76 const Standard_GUID& GEOMImpl_ProjectionDriver::GetID()
78 static Standard_GUID aProjectionDriver ("FF1BBB70-5D14-4df2-980B-3A668264EA16");
79 return aProjectionDriver;
83 //=======================================================================
84 //function : GEOMImpl_ProjectionDriver
86 //=======================================================================
88 GEOMImpl_ProjectionDriver::GEOMImpl_ProjectionDriver()
92 //=======================================================================
95 //=======================================================================
96 Standard_Integer GEOMImpl_ProjectionDriver::Execute(LOGBOOK& log) const
98 if (Label().IsNull()) return 0;
99 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
101 if (aFunction.IsNull()) return 0;
103 Standard_Integer aType = aFunction->GetType();
105 if (aType == PROJECTION_COPY) {
110 GEOMImpl_IMirror TI (aFunction);
112 Handle(GEOM_Function) anOriginalFunction = TI.GetOriginal();
113 if (anOriginalFunction.IsNull()) return 0;
115 TopoDS_Shape anOriginal = anOriginalFunction->GetValue();
116 if (anOriginal.IsNull()) return 0;
118 // Source shape (point, edge or wire)
119 if (anOriginal.ShapeType() != TopAbs_VERTEX &&
120 anOriginal.ShapeType() != TopAbs_EDGE &&
121 anOriginal.ShapeType() != TopAbs_WIRE) {
122 Standard_ConstructionError::Raise
123 ("Projection aborted : the source shape is neither a vertex, nor an edge or a wire");
127 Handle(GEOM_Function) aTargetFunction = TI.GetPlane();
128 if (aTargetFunction.IsNull()) return 0;
129 TopoDS_Shape aFaceShape = aTargetFunction->GetValue();
130 //if (aFaceShape.IsNull() || aFaceShape.ShapeType() != TopAbs_FACE) {
131 // Standard_ConstructionError::Raise
132 // ("Projection aborted : the target shape is not a face");
135 Standard_Real tol = 1.e-4;
137 if (anOriginal.ShapeType() == TopAbs_VERTEX) {
138 if (aFaceShape.IsNull() || aFaceShape.ShapeType() != TopAbs_FACE) {
139 Standard_ConstructionError::Raise
140 ("Projection aborted : the target shape is not a face");
142 TopoDS_Face aFace = TopoDS::Face(aFaceShape);
143 Handle(Geom_Surface) surface = BRep_Tool::Surface(aFace);
144 double U1, U2, V1, V2;
145 //surface->Bounds(U1, U2, V1, V2);
146 BRepTools::UVBounds(aFace, U1, U2, V1, V2);
149 GeomAPI_ProjectPointOnSurf proj;
150 proj.Init(surface, U1, U2, V1, V2, tol);
152 gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(anOriginal));
154 if (!proj.IsDone()) {
155 Standard_ConstructionError::Raise
156 ("Projection aborted : the algorithm failed");
158 int nbPoints = proj.NbPoints();
160 Standard_ConstructionError::Raise("No solution found");
164 proj.LowerDistanceParameters(U, V);
165 gp_Pnt2d aProjPnt (U, V);
168 BRepClass_FaceClassifier aClsf (aFace, aProjPnt, tol);
169 if (aClsf.State() != TopAbs_IN && aClsf.State() != TopAbs_ON) {
171 double minDist = RealLast();
172 for (int i = 1; i <= nbPoints; i++) {
173 Standard_Real Ui, Vi;
174 proj.Parameters(i, Ui, Vi);
175 aProjPnt = gp_Pnt2d(Ui, Vi);
176 aClsf.Perform(aFace, aProjPnt, tol);
177 if (aClsf.State() == TopAbs_IN || aClsf.State() == TopAbs_ON) {
179 double dist = proj.Distance(i);
180 if (dist < minDist) {
188 Standard_ConstructionError::Raise("No solution found");
192 gp_Pnt surfPnt = surface->Value(U, V);
194 aShape = BRepBuilderAPI_MakeVertex(surfPnt).Shape();
197 //see BRepTest_BasicCommands.cxx for example of BRepOffsetAPI_NormalProjection
198 BRepOffsetAPI_NormalProjection OrtProj (aFaceShape);
199 OrtProj.Add(anOriginal);
201 // Compute maximal tolerance of projection.
202 TopExp_Explorer anExp(anOriginal,TopAbs_VERTEX);
203 Standard_Real aMaxTol = Precision::Confusion();
205 for(; anExp.More(); anExp.Next()) {
206 const TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current());
207 const Standard_Real aCurTol = BRep_Tool::Tolerance(aVtx);
209 if (aMaxTol < aCurTol) {
214 Standard_Real tol2d = Pow(aMaxTol, 2./3);
215 GeomAbs_Shape Continuity = GeomAbs_C2;
216 Standard_Integer MaxDeg = 14;
217 Standard_Integer MaxSeg = 16;
219 OrtProj.SetParams(aMaxTol, tol2d, Continuity, MaxDeg, MaxSeg);
223 } catch (Standard_Failure) {
224 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
225 TCollection_AsciiString aMsg (aFail->GetMessageString());
227 aMsg = "Projection aborted : possibly the source shape intersects the cylinder's axis";
228 Standard_ConstructionError::Raise(aMsg.ToCString());
230 if (!OrtProj.IsDone()) {
231 Standard_ConstructionError::Raise
232 ("Projection aborted : BRepOffsetAPI_NormalProjection failed");
235 aShape = OrtProj.Shape();
237 // check that the result shape is an empty compound
238 // (IPAL22905: TC650: Projection on face dialog problems)
239 if( !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND )
241 TopoDS_Iterator anIter( aShape );
243 Standard_ConstructionError::Raise("Projection aborted : empty compound produced");
247 if (aShape.IsNull()) return 0;
249 aFunction->SetValue(aShape);
250 #if OCC_VERSION_MAJOR < 7
251 log.SetTouched(Label());
253 log->SetTouched(Label());
255 } else if (aType == PROJECTION_ON_WIRE) {
256 // Perform projection of point on a wire or an edge.
257 GEOMImpl_IProjection aProj (aFunction);
258 Handle(GEOM_Function) aPointFunction = aProj.GetPoint();
259 Handle(GEOM_Function) aShapeFunction = aProj.GetShape();
261 if (aPointFunction.IsNull() || aShapeFunction.IsNull()) {
265 TopoDS_Shape aPoint = aPointFunction->GetValue();
266 TopoDS_Shape aShape = aShapeFunction->GetValue();
268 if (aPoint.IsNull() || aShape.IsNull()) {
272 // Check shape types.
273 if (aPoint.ShapeType() != TopAbs_VERTEX) {
274 Standard_ConstructionError::Raise
275 ("Projection aborted : the point is not a vertex");
278 if (aShape.ShapeType() != TopAbs_EDGE &&
279 aShape.ShapeType() != TopAbs_WIRE) {
280 Standard_ConstructionError::Raise
281 ("Projection aborted : the shape is neither an edge nor a wire");
284 // Perform projection.
285 BRepExtrema_DistShapeShape aDistShSh(aPoint, aShape, Extrema_ExtFlag_MIN);
287 if (aDistShSh.IsDone() == Standard_False) {
288 Standard_ConstructionError::Raise("Projection not done");
291 Standard_Boolean hasValidSolution = Standard_False;
292 Standard_Integer aNbSolutions = aDistShSh.NbSolution();
295 Standard_Real aTolConf = BRep_Tool::Tolerance(TopoDS::Vertex(aPoint));
296 Standard_Real aTolAng = 1.e-4;
298 for (i = 1; i <= aNbSolutions; i++) {
299 Standard_Boolean isValid = Standard_False;
300 BRepExtrema_SupportType aSupportType = aDistShSh.SupportTypeShape2(i);
301 TopoDS_Shape aSupportShape = aDistShSh.SupportOnShape2(i);
303 if (aSupportType == BRepExtrema_IsOnEdge) {
304 // Minimal distance inside edge is really a projection.
305 isValid = Standard_True;
306 aDistShSh.ParOnEdgeS2(i, aParam);
307 } else if (aSupportType == BRepExtrema_IsVertex) {
308 TopExp_Explorer anExp(aShape, TopAbs_EDGE);
310 if (aDistShSh.Value() <= aTolConf) {
311 // The point lies on the shape. This means this point
312 // is really a projection.
313 for (; anExp.More() && !isValid; anExp.Next()) {
314 TopoDS_Edge aCurEdge = TopoDS::Edge(anExp.Current());
316 if (aCurEdge.IsNull() == Standard_False) {
317 TopoDS_Vertex aVtx[2];
319 TopExp::Vertices(aCurEdge, aVtx[0], aVtx[1]);
321 for (int j = 0; j < 2; j++) {
322 if (aSupportShape.IsSame(aVtx[j])) {
323 // The current edge is a projection edge.
324 isValid = Standard_True;
325 aSupportShape = aCurEdge;
326 aParam = BRep_Tool::Parameter(aVtx[j], aCurEdge);
333 // Minimal distance to vertex is not always a real projection.
334 gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aPoint));
335 gp_Pnt aPrjPnt = BRep_Tool::Pnt(TopoDS::Vertex(aSupportShape));
336 gp_Vec aDProjP(aPrjPnt, aPnt);
338 for (; anExp.More() && !isValid; anExp.Next()) {
339 TopoDS_Edge aCurEdge = TopoDS::Edge(anExp.Current());
341 if (aCurEdge.IsNull() == Standard_False) {
342 TopoDS_Vertex aVtx[2];
344 TopExp::Vertices(aCurEdge, aVtx[0], aVtx[1]);
346 for (int j = 0; j < 2; j++) {
347 if (aSupportShape.IsSame(aVtx[j])) {
348 // Check if the point is a projection to the current edge.
349 Standard_Real anEdgePars[2];
350 Handle(Geom_Curve) aCurve =
351 BRep_Tool::Curve(aCurEdge, anEdgePars[0], anEdgePars[1]);
355 aParam = BRep_Tool::Parameter(aVtx[j], aCurEdge);
356 aCurve->D1(aParam, aVal, aD1);
358 if (Abs(aD1.Dot(aDProjP)) <= aTolAng) {
359 // The current edge is a projection edge.
360 isValid = Standard_True;
361 aSupportShape = aCurEdge;
373 if (hasValidSolution) {
374 Standard_ConstructionError::Raise
375 ("Projection aborted : multiple solutions");
378 // Store the valid solution.
379 hasValidSolution = Standard_True;
381 // Normalize parameter.
382 TopoDS_Edge aSupportEdge = TopoDS::Edge(aSupportShape);
383 Standard_Real aF, aL;
385 BRep_Tool::Range(aSupportEdge, aF, aL);
387 if (Abs(aL - aF) <= aTolConf) {
388 Standard_ConstructionError::Raise
389 ("Projection aborted : degenerated projection edge");
392 aParam = (aParam - aF)/(aL - aF);
395 // Compute edge index.
396 TopExp_Explorer anExp(aShape, TopAbs_EDGE);
399 for (; anExp.More(); anExp.Next(), anIndex++) {
400 if (aSupportShape.IsSame(anExp.Current())) {
401 aProj.SetIndex(anIndex);
407 Standard_ConstructionError::Raise
408 ("Projection aborted : Can't define edge index");
411 // Construct a projection vertex.
412 const gp_Pnt &aPntProj = aDistShSh.PointOnShape2(i);
413 TopoDS_Shape aProj = BRepBuilderAPI_MakeVertex(aPntProj).Shape();
415 aFunction->SetValue(aProj);
419 if (!hasValidSolution) {
420 Standard_ConstructionError::Raise("Projection aborted : no projection");
422 } else if (aType == PROJECTION_ON_CYLINDER) {
423 GEOMImpl_IProjOnCyl aProj (aFunction);
424 Handle(GEOM_Function) aShapeFunction = aProj.GetShape();
426 if (aShapeFunction.IsNull()) {
430 TopoDS_Shape aShape = aShapeFunction->GetValue();
432 if (aShape.IsNull()) {
437 const TopAbs_ShapeEnum aType = aShape.ShapeType();
438 const Standard_Real aRadius = aProj.GetRadius();
439 const Standard_Real aStartAngle = aProj.GetStartAngle();
440 const Standard_Real aLengthAngle = aProj.GetAngleLength();
441 const Standard_Real aRotationAngle = aProj.GetAngleRotation();
443 if (aType != TopAbs_WIRE && aType != TopAbs_FACE) {
447 if (aRadius <= Precision::Confusion()) {
451 TopoDS_Shape aProjShape = projectOnCylinder
452 (aShape, aRadius, aStartAngle, aLengthAngle, aRotationAngle);
454 if (aProjShape.IsNull()) {
458 aFunction->SetValue(aProjShape);
464 //================================================================================
466 * \brief Returns a name of creation operation and names and values of creation parameters
468 //================================================================================
470 bool GEOMImpl_ProjectionDriver::
471 GetCreationInformation(std::string& theOperationName,
472 std::vector<GEOM_Param>& theParams)
474 if (Label().IsNull()) return 0;
475 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
477 Standard_Integer aType = function->GetType();
479 theOperationName = "PROJECTION";
482 case PROJECTION_COPY:
484 GEOMImpl_IMirror aCI( function );
486 AddParam( theParams, "Source object", aCI.GetOriginal() );
487 AddParam( theParams, "Target face", aCI.GetPlane() );
490 case PROJECTION_ON_WIRE:
492 GEOMImpl_IProjection aProj (function);
494 AddParam(theParams, "Point", aProj.GetPoint());
495 AddParam(theParams, "Shape", aProj.GetShape());
499 case PROJECTION_ON_CYLINDER:
501 theOperationName = "PROJ_ON_CYL";
503 GEOMImpl_IProjOnCyl aProj (function);
504 const Standard_Real aLengthAngle = aProj.GetAngleLength();
506 AddParam(theParams, "Shape", aProj.GetShape());
507 AddParam(theParams, "Radius", aProj.GetRadius());
508 AddParam(theParams, "Start angle", aProj.GetStartAngle());
510 if (aLengthAngle >= 0.) {
511 AddParam(theParams, "Length angle", aLengthAngle);
514 AddParam(theParams, "Rotation angle", aProj.GetAngleRotation());
525 //================================================================================
527 * \brief Performs projection of a planar wire or a face on a cylinder.
529 //================================================================================
531 TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder
532 (const TopoDS_Shape &theShape,
533 const Standard_Real theRadius,
534 const Standard_Real theStartAngle,
535 const Standard_Real theAngleLength,
536 const Standard_Real theAngleRotation) const
538 TopoDS_Shape aResult;
541 const TopAbs_ShapeEnum aType = theShape.ShapeType();
544 if (aType == TopAbs_WIRE) {
545 // Try to create a planar face.
546 TopoDS_Wire aWire = TopoDS::Wire(theShape);
547 BRepBuilderAPI_MakeFace aMkFace(aWire, Standard_True);
549 if (aMkFace.IsDone()) {
550 aFace = aMkFace.Face();
552 // Check if the wire is a straight line.
553 TopExp_Explorer anEExp(aWire, TopAbs_EDGE);
556 for (; anEExp.More(); anEExp.Next()) {
557 anEdge = TopoDS::Edge(anEExp.Current());
559 if (!BRep_Tool::Degenerated(anEdge)) {
565 // Not degenerated edge found. Try to create a plane.
566 Standard_Real aPar[2];
567 Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aPar[0], aPar[1]);
568 gp_Pnt aP0 = aCurve->Value(aPar[0]);
569 gp_Pnt aP1 = aCurve->Value(0.5*(aPar[1] + aPar[0]));
570 gp_Vec aX(aP1.XYZ().Subtracted(aP0.XYZ()));
571 Standard_Real aTolConf = Precision::Confusion();
573 if (aX.Magnitude() > aTolConf) {
576 // Get the plane normal ortogonal to Z axis.
577 gp_Vec aZ(0., 0., 1.);
578 gp_Vec aN = aX.Crossed(aZ);
580 if (aN.Magnitude() <= aTolConf) {
581 // aX is parallel to aZ. Get the plane normal ortogonal to Y axis.
582 gp_Vec aY(0., 1., 0.);
587 if (aN.Magnitude() > aTolConf) {
588 gp_Ax3 anAxis(aP0, gp_Dir(aN), gp_Dir(aX));
589 Handle(Geom_Plane) aPlane = new Geom_Plane(anAxis);
590 BRepBuilderAPI_MakeFace aMkFace(aPlane, aWire);
592 if (aMkFace.IsDone()) {
593 aFace = aMkFace.Face();
599 } else if (aType == TopAbs_FACE) {
600 aFace = TopoDS::Face(theShape);
603 if (aFace.IsNull()) {
607 // Compute 2d translation transformation.
608 TopoDS_Wire anOuterWire = BRepTools::OuterWire(aFace);
609 BRepTools_WireExplorer aOWExp(anOuterWire, aFace);
611 if (!aOWExp.More()) {
616 // Rotate 2D presentation of face.
617 TopoDS_Vertex aFirstVertex = aOWExp.CurrentVertex();
618 TopoDS_Edge aFirstEdge = aOWExp.Current();
619 gp_Pnt aPnt = BRep_Tool::Pnt(aFirstVertex);
620 BRepAdaptor_Curve2d anAdaptorCurve(aFirstEdge, aFace);
621 Standard_Real aParam =
622 BRep_Tool::Parameter(aFirstVertex, aFirstEdge, aFace);
625 gp_Vec2d aVecU0(1., 0);
627 anAdaptorCurve.D1(aParam, aPntUV, aVecUV);
629 if (aVecUV.Magnitude() <= gp::Resolution()) {
633 if (aFirstEdge.Orientation() == TopAbs_REVERSED) {
637 const Standard_Real anAngle = aVecUV.Angle(aVecU0) + theAngleRotation;
638 const Standard_Boolean isToRotate = Abs(anAngle) > Precision::Angular();
641 Standard_Real aPar[2];
644 aRotTrsf.SetRotation(aPntUV, anAngle);
647 for (; aOWExp.More(); aOWExp.Next()) {
648 TopoDS_Edge anEdge = aOWExp.Current();
649 Handle(Geom2d_Curve) aCurve =
650 BRep_Tool::CurveOnSurface(anEdge, aFace, aPar[0], aPar[1]);
652 if (aCurve.IsNull()) {
657 aCurve = Handle(Geom2d_Curve)::DownCast(aCurve->Transformed(aRotTrsf));
660 BndLib_Add2dCurve::Add(aCurve, aPar[0], aPar[1], 0., aUVBox);
666 aUVBox.Get(aU[0], aV[0], aU[1], aV[1]);
668 // Compute anisotropic transformation from a face's 2d space
669 // to cylinder's 2d space.
670 GEOMUtils::Trsf2d aTrsf2d
671 (1./theRadius, 0., theStartAngle - aU[0]/theRadius,
672 0., 1., aPnt.Z() - aPntUV.Y());
674 // Compute scaling trsf.
675 const Standard_Boolean isToScale = theAngleLength >= Precision::Angular();
676 gp_Trsf2d aScaleTrsf;
679 // Perform 2d scaling.
680 gp_Pnt2d aMidPnt(0.5*(aU[1] + aU[0]), 0.5*(aV[1] + aV[0]));
681 const Standard_Real aScaleFactor = theAngleLength*theRadius/(aU[1] - aU[0]);
683 aTrsf2d.TransformD0(aMidPnt);
685 aScaleTrsf.SetScale(aMidPnt, aScaleFactor);
688 // Get 2d presentation of a face.
689 Handle(Geom_Surface) aCylinder =
690 new Geom_CylindricalSurface(gp_Ax3(), theRadius);
691 GeomAdaptor_Surface aGACyl(aCylinder);
692 TopExp_Explorer anExp(aFace, TopAbs_WIRE);
693 TopTools_ListOfShape aWires;
694 Standard_Real aUResol = aGACyl.UResolution(Precision::Confusion());
695 Standard_Real aVResol = aGACyl.VResolution(Precision::Confusion());
697 for (; anExp.More(); anExp.Next()) {
698 TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
699 BRepTools_WireExplorer aWExp(aWire, aFace);
700 BRepBuilderAPI_MakeWire aMkWire;
702 for (; aWExp.More(); aWExp.Next()) {
703 TopoDS_Edge anEdge = aWExp.Current();
704 Handle(Geom2d_Curve) aCurve =
705 BRep_Tool::CurveOnSurface(anEdge, aFace, aPar[0], aPar[1]);
707 if (aCurve.IsNull()) {
712 aCurve = Handle(Geom2d_Curve)::DownCast(aCurve->Transformed(aRotTrsf));
715 // Transform the curve to cylinder's parametric space.
716 #if OCC_VERSION_MAJOR < 7
717 GEOMUtils::Handle(HTrsfCurve2d) aTrsfCurve =
719 Handle(GEOMUtils::HTrsfCurve2d) aTrsfCurve =
721 new GEOMUtils::HTrsfCurve2d(aCurve, aPar[0], aPar[1], aTrsf2d);
722 Approx_Curve2d aConv (aTrsfCurve, aPar[0], aPar[1],
723 aUResol, aVResol, GeomAbs_C1,
726 if (!aConv.IsDone() && !aConv.HasResult()) {
730 Handle(Geom2d_Curve) aCylCurve = aConv.Curve();
733 aCylCurve->Transform(aScaleTrsf);
736 // Create edge and add it to the wire.
737 BRepBuilderAPI_MakeEdge aMkEdge(aCylCurve, aCylinder);
739 if (!aMkEdge.IsDone()) {
743 aMkWire.Add(aMkEdge.Edge());
745 if (!aMkWire.IsDone()) {
750 if (aWire.IsSame(anOuterWire)) {
751 // Make the outer wire first.
752 aWires.Prepend(aMkWire.Wire());
754 aWires.Append(aMkWire.Wire());
759 if (aWires.IsEmpty()) {
763 TopTools_ListIteratorOfListOfShape aWIter(aWires);
764 TopoDS_Wire aWire = TopoDS::Wire(aWIter.Value());
765 BRepBuilderAPI_MakeFace aMkFace(aCylinder, aWire);
767 if (!aMkFace.IsDone()) {
771 for (aWIter.Next(); aWIter.More(); aWIter.Next()) {
772 aWire = TopoDS::Wire(aWIter.Value());
775 if (!aMkFace.IsDone()) {
781 TopoDS_Face aCylFace = aMkFace.Face();
782 TopoDS_Shape aResShape;
784 BRepLib::BuildCurves3d(aCylFace);
787 if (aType == TopAbs_WIRE) {
788 TopExp_Explorer aResExp(aCylFace, TopAbs_WIRE);
790 if (aResExp.More()) {
791 aResShape = aResExp.Current();
794 aResShape = aCylFace;
797 if (aResShape.IsNull() == Standard_False) {
798 if (!GEOMUtils::CheckShape(aResShape, true)) {
799 if (!GEOMUtils::FixShapeTolerance(aResShape)) {
810 OCCT_IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ProjectionDriver,GEOM_BaseDriver);