1 // Created on: 1995-03-14
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <StdSelect_BRepSelectionTool.ixx>
23 #include <GeomAdaptor_Curve.hxx>
24 #include <BRepAdaptor_Curve.hxx>
25 #include <TopTools_IndexedMapOfShape.hxx>
27 #include <TopExp_Explorer.hxx>
28 #include <BRepTools_WireExplorer.hxx>
29 #include <Select3D_SensitivePoint.hxx>
30 #include <StdSelect_BRepOwner.hxx>
32 #include <BRepAdaptor_Curve.hxx>
33 #include <BRepAdaptor_Surface.hxx>
34 #include <GeomAbs_SurfaceType.hxx>
35 #include <BRepBndLib.hxx>
36 #include <Bnd_Box.hxx>
37 #include <BRep_Tool.hxx>
38 #include <Geom_Circle.hxx>
39 #include <Select3D_SensitiveCircle.hxx>
40 #include <Select3D_SensitiveCurve.hxx>
41 #include <Select3D_SensitiveSegment.hxx>
42 #include <Select3D_SensitiveWire.hxx>
43 #include <Select3D_SensitiveFace.hxx>
44 #include <Select3D_SensitiveBox.hxx>
45 #include <Select3D_SensitiveTriangulation.hxx>
46 #include <Select3D_SensitiveTriangle.hxx>
47 #include <Select3D_SensitiveGroup.hxx>
49 #include <Select3D_ListIteratorOfListOfSensitive.hxx>
50 #include <Select3D_ListOfSensitiveTriangle.hxx>
51 #include <TColgp_HArray1OfPnt.hxx>
52 #include <TColgp_SequenceOfPnt.hxx>
53 #include <TColStd_Array1OfReal.hxx>
54 #include <BRep_Tool.hxx>
55 #include <BRepTools.hxx>
56 #include <Select3D_TypeOfSensitivity.hxx>
57 #include <Precision.hxx>
58 #include <gp_Circ.hxx>
59 #include <GCPnts_TangentialDeflection.hxx>
60 #include <TopoDS_Wire.hxx>
61 #include <Poly_Array1OfTriangle.hxx>
62 #include <Poly_Polygon3D.hxx>
63 #include <Poly_PolygonOnTriangulation.hxx>
64 #include <Poly_Triangulation.hxx>
65 #include <BRepMesh_IncrementalMesh.hxx>
66 #include <Standard_NullObject.hxx>
67 #include <Standard_ErrorHandler.hxx>
69 //==================================================
72 //==================================================
73 void StdSelect_BRepSelectionTool
74 ::Load (const Handle(SelectMgr_Selection)& theSelection,
75 const TopoDS_Shape& theShape,
76 const TopAbs_ShapeEnum theType,
77 const Standard_Real theDeflection,
78 const Standard_Real theDeviationAngle,
79 const Standard_Boolean isAutoTriangulation,
80 const Standard_Integer thePriority,
81 const Standard_Integer theNbPOnEdge,
82 const Standard_Real theMaxParam)
84 Standard_Integer aPriority = (thePriority == -1) ? GetStandardPriority (theShape, theType) : thePriority;
86 if( isAutoTriangulation && !BRepTools::Triangulation (theShape, Precision::Infinite()) )
88 BRepMesh_IncrementalMesh(theShape, theDeflection, Standard_False, theDeviationAngle);
91 Handle(StdSelect_BRepOwner) aBrepOwner;
100 case TopAbs_COMPSOLID:
102 TopTools_IndexedMapOfShape aSubShapes;
103 TopExp::MapShapes (theShape, theType, aSubShapes);
105 Standard_Boolean isComesFromDecomposition = !((aSubShapes.Extent() == 1) && (theShape == aSubShapes (1)));
106 for (Standard_Integer aShIndex = 1; aShIndex <= aSubShapes.Extent(); ++aShIndex)
108 const TopoDS_Shape& aSubShape = aSubShapes (aShIndex);
109 aBrepOwner = new StdSelect_BRepOwner (aSubShape, aPriority, isComesFromDecomposition);
110 ComputeSensitive (aSubShape, aBrepOwner,
116 isAutoTriangulation);
122 aBrepOwner = new StdSelect_BRepOwner (theShape, aPriority);
123 ComputeSensitive (theShape, aBrepOwner,
129 isAutoTriangulation);
134 //==================================================
137 //==================================================
138 void StdSelect_BRepSelectionTool
139 ::Load (const Handle(SelectMgr_Selection)& theSelection,
140 const Handle(SelectMgr_SelectableObject)& theSelectableObj,
141 const TopoDS_Shape& theShape,
142 const TopAbs_ShapeEnum theType,
143 const Standard_Real theDeflection,
144 const Standard_Real theDeviationAngle,
145 const Standard_Boolean isAutoTriangulation,
146 const Standard_Integer thePriority,
147 const Standard_Integer theNbPOnEdge,
148 const Standard_Real theMaxParam)
160 // loading of selectables...
161 for (theSelection->Init(); theSelection->More(); theSelection->Next())
163 Handle(SelectMgr_EntityOwner) anOwner
164 = Handle(SelectMgr_EntityOwner)::DownCast (theSelection->Sensitive()->OwnerId());
165 anOwner->Set (theSelectableObj);
169 //==================================================
170 // Function: ComputeSensitive
172 //==================================================
173 void StdSelect_BRepSelectionTool
174 ::ComputeSensitive (const TopoDS_Shape& theShape,
175 const Handle(StdSelect_BRepOwner)& theOwner,
176 const Handle(SelectMgr_Selection)& theSelection,
177 const Standard_Real theDeflection,
178 const Standard_Real theDeviationAngle,
179 const Standard_Integer theNbPOnEdge,
180 const Standard_Real theMaxParam,
181 const Standard_Boolean isAutoTriangulation)
183 switch (theShape.ShapeType())
187 theSelection->Add (new Select3D_SensitivePoint
188 (theOwner, BRep_Tool::Pnt (TopoDS::Vertex (theShape))));
193 Handle(Select3D_SensitiveEntity) aSensitive;
194 GetEdgeSensitive (theShape, theOwner, theSelection,
195 theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam,
197 if (!aSensitive.IsNull())
199 theSelection->Add (aSensitive);
205 BRepTools_WireExplorer aWireExp (TopoDS::Wire (theShape));
206 Handle (Select3D_SensitiveEntity) aSensitive;
207 Handle (Select3D_SensitiveWire) aWireSensitive = new Select3D_SensitiveWire (theOwner);
208 theSelection->Add (aWireSensitive);
209 while (aWireExp.More())
211 GetEdgeSensitive (aWireExp.Current(), theOwner, theSelection,
212 theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam,
214 if (!aSensitive.IsNull())
216 aWireSensitive->Add (aSensitive);
224 const TopoDS_Face& aFace = TopoDS::Face (theShape);
225 Select3D_ListOfSensitive aSensitiveList;
226 GetSensitiveForFace (aFace, theOwner,
228 isAutoTriangulation, theNbPOnEdge, theMaxParam);
229 for (Select3D_ListIteratorOfListOfSensitive aSensIter (aSensitiveList);
230 aSensIter.More(); aSensIter.Next())
232 theSelection->Add (aSensIter.Value());
238 case TopAbs_COMPSOLID:
240 TopTools_IndexedMapOfShape aSubfacesMap;
241 TopExp::MapShapes (theShape, TopAbs_FACE, aSubfacesMap);
242 for (Standard_Integer aShIndex = 1; aShIndex <= aSubfacesMap.Extent(); ++aShIndex)
244 ComputeSensitive (aSubfacesMap (aShIndex), theOwner,
246 theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam, isAutoTriangulation);
250 case TopAbs_COMPOUND:
253 TopExp_Explorer anExp;
255 for (anExp.Init (theShape, TopAbs_VERTEX, TopAbs_EDGE); anExp.More(); anExp.Next())
257 ComputeSensitive (anExp.Current(), theOwner,
259 theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam, isAutoTriangulation);
262 for (anExp.Init (theShape, TopAbs_EDGE, TopAbs_FACE); anExp.More(); anExp.Next())
264 ComputeSensitive (anExp.Current(), theOwner,
266 theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam, isAutoTriangulation);
269 for (anExp.Init (theShape, TopAbs_WIRE, TopAbs_FACE); anExp.More(); anExp.Next())
271 ComputeSensitive (anExp.Current(), theOwner,
273 theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam, isAutoTriangulation);
277 TopTools_IndexedMapOfShape aSubfacesMap;
278 TopExp::MapShapes (theShape, TopAbs_FACE, aSubfacesMap);
279 for (Standard_Integer aShIndex = 1; aShIndex <= aSubfacesMap.Extent(); ++aShIndex)
281 ComputeSensitive (aSubfacesMap (aShIndex), theOwner,
283 theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam, isAutoTriangulation);
289 //==================================================
290 // Function: GetPointsFromPolygon
292 //==================================================
293 static Handle(TColgp_HArray1OfPnt) GetPointsFromPolygon (const TopoDS_Edge& theEdge,
294 const Standard_Real theDeflection)
296 Handle(TColgp_HArray1OfPnt) aResultPoints;
298 Standard_Real fi, la;
299 Handle(Geom_Curve) CC3d = BRep_Tool::Curve (theEdge, fi, la);
301 TopLoc_Location aLocation;
302 Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (theEdge, aLocation);
303 if (!aPolygon.IsNull())
305 Standard_Boolean isOK = aPolygon->Deflection() <= theDeflection;
306 isOK = isOK || (CC3d.IsNull());
309 const TColgp_Array1OfPnt& aNodes = aPolygon->Nodes();
310 aResultPoints = new TColgp_HArray1OfPnt (1, aNodes.Length());
311 if (aLocation.IsIdentity())
313 for (Standard_Integer aNodeId (aNodes.Lower()), aPntId (1); aNodeId <= aNodes.Upper(); ++aNodeId, ++aPntId)
315 aResultPoints->SetValue (aPntId, aNodes.Value (aNodeId));
320 for (Standard_Integer aNodeId (aNodes.Lower()), aPntId (1); aNodeId <= aNodes.Upper(); ++aNodeId, ++aPntId)
322 aResultPoints->SetValue (aPntId, aNodes.Value (aNodeId).Transformed (aLocation));
325 return aResultPoints;
329 Handle(Poly_Triangulation) aTriangulation;
330 Handle(Poly_PolygonOnTriangulation) anHIndices;
331 BRep_Tool::PolygonOnTriangulation (theEdge, anHIndices, aTriangulation, aLocation);
332 if (!anHIndices.IsNull())
334 Standard_Boolean isOK = anHIndices->Deflection() <= theDeflection;
335 isOK = isOK || (CC3d.IsNull());
338 const TColStd_Array1OfInteger& anIndices = anHIndices->Nodes();
339 const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes();
341 aResultPoints = new TColgp_HArray1OfPnt (1, anIndices.Length());
343 if (aLocation.IsIdentity())
345 for (Standard_Integer anIndex (anIndices.Lower()), aPntId (1); anIndex <= anIndices.Upper(); ++anIndex, ++aPntId)
347 aResultPoints->SetValue (aPntId, aNodes (anIndices (anIndex)));
352 for (Standard_Integer anIndex (anIndices.Lower()), aPntId (1); anIndex <= anIndices.Upper(); ++anIndex, ++aPntId)
354 aResultPoints->SetValue (aPntId, aNodes (anIndices (anIndex)).Transformed (aLocation));
357 return aResultPoints;
360 return aResultPoints;
363 //==================================================
364 // Function: FindLimits
366 //==================================================
367 static Standard_Boolean FindLimits (const Adaptor3d_Curve& theCurve,
368 const Standard_Real theLimit,
369 Standard_Real& theFirst,
370 Standard_Real& theLast)
372 theFirst = theCurve.FirstParameter();
373 theLast = theCurve.LastParameter();
374 Standard_Boolean isFirstInf = Precision::IsNegativeInfinite (theFirst);
375 Standard_Boolean isLastInf = Precision::IsPositiveInfinite (theLast);
376 if (isFirstInf || isLastInf)
379 Standard_Real aDelta = 1.0;
380 Standard_Integer anIterCount = 0;
381 if (isFirstInf && isLastInf)
384 if (anIterCount++ >= 100000) return Standard_False;
388 theCurve.D0 (theFirst, aPnt1);
389 theCurve.D0 (theLast, aPnt2);
390 } while (aPnt1.Distance (aPnt2) < theLimit);
394 theCurve.D0 (theLast, aPnt2);
396 if (anIterCount++ >= 100000) return Standard_False;
398 theFirst = theLast - aDelta;
399 theCurve.D0 (theFirst, aPnt1);
400 } while (aPnt1.Distance (aPnt2) < theLimit);
404 theCurve.D0 (theFirst, aPnt1);
406 if (anIterCount++ >= 100000) return Standard_False;
408 theLast = theFirst + aDelta;
409 theCurve.D0 (theLast, aPnt2);
410 } while (aPnt1.Distance (aPnt2) < theLimit);
413 return Standard_True;
416 //=====================================================
417 // Function : GetEdgeSensitive
418 // Purpose : create a sensitive edge to add it
419 // in computeselection to "aselection" (case of selection of an edge)
420 // or to "aSensitiveWire" (case of selection of a wire; in this case,
421 // the sensitive wire is added to "aselection" )
422 // odl - for selection by rectangle -
423 //=====================================================
424 void StdSelect_BRepSelectionTool
425 ::GetEdgeSensitive (const TopoDS_Shape& theShape,
426 const Handle(StdSelect_BRepOwner)& theOwner,
427 const Handle(SelectMgr_Selection)& theSelection,
428 const Standard_Real theDeflection,
429 const Standard_Real theDeviationAngle,
430 const Standard_Integer theNbPOnEdge,
431 const Standard_Real theMaxParam,
432 Handle(Select3D_SensitiveEntity)& theSensitive)
434 const TopoDS_Edge& anEdge = TopoDS::Edge (theShape);
435 BRepAdaptor_Curve cu3d;
438 cu3d.Initialize (anEdge);
439 } catch (Standard_NullObject) {
443 // try to get points from existing polygons
444 Handle(TColgp_HArray1OfPnt) aPoints = GetPointsFromPolygon (anEdge, theDeflection);
445 if (!aPoints.IsNull() && aPoints->Length() > 0)
447 theSensitive = new Select3D_SensitiveCurve (theOwner, aPoints);
451 Standard_Real aParamFirst = cu3d.FirstParameter();
452 Standard_Real aParamLast = cu3d.LastParameter();
453 switch (cu3d.GetType())
457 BRep_Tool::Range (anEdge, aParamFirst, aParamLast);
458 theSensitive = new Select3D_SensitiveSegment (theOwner,
459 cu3d.Value (aParamFirst),
460 cu3d.Value (aParamLast));
465 Handle (Geom_Circle) aCircle = new Geom_Circle (cu3d.Circle());
466 if (aCircle->Radius() <= Precision::Confusion())
468 theSelection->Add (new Select3D_SensitivePoint (theOwner, aCircle->Location()));
472 theSensitive = new Select3D_SensitiveCircle (theOwner, aCircle,
473 aParamFirst, aParamLast, Standard_False, 16);
479 // reproduce drawing behaviour
480 // TODO: remove copy-paste from StdPrs_Curve and some others...
481 if (FindLimits (cu3d, theMaxParam, aParamFirst, aParamLast))
483 Standard_Integer aNbIntervals = cu3d.NbIntervals (GeomAbs_C1);
484 TColStd_Array1OfReal anIntervals (1, aNbIntervals + 1);
485 cu3d.Intervals (anIntervals, GeomAbs_C1);
486 Standard_Real aV1, aV2;
487 Standard_Integer aNumberOfPoints;
488 TColgp_SequenceOfPnt aPointsSeq;
489 for (Standard_Integer anIntervalId = 1; anIntervalId <= aNbIntervals; ++anIntervalId)
491 aV1 = anIntervals (anIntervalId);
492 aV2 = anIntervals (anIntervalId + 1);
493 if (aV2 > aParamFirst && aV1 < aParamLast)
495 aV1 = Max (aV1, aParamFirst);
496 aV2 = Min (aV2, aParamLast);
498 GCPnts_TangentialDeflection anAlgo (cu3d, aV1, aV2, theDeviationAngle, theDeflection);
499 aNumberOfPoints = anAlgo.NbPoints();
501 for (Standard_Integer aPntId = 1; aPntId < aNumberOfPoints; ++aPntId)
503 aPointsSeq.Append (anAlgo.Value (aPntId));
505 if (aNumberOfPoints > 0 && anIntervalId == aNbIntervals)
507 aPointsSeq.Append (anAlgo.Value (aNumberOfPoints));
512 aPoints = new TColgp_HArray1OfPnt (1, aPointsSeq.Length());
513 for (Standard_Integer aPntId = 1; aPntId <= aPointsSeq.Length(); ++aPntId)
515 aPoints->SetValue (aPntId, aPointsSeq.Value (aPntId));
517 theSensitive = new Select3D_SensitiveCurve (theOwner, aPoints);
521 // simple subdivisions
522 Standard_Integer nbintervals = 1;
523 if (cu3d.GetType() == GeomAbs_BSplineCurve)
525 nbintervals = cu3d.NbKnots() - 1;
526 nbintervals = Max (1, nbintervals / 3);
529 Standard_Real aParam;
530 Standard_Integer aPntNb = Max (2, theNbPOnEdge * nbintervals);
531 Standard_Real aParamDelta = (aParamLast - aParamFirst) / (aPntNb - 1);
532 Handle(TColgp_HArray1OfPnt) aPointArray = new TColgp_HArray1OfPnt (1, aPntNb);
533 for (Standard_Integer aPntId = 1; aPntId <= aPntNb; ++aPntId)
535 aParam = aParamFirst + aParamDelta * (aPntId - 1);
536 aPointArray->SetValue (aPntId, cu3d.Value (aParam));
538 theSensitive = new Select3D_SensitiveCurve (theOwner, aPointArray);
544 //=====================================================
545 // Function : GetStandardPriority
547 //=====================================================
548 Standard_Integer StdSelect_BRepSelectionTool::GetStandardPriority (const TopoDS_Shape& theShape,
549 const TopAbs_ShapeEnum theType)
553 case TopAbs_VERTEX: return 8;
554 case TopAbs_EDGE: return 7;
555 case TopAbs_WIRE: return 6;
556 case TopAbs_FACE: return 5;
559 switch (theShape.ShapeType())
561 case TopAbs_VERTEX: return 9;
562 case TopAbs_EDGE: return 8;
563 case TopAbs_WIRE: return 7;
564 case TopAbs_FACE: return 6;
565 case TopAbs_SHELL: return 5;
566 case TopAbs_COMPOUND:
567 case TopAbs_COMPSOLID:
576 //=======================================================================
577 //function : GetSensitiveEntityForFace
579 //=======================================================================
580 Standard_Boolean StdSelect_BRepSelectionTool
581 ::GetSensitiveForFace (const TopoDS_Face& theFace,
582 const Handle(StdSelect_BRepOwner)& theOwner,
583 Select3D_ListOfSensitive& theSensitiveList,
584 const Standard_Boolean /*theAutoTriangulation*/,
585 const Standard_Integer NbPOnEdge,
586 const Standard_Real theMaxParam,
587 const Standard_Boolean theInteriorFlag)
589 // check if there is triangulation of the face...
590 TopLoc_Location aLoc;
591 Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (theFace, aLoc);
593 if (!aTriangulation.IsNull())
595 Handle(Select3D_SensitiveTriangulation) STG = new Select3D_SensitiveTriangulation (theOwner, aTriangulation, aLoc, theInteriorFlag);
596 theSensitiveList.Append (STG);
597 return Standard_True;
600 // for faces with triangulation bugs or without autotriangulation ....
601 // very ugly and should not even exist ...
602 BRepAdaptor_Surface BS;
603 BS.Initialize (theFace);
605 Standard_Real FirstU = BS.FirstUParameter() <= -Precision::Infinite() ? -theMaxParam : BS.FirstUParameter();
606 Standard_Real LastU = BS.LastUParameter() >= Precision::Infinite() ? theMaxParam : BS.LastUParameter();
607 Standard_Real FirstV = BS.FirstVParameter() <= -Precision::Infinite() ? -theMaxParam : BS.FirstVParameter();
608 Standard_Real LastV = BS.LastVParameter() >= Precision::Infinite() ? theMaxParam : BS.LastVParameter();
610 if (BS.GetType() == GeomAbs_Plane)
613 Handle(TColgp_HArray1OfPnt) P = new TColgp_HArray1OfPnt (1, 5);
614 BS.D0 (FirstU, FirstV, pcur);
615 P->SetValue (1, pcur);
616 BS.D0 (LastU, FirstV, pcur);
617 P->SetValue (2, pcur);
618 BS.D0 (LastU, LastV, pcur);
619 P->SetValue (3, pcur);
620 BS.D0 (FirstU, LastV, pcur);
621 P->SetValue (4, pcur);
622 P->SetValue (5, P->Value (1));
623 // if the plane is "infinite", it is sensitive only on the border limited by MaxParam
624 if (FirstU == -theMaxParam && LastU == theMaxParam && FirstV == -theMaxParam && LastV == theMaxParam)
626 theSensitiveList.Append (new Select3D_SensitiveFace (theOwner, P, Select3D_TOS_BOUNDARY));
630 Select3D_TypeOfSensitivity TS = theInteriorFlag ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
631 theSensitiveList.Append (new Select3D_SensitiveFace (theOwner, P, TS));
633 return Standard_True;
636 // This is construction of a sevsitive polygon from the exterior contour of the face...
637 // It is not good at all, but...
639 TopExp_Explorer anExpWiresInFace (theFace, TopAbs_WIRE);
640 if (anExpWiresInFace.More())
642 // believing that this is the first... to be seen
643 aWire = TopoDS::Wire (anExpWiresInFace.Current());
647 return Standard_False;
650 TColgp_SequenceOfPnt WirePoints;
651 Standard_Boolean FirstExp = Standard_True;
652 Standard_Real wf, wl;
653 BRepAdaptor_Curve cu3d;
654 for (BRepTools_WireExplorer aWireExplorer (aWire);
655 aWireExplorer.More(); aWireExplorer.Next())
657 cu3d.Initialize (aWireExplorer.Current());
658 BRep_Tool::Range (aWireExplorer.Current(), wf, wl);
659 if (Abs (wf - wl) <= Precision::Confusion())
662 cout<<" StdSelect_BRepSelectionTool : Curve where ufirst = ulast ...."<<endl;
669 if (aWireExplorer.Orientation() == TopAbs_FORWARD)
671 WirePoints.Append (cu3d.Value (wf));
675 WirePoints.Append (cu3d.Value (wl));
677 FirstExp = Standard_False;
680 switch (cu3d.GetType())
684 WirePoints.Append (cu3d.Value ((aWireExplorer.Orientation() == TopAbs_FORWARD) ? wl : wf));
689 if (2 * M_PI - Abs (wl - wf) <= Precision::Confusion())
691 if (BS.GetType() == GeomAbs_Cylinder ||
692 BS.GetType() == GeomAbs_Torus ||
693 BS.GetType() == GeomAbs_Cone ||
694 BS.GetType() == GeomAbs_BSplineSurface) // beuurkk pour l'instant...
696 Standard_Real ff = wf ,ll = wl;
697 Standard_Real dw =(Max (wf, wl) - Min (wf, wl)) / (Standard_Real )Max (2, NbPOnEdge - 1);
698 if (aWireExplorer.Orientation() == TopAbs_FORWARD)
700 for (Standard_Real wc = wf + dw; wc <= wl; wc += dw)
702 WirePoints.Append (cu3d.Value (wc));
705 else if (aWireExplorer.Orientation() == TopAbs_REVERSED)
707 for (Standard_Real wc = ll - dw; wc >= ff; wc -= dw)
709 WirePoints.Append (cu3d.Value (wc));
715 if (cu3d.Circle().Radius() <= Precision::Confusion())
717 theSensitiveList.Append (new Select3D_SensitivePoint (theOwner, cu3d.Circle().Location()));
721 theSensitiveList.Append (new Select3D_SensitiveCircle (theOwner, new Geom_Circle (cu3d.Circle()), theInteriorFlag, 16));
727 Standard_Real ff = wf, ll = wl;
728 Standard_Real dw = (Max (wf, wl) - Min (wf, wl)) / (Standard_Real )Max (2, NbPOnEdge - 1);
729 if (aWireExplorer.Orientation() == TopAbs_FORWARD)
731 for (Standard_Real wc = wf + dw; wc <= wl; wc += dw)
733 WirePoints.Append (cu3d.Value (wc));
736 else if (aWireExplorer.Orientation() == TopAbs_REVERSED)
738 for (Standard_Real wc = ll - dw; wc >= ff; wc -= dw)
740 WirePoints.Append (cu3d.Value (wc));
748 Standard_Real ff = wf, ll = wl;
749 Standard_Real dw = (Max (wf, wl) - Min (wf, wl)) / (Standard_Real )Max (2, NbPOnEdge - 1);
750 if (aWireExplorer.Orientation()==TopAbs_FORWARD)
752 for (Standard_Real wc = wf + dw; wc <= wl; wc += dw)
754 WirePoints.Append (cu3d.Value (wc));
757 else if (aWireExplorer.Orientation() == TopAbs_REVERSED)
759 for (Standard_Real wc = ll - dw; wc >= ff; wc -= dw)
761 WirePoints.Append (cu3d.Value (wc));
768 Standard_Integer ArrayPosition = WirePoints.Length();
770 Handle(TColgp_HArray1OfPnt) facepoints = new TColgp_HArray1OfPnt (1, ArrayPosition);
771 for (Standard_Integer I = 1; I <= ArrayPosition; ++I)
773 facepoints->SetValue (I, WirePoints.Value(I));
776 if ((facepoints->Array1()).Length() > 1)
777 { //1 if only one circular edge
778 Select3D_TypeOfSensitivity TS = theInteriorFlag ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
779 theSensitiveList.Append (new Select3D_SensitiveFace (theOwner, facepoints, TS));
781 return Standard_True;