1 // Created on: 1994-03-23
2 // Created by: Jean Marc LACHAUME
3 // Copyright (c) 1994-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.
23 #include <Geom2dHatch_Intersector.ixx>
25 #include <Geom2d_Line.hxx>
26 #include <Precision.hxx>
27 #include <Geom2dLProp_CLProps2d.hxx>
30 //=======================================================================
31 //function : Geom2dHatch_Intersector
33 //=======================================================================
35 Geom2dHatch_Intersector::Geom2dHatch_Intersector() :
36 myConfusionTolerance(0.0),
37 myTangencyTolerance(0.0)
41 //=======================================================================
44 //=======================================================================
46 void Geom2dHatch_Intersector::Perform(const gp_Lin2d& L,
47 const Standard_Real P,
48 const Standard_Real Tol,
49 const Geom2dAdaptor_Curve& C)
52 //Standard_Real pfbid,plbid;
55 DL.SetValues(L.Location(),0.,Tol,ElCLib::Value(P,L),P,Tol);
57 DL.SetValues(L.Location(),0.,Tol,Standard_True);
59 IntRes2d_Domain DE(C.Value(C.FirstParameter()),
60 C.FirstParameter(),Precision::PIntersection(),
61 C.Value(C.LastParameter()),
62 C.LastParameter(),Precision::PIntersection());
64 Handle(Geom2d_Line) GL= new Geom2d_Line(L);
65 Geom2dAdaptor_Curve CGA(GL);
66 void *ptrpoureviterlesproblemesdeconst = (void *)(&C);
68 Geom2dInt_GInter Inter(CGA,
70 *((Geom2dAdaptor_Curve *)ptrpoureviterlesproblemesdeconst),
72 Precision::PConfusion(),
73 Precision::PIntersection());
74 this->SetValues(Inter);
77 //=======================================================================
78 //function : LocalGeometry
80 //=======================================================================
82 void Geom2dHatch_Intersector::LocalGeometry(const Geom2dAdaptor_Curve& E,
83 const Standard_Real U,
86 Standard_Real& C) const
89 Geom2dLProp_CLProps2d Prop(E.Curve(),U,2,Precision::PConfusion());
91 if(!Prop.IsTangentDefined()) return;
95 if (C > Precision::PConfusion() && C<RealLast())
98 Norm.SetCoord(Tang.Y(),-Tang.X());