0024624: Lost word in license statement in source files
[occt.git] / src / BRepExtrema / BRepExtrema_ExtCC.cxx
CommitLineData
b311480e 1// Created on: 1993-12-15
2// Created by: Christophe MARION
3// Copyright (c) 1993-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
92d1589b
A
17#include <BRepExtrema_ExtCC.hxx>
18
7fd59977 19#include <BRep_Tool.hxx>
7fd59977 20#include <Extrema_POnCurv.hxx>
21#include <BRepAdaptor_Curve.hxx>
22#include <BRepAdaptor_HCurve.hxx>
23
24
25//=======================================================================
26//function : BRepExtrema_ExtCC
27//purpose :
28//=======================================================================
29
92d1589b 30BRepExtrema_ExtCC::BRepExtrema_ExtCC(const TopoDS_Edge& E1, const TopoDS_Edge& E2)
7fd59977 31{
32 Initialize(E2);
33 Perform(E1);
34}
35
36//=======================================================================
37//function : Initialize
38//purpose :
39//=======================================================================
40
41void BRepExtrema_ExtCC::Initialize(const TopoDS_Edge& E2)
42{
43 Standard_Real V1,V2;
44 BRepAdaptor_Curve Curv(E2);
45 myHC = new BRepAdaptor_HCurve(Curv);
46 BRep_Tool::Range(E2,V1,V2);
92d1589b 47 myExtCC.SetCurve(2,myHC->Curve(),V1,V2);
7fd59977 48}
49
50//=======================================================================
51//function : Perform
52//purpose :
53//=======================================================================
54
55void BRepExtrema_ExtCC::Perform(const TopoDS_Edge& E1)
56{
57 Standard_Real U1, U2;
58 BRepAdaptor_Curve Curv(E1);
59 Handle(BRepAdaptor_HCurve) HC = new BRepAdaptor_HCurve(Curv);
60 BRep_Tool::Range(E1,U1,U2);
92d1589b
A
61 myExtCC.SetCurve (1, HC->Curve(), U1, U2);
62 myExtCC.Perform();
7fd59977 63}
64
65//=======================================================================
66//function : ParameterOnE1
67//purpose :
68//=======================================================================
69
92d1589b 70Standard_Real BRepExtrema_ExtCC::ParameterOnE1(const Standard_Integer N) const
7fd59977 71{
72 Extrema_POnCurv POnE1, POnE2;
92d1589b 73 myExtCC.Points(N, POnE1, POnE2);
7fd59977 74 return POnE1.Parameter();
75}
76
77//=======================================================================
78//function : PointOnE1
79//purpose :
80//=======================================================================
81
92d1589b 82gp_Pnt BRepExtrema_ExtCC::PointOnE1(const Standard_Integer N) const
7fd59977 83{
84 Extrema_POnCurv POnE1, POnE2;
92d1589b
A
85 myExtCC.Points(N, POnE1, POnE2);
86 return POnE1.Value();
7fd59977 87}
88
89//=======================================================================
90//function : ParameterOnE2
91//purpose :
92//=======================================================================
93
92d1589b 94Standard_Real BRepExtrema_ExtCC::ParameterOnE2(const Standard_Integer N) const
7fd59977 95{
96 Extrema_POnCurv POnE1, POnE2;
92d1589b 97 myExtCC.Points(N, POnE1, POnE2);
7fd59977 98 return POnE2.Parameter();
99}
100
101//=======================================================================
102//function : PointOnE2
103//purpose :
104//=======================================================================
105
92d1589b 106gp_Pnt BRepExtrema_ExtCC::PointOnE2(const Standard_Integer N) const
7fd59977 107{
108 Extrema_POnCurv POnE1, POnE2;
92d1589b
A
109 myExtCC.Points(N, POnE1, POnE2);
110 return POnE2.Value();
7fd59977 111}
112
113
114//=======================================================================
115//function : TrimmedSquareDistances
116//purpose :
117//=======================================================================
118
119void BRepExtrema_ExtCC::TrimmedSquareDistances
120 (Standard_Real& dist11,
121 Standard_Real& dist12,
122 Standard_Real& dist21,
123 Standard_Real& dist22,
124 gp_Pnt& pnt11,
125 gp_Pnt& pnt12,
126 gp_Pnt& pnt21,
127 gp_Pnt& pnt22) const
128{
92d1589b
A
129 myExtCC.TrimmedSquareDistances(dist11,dist12,dist21,dist22,
130 pnt11,pnt12,pnt21,pnt22);
7fd59977 131}