1 // Created on: 1997-05-05
2 // Created by: Jerome LEMONIER
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
23 #include <GeomPlate_PointConstraint.ixx>
24 #include <GeomAPI_ProjectPointOnSurf.hxx>
26 #include <GeomAPI_ProjectPointOnSurf.hxx>
27 #include <gp_Trsf.hxx>
28 #include <Geom_Plane.hxx>
29 #include <Extrema_POnSurf.hxx>
30 #include <Extrema_ExtPS.hxx>
31 #include <GeomAdaptor_Surface.hxx>
33 //---------------------------------------------------------
34 // Constructeurs avec un point
35 //---------------------------------------------------------
36 GeomPlate_PointConstraint::GeomPlate_PointConstraint(const gp_Pnt& Pt,
37 const Standard_Integer Order,
38 const Standard_Real TolDist)
44 hasPnt2dOnSurf(Standard_False)
45 { if ((myOrder>1)||(myOrder<-1))
46 Standard_Failure::Raise("GeomPlate_PointConstraint : the constraint must 0 or -1 with a point");
49 //---------------------------------------------------------
50 // Constructeurs avec un point sur surface
51 //---------------------------------------------------------
52 GeomPlate_PointConstraint::GeomPlate_PointConstraint
53 (const Standard_Real U,
54 const Standard_Real V,
55 const Handle(Geom_Surface)& Surf,
56 const Standard_Integer Order,
57 const Standard_Real TolDist,
58 const Standard_Real TolAng,
59 const Standard_Real TolCurv)
68 hasPnt2dOnSurf(Standard_False)
71 Surf->D2(myU,myV,myPoint,myD11,myD12,myD21,myD22,myD23);
72 myLProp.SetSurface(Surf);
75 //---------------------------------------------------------
77 //---------------------------------------------------------
78 void GeomPlate_PointConstraint::D0(gp_Pnt& P) const
82 //---------------------------------------------------------
84 //---------------------------------------------------------
85 void GeomPlate_PointConstraint::D1(gp_Pnt& P,gp_Vec& V1,gp_Vec& V2) const
91 //---------------------------------------------------------
93 //---------------------------------------------------------
94 void GeomPlate_PointConstraint::D2(gp_Pnt& P,gp_Vec& V1,gp_Vec& V2,gp_Vec& V3,gp_Vec& V4,gp_Vec& V5) const
103 //---------------------------------------------------------
104 // Fonction : SetG0Criterion
105 //---------------------------------------------------------
106 void GeomPlate_PointConstraint :: SetG0Criterion( const Standard_Real TolDist )
110 //---------------------------------------------------------
111 // Fonction : SetG1Criterion
112 //---------------------------------------------------------
113 void GeomPlate_PointConstraint :: SetG1Criterion( const Standard_Real TolAng )
117 //---------------------------------------------------------
118 // Fonction : SetG2Criterion
119 //---------------------------------------------------------
120 void GeomPlate_PointConstraint :: SetG2Criterion( const Standard_Real TolCurv )
125 //---------------------------------------------------------
126 // Fonction : G0Criterion
127 //---------------------------------------------------------
128 Standard_Real GeomPlate_PointConstraint::G0Criterion() const
132 //---------------------------------------------------------
133 // Fonction : G1Criterion
134 //---------------------------------------------------------
135 Standard_Real GeomPlate_PointConstraint::G1Criterion() const
139 //---------------------------------------------------------
140 // Fonction : G2Criterion
141 //---------------------------------------------------------
142 Standard_Real GeomPlate_PointConstraint::G2Criterion() const
146 //---------------------------------------------------------
147 // Fonction : Surface
148 //---------------------------------------------------------
149 //Handle(Geom_Surface) GeomPlate_PointConstraint::Surface() const
150 //{ Standard_Failure::Raise("GeomPlate_PointConstraint.cxx : The surface does not exist");
152 //------------------------------------------------------------
153 //Fonction : LPropSurf
154 //------------------------------------------------------------
155 GeomLProp_SLProps &GeomPlate_PointConstraint::LPropSurf()
156 { // if (myFrontiere.IsNull())
157 // Standard_Failure::Raise("GeomPlate_CurveConstraint.cxx : Curve must be on a Surface");
158 // gp_Pnt2d P2d= myFrontiere->ChangeCurve().GetCurve()->Value(U);
159 myLProp.SetParameters(myU,myV);
164 //------------------------------------------------------------
166 //------------------------------------------------------------
167 Standard_Integer GeomPlate_PointConstraint::Order() const
171 //------------------------------------------------------------
172 //Fonction : SetOrder
173 //------------------------------------------------------------
174 void GeomPlate_PointConstraint::SetOrder(const Standard_Integer Order)
178 //------------------------------------------------------------
179 //Fonction : HasPnt2dOnSurf
180 //------------------------------------------------------------
181 Standard_Boolean GeomPlate_PointConstraint::HasPnt2dOnSurf() const
183 return hasPnt2dOnSurf;
185 //------------------------------------------------------------
186 //Fonction : SetPnt2dOnSurf
187 //------------------------------------------------------------
188 void GeomPlate_PointConstraint::SetPnt2dOnSurf(const gp_Pnt2d& Pnt2d)
191 hasPnt2dOnSurf = Standard_True;
193 //------------------------------------------------------------
194 //Fonction : Pnt2dOnSurf
195 //------------------------------------------------------------
196 gp_Pnt2d GeomPlate_PointConstraint::Pnt2dOnSurf() const