0023024: Update headers of OCCT files
[occt.git] / src / Geom2dHatch / Geom2dHatch_Intersector.cxx
CommitLineData
b311480e 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
5//
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.
10//
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.
13//
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.
20
7fd59977 21
22
23#include <Geom2dHatch_Intersector.ixx>
24#include <ElCLib.hxx>
25#include <Geom2d_Line.hxx>
26#include <Precision.hxx>
27#include <Geom2dLProp_CLProps2d.hxx>
28
29
30//=======================================================================
31//function : Geom2dHatch_Intersector
32//purpose :
33//=======================================================================
34
35Geom2dHatch_Intersector::Geom2dHatch_Intersector() :
36myConfusionTolerance(0.0),
37myTangencyTolerance(0.0)
38{
39}
40
41//=======================================================================
42//function : Perform
43//purpose :
44//=======================================================================
45
46void Geom2dHatch_Intersector::Perform(const gp_Lin2d& L,
47 const Standard_Real P,
48 const Standard_Real Tol,
49 const Geom2dAdaptor_Curve& C)
50{
51
52//Standard_Real pfbid,plbid;
53 IntRes2d_Domain DL;
54 if(P!=RealLast())
55 DL.SetValues(L.Location(),0.,Tol,ElCLib::Value(P,L),P,Tol);
56 else
57 DL.SetValues(L.Location(),0.,Tol,Standard_True);
58
59 IntRes2d_Domain DE(C.Value(C.FirstParameter()),
60 C.FirstParameter(),Precision::PIntersection(),
61 C.Value(C.LastParameter()),
62 C.LastParameter(),Precision::PIntersection());
63
64 Handle(Geom2d_Line) GL= new Geom2d_Line(L);
65 Geom2dAdaptor_Curve CGA(GL);
66 void *ptrpoureviterlesproblemesdeconst = (void *)(&C);
67
68 Geom2dInt_GInter Inter(CGA,
69 DL,
70 *((Geom2dAdaptor_Curve *)ptrpoureviterlesproblemesdeconst),
71 DE,
72 Precision::PConfusion(),
73 Precision::PIntersection());
74 this->SetValues(Inter);
75}
76
77//=======================================================================
78//function : LocalGeometry
79//purpose :
80//=======================================================================
81
82void Geom2dHatch_Intersector::LocalGeometry(const Geom2dAdaptor_Curve& E,
83 const Standard_Real U,
84 gp_Dir2d& Tang,
85 gp_Dir2d& Norm,
86 Standard_Real& C) const
87{
88 //Standard_Real f,l;
89 Geom2dLProp_CLProps2d Prop(E.Curve(),U,2,Precision::PConfusion());
90
91 if(!Prop.IsTangentDefined()) return;
92
93 Prop.Tangent(Tang);
94 C = Prop.Curvature();
95 if (C > Precision::PConfusion() && C<RealLast())
96 Prop.Normal(Norm);
97 else
98 Norm.SetCoord(Tang.Y(),-Tang.X());
99}
100
101
102
103
104
105