1 // Created on: 1994-03-23
2 // Created by: Jean Marc LACHAUME
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <Geom2dHatch_Intersector.ixx>
19 #include <Geom2d_Line.hxx>
20 #include <Precision.hxx>
21 #include <Geom2dLProp_CLProps2d.hxx>
24 //=======================================================================
25 //function : Geom2dHatch_Intersector
27 //=======================================================================
29 Geom2dHatch_Intersector::Geom2dHatch_Intersector() :
30 myConfusionTolerance(0.0),
31 myTangencyTolerance(0.0)
35 //=======================================================================
38 //=======================================================================
40 void Geom2dHatch_Intersector::Perform(const gp_Lin2d& L,
41 const Standard_Real P,
42 const Standard_Real Tol,
43 const Geom2dAdaptor_Curve& C)
46 //Standard_Real pfbid,plbid;
49 DL.SetValues(L.Location(),0.,Tol,ElCLib::Value(P,L),P,Tol);
51 DL.SetValues(L.Location(),0.,Tol,Standard_True);
53 IntRes2d_Domain DE(C.Value(C.FirstParameter()),
54 C.FirstParameter(),Precision::PIntersection(),
55 C.Value(C.LastParameter()),
56 C.LastParameter(),Precision::PIntersection());
58 Handle(Geom2d_Line) GL= new Geom2d_Line(L);
59 Geom2dAdaptor_Curve CGA(GL);
60 void *ptrpoureviterlesproblemesdeconst = (void *)(&C);
62 Geom2dInt_GInter Inter(CGA,
64 *((Geom2dAdaptor_Curve *)ptrpoureviterlesproblemesdeconst),
66 Precision::PConfusion(),
67 Precision::PIntersection());
68 this->SetValues(Inter);
71 //=======================================================================
72 //function : LocalGeometry
74 //=======================================================================
76 void Geom2dHatch_Intersector::LocalGeometry(const Geom2dAdaptor_Curve& E,
77 const Standard_Real U,
80 Standard_Real& C) const
83 Geom2dLProp_CLProps2d Prop(E.Curve(),U,2,Precision::PConfusion());
85 if(!Prop.IsTangentDefined()) return;
89 if (C > Precision::PConfusion() && C<RealLast())
92 Norm.SetCoord(Tang.Y(),-Tang.X());