/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #include "MGCLStdAfx.h" #include "mg/Pvector.h" #include "mg/Tolerance.h" #include "mg/SPointSeq.h" #include "mg/LBRepEndC.h" #include "mg/SBRepEndC.h" #include "mg/SBRepVecTP.h" #include "mg/SBRep.h" #include "mg/BSumSurf.h" using namespace std; #if defined(_DEBUG) #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif //using namespace std; //境界線、ブレンド関数、接続面を与え、対辺が同じノットベクトルのスプライン曲線 //になるように再作成して、点列、ノットベクトル、データポイントを求め、境界線の //パラメータにあわせてあった接続面をリビルドした後のパラメータに変更する。 //境界線はC1連続であり、vmin,umax,vmax,uminの順で、vmin,vmaxの向きをuminから //umaxの方向にumin,umaxの向きをvminからvmaxの方向になっているものとする。 //境界線のノットベクトルをあわせるときの誤差はline_zero()を使用している。 void rebuild_curve( const MGCurve* edge_crvl[4], //境界線リスト(vmin,umax,vmax,uminの順) MGSBRepTP& tp, //接続面(パラメータ範囲は境界線と同じ) MGPvector& perimeters ); MGSBRep* get_1DireSurf( bool udire, //indicates if perimetes[0],[2] or [3],[1] should be used to construct //the surface. if udire=true, [0] and [2] are used. const MGPvector& perimeters, const MGPvector& derivatives ); //compute perimeters and derivatives from only 4 corner point data //of input perimeters and derivatives. void get_peri2_deri2( const MGPvector& perimeters, const MGPvector& derivatives, MGPvector& perimeters2, MGPvector& derivatives2 //array of derivatives[4], must have size 4. ); void get_all_derivatives( const MGPvector& perimeters,//perimeters. const MGSBRep& surf, //Original surface. const MGSBRepVecTP& vectp, //接続面(パラメータ範囲は境界線と同じ) MGPvector& derivatives //array of derivatives[4], must have size 4. ){ int sd=surf.sdim(); double azero=MGTolerance::angle_zero()*.05; const MGKnotVector& tu=surf.knot_vector_u(); const MGKnotVector& tv=surf.knot_vector_v(); int m; MGVector N; ///////////perimeter 0 and 2. int nu=surf.bdim_u(); int num1=nu-1; MGNDDArray utau2; utau2.update_from_knot(tu); MGBPointSeq deris_u(nu,sd); double v[2]={tv.param_s(),tv.param_e()}; MGNDDArray utau(nu); utau(0)=utau2[0]; for(m=0; m<2; m++){//for perimeter 0 and 2. int perim=m*2; if(!vectp.specified(perim)) continue; double vm=v[m]; int i2=0; MGVector deri=perimeters[3]->eval(vm,1);//std::cout<eval(vm,1);//std::cout<eval(um,1);//std::cout<eval(um,1);//std::cout<param_e(),ti=derivatives[i]->param_s(); if(im1>=2) tim1=derivatives[im1]->param_s(); if(i>=2) ti=derivatives[i]->param_e(); MGVector deriim1=derivatives[im1]->eval(tim1,1), derii=derivatives[i]->eval(ti,1); twist[i]=(deriim1+derii)*.5; //std::cout<knot_vector(); MGKnotVector& tv=perimeters[1]->knot_vector(); vectp.change_range(true,tu.param_s(),tu.param_e()); vectp.change_range(false,tv.param_s(),tv.param_e()); //std::cout< derivatives(4); get_all_derivatives(perimeters,ruled01,vectp,derivatives); //std::cout<eval(t2,1)<