0026937: Eliminate NO_CXX_EXCEPTION macro support
[occt.git] / src / GeomPlate / GeomPlate_PointConstraint.cxx
CommitLineData
b311480e 1// Created on: 1997-05-05
2// Created by: Jerome LEMONIER
3// Copyright (c) 1997-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
42cf5bc1 17
18#include <Extrema_ExtPS.hxx>
19#include <Extrema_POnSurf.hxx>
20#include <Geom_Plane.hxx>
21#include <Geom_Surface.hxx>
22#include <GeomAdaptor_Surface.hxx>
7fd59977 23#include <GeomAPI_ProjectPointOnSurf.hxx>
42cf5bc1 24#include <GeomLProp_SLProps.hxx>
25#include <GeomPlate_PointConstraint.hxx>
7fd59977 26#include <gp_Ax3.hxx>
42cf5bc1 27#include <gp_Pnt.hxx>
28#include <gp_Pnt2d.hxx>
7fd59977 29#include <gp_Trsf.hxx>
42cf5bc1 30#include <gp_Vec.hxx>
31#include <Standard_ConstructionError.hxx>
32#include <Standard_Type.hxx>
7fd59977 33
92efcf78 34IMPLEMENT_STANDARD_RTTIEXT(GeomPlate_PointConstraint,MMgt_TShared)
35
7fd59977 36//---------------------------------------------------------
37// Constructeurs avec un point
38//---------------------------------------------------------
39GeomPlate_PointConstraint::GeomPlate_PointConstraint(const gp_Pnt& Pt,
40 const Standard_Integer Order,
41 const Standard_Real TolDist)
42:
43myOrder(Order),
44myLProp(2,TolDist),
45myPoint(Pt),
46myTolDist(TolDist),
47hasPnt2dOnSurf(Standard_False)
48{ if ((myOrder>1)||(myOrder<-1))
9775fa61 49 throw Standard_Failure("GeomPlate_PointConstraint : the constraint must 0 or -1 with a point");
7fd59977 50}
51
52//---------------------------------------------------------
53// Constructeurs avec un point sur surface
54//---------------------------------------------------------
55GeomPlate_PointConstraint::GeomPlate_PointConstraint
56(const Standard_Real U,
57 const Standard_Real V,
58 const Handle(Geom_Surface)& Surf,
59 const Standard_Integer Order,
60 const Standard_Real TolDist,
61 const Standard_Real TolAng,
62 const Standard_Real TolCurv)
63:myOrder(Order),
64 myLProp(2,TolDist),
65 mySurf(Surf),
66 myU(U),
67 myV(V),
68 myTolDist(TolDist),
69 myTolAng(TolAng),
70 myTolCurv(TolCurv),
71 hasPnt2dOnSurf(Standard_False)
72
73{
74 Surf->D2(myU,myV,myPoint,myD11,myD12,myD21,myD22,myD23);
75 myLProp.SetSurface(Surf);
76}
77
78//---------------------------------------------------------
79// Fonction : D0
80//---------------------------------------------------------
81void GeomPlate_PointConstraint::D0(gp_Pnt& P) const
82{ P=myPoint;
83}
84
85//---------------------------------------------------------
86// Fonction : D1
87//---------------------------------------------------------
88void GeomPlate_PointConstraint::D1(gp_Pnt& P,gp_Vec& V1,gp_Vec& V2) const
89{ P=myPoint;
90 V1=myD11;
91 V2=myD12;
92}
93
94//---------------------------------------------------------
95// Fonction : D2
96//---------------------------------------------------------
97void GeomPlate_PointConstraint::D2(gp_Pnt& P,gp_Vec& V1,gp_Vec& V2,gp_Vec& V3,gp_Vec& V4,gp_Vec& V5) const
98{ P=myPoint;
99 V1=myD11;
100 V2=myD12;
101 V3=myD21;
102 V4=myD22;
103 V5=myD23;
104}
105
106//---------------------------------------------------------
107// Fonction : SetG0Criterion
108//---------------------------------------------------------
109void GeomPlate_PointConstraint :: SetG0Criterion( const Standard_Real TolDist )
110{
111 myTolDist = TolDist;
112}
113//---------------------------------------------------------
114// Fonction : SetG1Criterion
115//---------------------------------------------------------
116void GeomPlate_PointConstraint :: SetG1Criterion( const Standard_Real TolAng )
117{
118 myTolAng = TolAng;
119}
120//---------------------------------------------------------
121// Fonction : SetG2Criterion
122//---------------------------------------------------------
123void GeomPlate_PointConstraint :: SetG2Criterion( const Standard_Real TolCurv )
124{
125 myTolCurv = TolCurv;
126}
127
128//---------------------------------------------------------
129// Fonction : G0Criterion
130//---------------------------------------------------------
131Standard_Real GeomPlate_PointConstraint::G0Criterion() const
132{ return myTolDist;
133}
134
135//---------------------------------------------------------
136// Fonction : G1Criterion
137//---------------------------------------------------------
138Standard_Real GeomPlate_PointConstraint::G1Criterion() const
139{ return myTolAng;
140}
141
142//---------------------------------------------------------
143// Fonction : G2Criterion
144//---------------------------------------------------------
145Standard_Real GeomPlate_PointConstraint::G2Criterion() const
146{ return myTolCurv;
147}
148
149//---------------------------------------------------------
150// Fonction : Surface
151//---------------------------------------------------------
152//Handle(Geom_Surface) GeomPlate_PointConstraint::Surface() const
9775fa61 153//{ throw Standard_Failure("GeomPlate_PointConstraint.cxx : The surface does not exist");
7fd59977 154//}
155//------------------------------------------------------------
156//Fonction : LPropSurf
157//------------------------------------------------------------
158GeomLProp_SLProps &GeomPlate_PointConstraint::LPropSurf()
159{ // if (myFrontiere.IsNull())
9775fa61 160 // throw Standard_Failure("GeomPlate_CurveConstraint.cxx : Curve must be on a Surface");
7fd59977 161 // gp_Pnt2d P2d= myFrontiere->ChangeCurve().GetCurve()->Value(U);
162myLProp.SetParameters(myU,myV);
163return myLProp;
164}
165
166
167//------------------------------------------------------------
168//Fonction : Order
169//------------------------------------------------------------
170Standard_Integer GeomPlate_PointConstraint::Order() const
171{
172return myOrder;
173}
174//------------------------------------------------------------
175//Fonction : SetOrder
176//------------------------------------------------------------
177void GeomPlate_PointConstraint::SetOrder(const Standard_Integer Order)
178{ myOrder=Order;
179}
180
181//------------------------------------------------------------
182//Fonction : HasPnt2dOnSurf
183//------------------------------------------------------------
184Standard_Boolean GeomPlate_PointConstraint::HasPnt2dOnSurf() const
185{
186 return hasPnt2dOnSurf;
187}
188//------------------------------------------------------------
189//Fonction : SetPnt2dOnSurf
190//------------------------------------------------------------
191void GeomPlate_PointConstraint::SetPnt2dOnSurf(const gp_Pnt2d& Pnt2d)
192{
193 myPt2d=Pnt2d;
194 hasPnt2dOnSurf = Standard_True;
195}
196//------------------------------------------------------------
197//Fonction : Pnt2dOnSurf
198//------------------------------------------------------------
199gp_Pnt2d GeomPlate_PointConstraint::Pnt2dOnSurf() const
200{ return myPt2d;
201}
202