0026595: Lost some comments in OCCT-code after cdl elimination
[occt.git] / src / Geom2dHatch / Geom2dHatch_Intersector.cxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <ElCLib.hxx>
19 #include <Geom2d_Line.hxx>
20 #include <Geom2dAdaptor_Curve.hxx>
21 #include <Geom2dHatch_Intersector.hxx>
22 #include <Geom2dLProp_CLProps2d.hxx>
23 #include <gp_Dir2d.hxx>
24 #include <gp_Lin2d.hxx>
25 #include <Precision.hxx>
26
27 //=======================================================================
28 //function : Geom2dHatch_Intersector
29 //purpose  : 
30 //=======================================================================
31 Geom2dHatch_Intersector::Geom2dHatch_Intersector() :
32 myConfusionTolerance(0.0),
33 myTangencyTolerance(0.0)
34 {
35 }
36
37 //=======================================================================
38 //function : Perform
39 //purpose  : 
40 //=======================================================================
41
42 void  Geom2dHatch_Intersector::Perform(const gp_Lin2d& L, 
43                                        const Standard_Real P, 
44                                        const Standard_Real Tol, 
45                                        const Geom2dAdaptor_Curve& C)
46 {
47   
48 //Standard_Real pfbid,plbid;
49   IntRes2d_Domain DL;
50   if(P!=RealLast()) 
51     DL.SetValues(L.Location(),0.,Tol,ElCLib::Value(P,L),P,Tol);
52   else 
53     DL.SetValues(L.Location(),0.,Tol,Standard_True);
54   
55   IntRes2d_Domain DE(C.Value(C.FirstParameter()),
56                      C.FirstParameter(),Precision::PIntersection(),
57                      C.Value(C.LastParameter()),
58                      C.LastParameter(),Precision::PIntersection());
59   
60   Handle(Geom2d_Line) GL= new Geom2d_Line(L);
61   Geom2dAdaptor_Curve CGA(GL);
62   void *ptrpoureviterlesproblemesdeconst = (void *)(&C);
63
64   Geom2dInt_GInter Inter(CGA,
65                          DL,
66                          *((Geom2dAdaptor_Curve *)ptrpoureviterlesproblemesdeconst),
67                          DE,
68                          Precision::PConfusion(),
69                          Precision::PIntersection());
70   this->SetValues(Inter);
71 }
72
73 //=======================================================================
74 //function : LocalGeometry
75 //purpose  : 
76 //=======================================================================
77
78 void  Geom2dHatch_Intersector::LocalGeometry(const Geom2dAdaptor_Curve& E, 
79                                              const Standard_Real U, 
80                                              gp_Dir2d& Tang, 
81                                              gp_Dir2d& Norm, 
82                                              Standard_Real& C) const 
83 {
84   //Standard_Real f,l;
85   Geom2dLProp_CLProps2d Prop(E.Curve(),U,2,Precision::PConfusion());
86
87   if(!Prop.IsTangentDefined()) return;
88
89   Prop.Tangent(Tang);
90   C = Prop.Curvature();
91   if (C > Precision::PConfusion() && C<RealLast())
92     Prop.Normal(Norm);
93   else
94     Norm.SetCoord(Tang.Y(),-Tang.X());
95 }
96
97
98
99
100
101