Integration of OCCT 6.5.0 from SVN
[occt.git] / src / Geom2dHatch / Geom2dHatch_Intersector.cxx
CommitLineData
7fd59977 1// File: Geom2dHatch_Intersector.cxx
2// Created: Wed Mar 23 11:29:17 1994
3// Author: Jean Marc LACHAUME
4// <jml@phylox>
5
6
7#include <Geom2dHatch_Intersector.ixx>
8#include <ElCLib.hxx>
9#include <Geom2d_Line.hxx>
10#include <Precision.hxx>
11#include <Geom2dLProp_CLProps2d.hxx>
12
13
14//=======================================================================
15//function : Geom2dHatch_Intersector
16//purpose :
17//=======================================================================
18
19Geom2dHatch_Intersector::Geom2dHatch_Intersector() :
20myConfusionTolerance(0.0),
21myTangencyTolerance(0.0)
22{
23}
24
25//=======================================================================
26//function : Perform
27//purpose :
28//=======================================================================
29
30void Geom2dHatch_Intersector::Perform(const gp_Lin2d& L,
31 const Standard_Real P,
32 const Standard_Real Tol,
33 const Geom2dAdaptor_Curve& C)
34{
35
36//Standard_Real pfbid,plbid;
37 IntRes2d_Domain DL;
38 if(P!=RealLast())
39 DL.SetValues(L.Location(),0.,Tol,ElCLib::Value(P,L),P,Tol);
40 else
41 DL.SetValues(L.Location(),0.,Tol,Standard_True);
42
43 IntRes2d_Domain DE(C.Value(C.FirstParameter()),
44 C.FirstParameter(),Precision::PIntersection(),
45 C.Value(C.LastParameter()),
46 C.LastParameter(),Precision::PIntersection());
47
48 Handle(Geom2d_Line) GL= new Geom2d_Line(L);
49 Geom2dAdaptor_Curve CGA(GL);
50 void *ptrpoureviterlesproblemesdeconst = (void *)(&C);
51
52 Geom2dInt_GInter Inter(CGA,
53 DL,
54 *((Geom2dAdaptor_Curve *)ptrpoureviterlesproblemesdeconst),
55 DE,
56 Precision::PConfusion(),
57 Precision::PIntersection());
58 this->SetValues(Inter);
59}
60
61//=======================================================================
62//function : LocalGeometry
63//purpose :
64//=======================================================================
65
66void Geom2dHatch_Intersector::LocalGeometry(const Geom2dAdaptor_Curve& E,
67 const Standard_Real U,
68 gp_Dir2d& Tang,
69 gp_Dir2d& Norm,
70 Standard_Real& C) const
71{
72 //Standard_Real f,l;
73 Geom2dLProp_CLProps2d Prop(E.Curve(),U,2,Precision::PConfusion());
74
75 if(!Prop.IsTangentDefined()) return;
76
77 Prop.Tangent(Tang);
78 C = Prop.Curvature();
79 if (C > Precision::PConfusion() && C<RealLast())
80 Prop.Normal(Norm);
81 else
82 Norm.SetCoord(Tang.Y(),-Tang.X());
83}
84
85
86
87
88
89