Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/opencascade/Blend_CSWalking_3.gxx is written in an unsupported language. File is not indexed.

0001 // Copyright (c) 1995-1999 Matra Datavision
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 /*
0016 Standard_Boolean Blend_CSWalking::Recadre(Blend_FuncInv& FuncInv,
0017                                           const Standard_Boolean OnFirst,
0018                                           const math_Vector& sol,
0019                                           math_Vector& solrst,
0020                                           Standard_Integer& Indexsol,
0021                                           Standard_Boolean& IsVtx,
0022                                           TheVertex& Vtx)
0023      
0024 {
0025   Standard_Integer nbarc;
0026   Standard_Boolean ok,yamin;
0027   Standard_Real dist,distmin,prm,pmin;
0028   gp_Pnt2d pt2d;
0029   math_Vector toler(1,4),infb(1,4),supb(1,4),valsol(1,4);
0030 
0031   Handle(TheTopolTool) Iter;
0032   TopAbs_State situ;
0033 
0034   yamin = Standard_False;
0035   nbarc = 0;
0036   distmin = RealLast();
0037   if (OnFirst) {
0038     pt2d.SetCoord(sol(1),sol(2));
0039     Iter = domain1;
0040   }
0041   else {
0042     pt2d.SetCoord(sol(3),sol(4));
0043     Iter = domain2;
0044   }
0045   Iter->Init();
0046   while (Iter->More()) {
0047     nbarc++;
0048     if (OnFirst) {
0049       ok = TheBlendTool::Project(pt2d,surf1,Iter->Value(),prm,dist);
0050     }
0051     else {
0052       ok = TheBlendTool::Project(pt2d,surf2,Iter->Value(),prm,dist);
0053     }
0054     if (ok) {
0055       if (dist<distmin) {
0056         yamin = Standard_True;
0057         distmin = dist;
0058         pmin = prm;
0059         Indexsol = nbarc;
0060       }
0061     }
0062     Iter->Next();
0063   }
0064 
0065   IsVtx = Standard_False;
0066   if (!yamin) {
0067     return Standard_False;
0068   }
0069 
0070   Iter->Init();
0071   nbarc = 1;
0072   while (nbarc < Indexsol) {
0073     nbarc++;
0074     Iter->Next();
0075   }
0076 
0077   TheArc thearc = Iter->Value();
0078   Handle(Adaptor2d_Curve2d) thecur;
0079   if (OnFirst) {
0080     thecur = TheBlendTool::CurveOnSurf(thearc,surf1);
0081   }
0082   else {
0083     thecur = TheBlendTool::CurveOnSurf(thearc,surf2);
0084   }
0085 
0086   FuncInv.Set(OnFirst,thecur);
0087   
0088   FuncInv.GetTolerance(toler,tolesp);
0089   FuncInv.GetBounds(infb,supb);
0090   solrst(1) = pmin;
0091   solrst(2) = param;
0092   
0093   if (OnFirst) {
0094     solrst(3) = sol(3);
0095     solrst(4) = sol(4);
0096   }
0097   else {
0098     solrst(3) = sol(1);
0099     solrst(4) = sol(2);
0100   }
0101   
0102   math_FunctionSetRoot rsnld(FuncInv,toler,30);
0103   rsnld.Perform(FuncInv,solrst,infb,supb);
0104   
0105 
0106 
0107   if (!rsnld.IsDone()) {
0108 #ifdef OCCT_DEBUG
0109     std::cout << "RSNLD not done "<< std::endl << std::endl;
0110 #endif
0111     return Standard_False;
0112   }
0113       
0114   // On doit verifier la valeur de la fonction
0115   rsnld.Root(solrst);
0116 
0117   if (FuncInv.IsSolution(solrst,tolesp)) {
0118 
0119 //    if (OnFirst) {
0120 //      situ = TheTopolTool::Classify(surf2,gp_Pnt2d(solrst(3),solrst(4)),
0121 //                                  Max(toler(3),toler(4)));
0122 //                                  
0123 //    }
0124 //    else {
0125 //      situ = TheTopolTool::Classify(surf1,gp_Pnt2d(solrst(3),solrst(4)),
0126 //                                  Max(toler(3),toler(4)));
0127 //    }
0128 
0129     if (OnFirst) {
0130       situ = domain2->Classify(gp_Pnt2d(solrst(3),solrst(4)),
0131                                Min(toler(3),toler(4)));
0132                                     
0133     }
0134     else {
0135       situ = domain1->Classify(gp_Pnt2d(solrst(3),solrst(4)),
0136                                Min(toler(3),toler(4)));
0137     }
0138 
0139 
0140     if ((situ != TopAbs_IN) && (situ != TopAbs_ON)) {
0141       return Standard_False;
0142     }
0143 
0144     Iter->Initialize(thearc);
0145     Iter->InitVertexIterator();
0146     IsVtx = !Iter->MoreVertex();
0147     while (!IsVtx) {
0148       Vtx = Iter->Vertex();
0149       if (Abs(TheBlendTool::Parameter(Vtx,thearc)-solrst(1)) <=
0150           TheBlendTool::Tolerance(Vtx,thearc)) {
0151         IsVtx = Standard_True;
0152       }
0153       else {
0154         Iter->NextVertex();
0155         IsVtx = !Iter->MoreVertex();
0156       }
0157     }
0158     if (!Iter->MoreVertex()) {
0159       IsVtx = Standard_False;
0160     }
0161 
0162     return Standard_True;
0163   } 
0164 
0165   return Standard_False;
0166 }
0167 
0168 */
0169 
0170 
0171 void Blend_CSWalking::Transition(const TheArc& A,
0172                                  const Standard_Real Param,
0173                                  IntSurf_Transition& TLine,
0174                                  IntSurf_Transition& TArc)
0175 {
0176 
0177   gp_Pnt2d p2d;
0178   gp_Vec2d dp2d;
0179 
0180   gp_Pnt pbid;
0181   gp_Vec d1u,d1v,normale,tgrst;
0182 
0183   TheArcTool::D1(A,Param,p2d,dp2d);
0184   TheSurfaceTool::D1(surf,p2d.X(),p2d.Y(),pbid,d1u,d1v);
0185 
0186   tgrst.SetLinearForm(dp2d.X(),d1u,dp2d.Y(),d1v);
0187   normale = d1u.Crossed(d1v);
0188 
0189   IntSurf::MakeTransition(previousP.TangentOnS(),tgrst,normale,TLine,TArc);
0190 
0191 }
0192 
0193 
0194 void Blend_CSWalking::MakeExtremity(TheExtremity& Extrem,
0195                                     const Standard_Integer Index,
0196                                     const Standard_Real Param,
0197                                     const Standard_Boolean IsVtx,
0198                                     const TheVertex& Vtx)
0199 {
0200 
0201   IntSurf_Transition Tline,Tarc;
0202   Standard_Real prm,U,V;
0203   Standard_Integer nbarc;
0204   Handle(TheTopolTool) Iter;
0205 
0206 //  Extrem.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
0207   previousP.ParametersOnS(U,V);
0208   Extrem.SetValue(previousP.PointOnS(),U,V,previousP.Parameter(),tolpoint3d);
0209   Iter = domain;
0210 
0211 
0212   Iter->Init();
0213   nbarc = 1;
0214 
0215   if (!IsVtx) {
0216     while (nbarc < Index) {
0217       nbarc++;
0218       Iter->Next();
0219     }
0220     Transition(Iter->Value(),Param,Tline,Tarc);
0221     Extrem.AddArc(Iter->Value(),Param,Tline,Tarc);
0222   }
0223 
0224   else {
0225 
0226     Extrem.SetVertex(Vtx);
0227     while (Iter->More()) {
0228       TheArc arc = Iter->Value();
0229       if (nbarc != Index) {
0230         Iter->Initialize(arc);
0231         Iter->InitVertexIterator();
0232         while (Iter->MoreVertex()) {
0233 //        if (TheTopolTool::Identical(Vtx,Iter.Vertex())) {
0234           if (Iter->Identical(Vtx,Iter->Vertex())) {
0235             prm = TheBlendTool::Parameter(Vtx,arc);
0236             Transition(arc,prm,Tline,Tarc);
0237             Extrem.AddArc(arc,prm,Tline,Tarc);
0238           }
0239           Iter->NextVertex();
0240         }
0241       }
0242       else {
0243         Transition(arc,Param,Tline,Tarc);
0244         Extrem.AddArc(arc,Param,Tline,Tarc);
0245       }
0246       nbarc++;
0247       Iter->Next();
0248     }
0249   }
0250 }