// Created on: 1998-03-27 // Created by: # Andre LIEUTIER // Copyright (c) 1998-1999 Matra Datavision // Copyright (c) 1999-2012 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file // except in compliance with the License. Please obtain a copy of the License // at http://www.opencascade.org and read it completely before using this file. // // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. // // The Original Code and all software distributed under the License is // distributed on an "AS IS" basis, without warranty of any kind, and the // Initial Developer hereby disclaims all such warranties, including without // limitation, any warranties of merchantability, fitness for a particular // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. #include #include #include #include #include #include #include #include static const Standard_Real NORMIN = 1.e-10; static const Standard_Real COSMIN = 1.e-2; // G1 Constraints Plate_FreeGtoCConstraint::Plate_FreeGtoCConstraint(const gp_XY& point2d,const Plate_D1& D1S,const Plate_D1& D1T, const Standard_Real IncrementalLoad, const Standard_Integer orientation) { pnt2d = point2d; nb_PPConstraints = 0; nb_LSConstraints = 0; gp_XYZ normale = D1T.Du^D1T.Dv; if(normale.Modulus() < NORMIN) return; normale.Normalize(); if(IncrementalLoad!=1.) { gp_XYZ N0 = D1S.Du^D1S.Dv; if(N0.Modulus()< NORMIN) return; N0.Normalize(); gp_XYZ N1 = normale; if(orientation!=0) N1 *= orientation; Standard_Real c = N0*N1; if(orientation==0) { if (c <0.) { c *= -1.; N1 *= -1.; } } Standard_Real s = N0.CrossMagnitude(N1); if((s < 1.e-2)&&(c<0.)) return; Standard_Real angle = atan2(c,s); //if (angle < 0.) angle += M_PI; gp_XYZ d = N0^N1; d.Normalize(); gp_Dir dir = gp_Dir(d); gp_Trsf rota; gp_Ax1 Axe(gp_Pnt(0,0,0), dir); rota.SetRotation(Axe,angle*(IncrementalLoad-1.)); // gp_Trsf rota = gce_MakeRotation(gp_Pnt(0,0,0), dir, angle*(IncrementalLoad-1.)); rota.Transforms(normale); } gp_XYZ du = D1S.Du*(-1.); gp_XYZ dv = D1S.Dv*(-1.); myLSC[0] = Plate_LinearScalarConstraint(Plate_PinpointConstraint(pnt2d, du,1,0), normale); myLSC[1] = Plate_LinearScalarConstraint(Plate_PinpointConstraint(pnt2d, dv,0,1), normale); nb_LSConstraints = 2; } // G1 + G2 Constraints Plate_FreeGtoCConstraint::Plate_FreeGtoCConstraint(const gp_XY& point2d,const Plate_D1& D1S,const Plate_D1& D1T0, const Plate_D2& D2S,const Plate_D2& D2T0, const Standard_Real IncrementalLoad, const Standard_Integer orientation) { pnt2d = point2d; nb_PPConstraints = 0; nb_LSConstraints = 0; Plate_D1 D1T = D1T0; Plate_D2 D2T = D2T0; gp_XYZ normale = D1T.Du^D1T.Dv; if(normale.Modulus() < NORMIN) return; normale.Normalize(); // G1 Constraints gp_XYZ normaleS = D1S.Du^D1S.Dv; if(normaleS.Modulus() < NORMIN) { if(IncrementalLoad!=1.) return; gp_XYZ du = D1S.Du*(-1.); gp_XYZ dv = D1S.Dv*(-1.); myLSC[0] = Plate_LinearScalarConstraint(Plate_PinpointConstraint(pnt2d, du,1,0), normale); myLSC[1] = Plate_LinearScalarConstraint(Plate_PinpointConstraint(pnt2d, dv,0,1), normale); nb_LSConstraints = 2; return; } normaleS.Normalize(); if(IncrementalLoad!=1.) { gp_XYZ N0 = normaleS; gp_XYZ N1 = normale; if(orientation!=0) N1 *= orientation; Standard_Real c = N0*N1; if(orientation==0) { if (c <0.) { c *= -1.; N1 *= -1.; } } Standard_Real s = N0.CrossMagnitude(N1); if((s < 1.e-2)&&(c<0.)) return; Standard_Real angle = atan2(c,s); gp_XYZ d = N0^N1; d.Normalize(); gp_Dir dir = gp_Dir(d); gp_Trsf rota; gp_Ax1 Axe(gp_Pnt(0,0,0), dir); rota.SetRotation(Axe,angle*(IncrementalLoad-1.)); // gp_Trsf rota = gce_MakeRotation(gp_Pnt(0,0,0), dir, angle*(IncrementalLoad-1.)); rota.Transforms(normale); rota.Transforms(D1T.Du); rota.Transforms(D1T.Dv); rota.Transforms(D2T.Duu); rota.Transforms(D2T.Duv); rota.Transforms(D2T.Dvv); } Standard_Real cos_normales = normale*normaleS; if( fabs(cos_normales)