/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #include "MGCLStdAfx.h" #include "mg/NDDArray.h" #include "mg/BPointSeq.h" #include "mg/Position.h" #include "mg/Curve.h" #include "mg/SBRepEndC.h" #include "mg/Coons.h" #include "mg/BSumSurf.h" #include "cskernel/Bvltn2.h" #if defined(_DEBUG) #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // MGSBRepEndC.cc // // Implements MGSBRepEndC class. //Member Data // MGENDCOND m_cond; //Type of end condition. // MGVector m_1deriv; //1st derivative stored // //when m_cond=MGENDC_1D or MGENDC_12D // MGVector m_2deriv; //2nd derivative stored // MGSBRepEndC_twist computes twist data of a corner, given // df/dv along u(vderiv) and df/du along v(uderiv). //This is a private function for complete_corner_deriv. MGVector MGSBRepEndC_twist( const MGNDDArray& utau, //u-direction data point const MGBPointSeq& vderiv, const MGNDDArray& vtau, //v-direction data point const MGBPointSeq& uderiv, int ncd, //space dimension int u_dorder, int v_dorder, int endu, int endv); //Constructor //Default Constructor. MGSBRepEndC::MGSBRepEndC():m_sdim(0), m_nu(0), m_nv(0){ for(int i=0; i<4; i++){ m_1deriv[i]=m_2deriv[i]=0; m_cond[i]=MGENDC_NO; } } //Construct from a Coon's patch. MGSBRepEndC::MGSBRepEndC( const MGNDDArray& utau, const MGNDDArray& vtau, const MGCoons& coons) :m_sdim(coons.sdim()), m_nu(utau.length()), m_nv(vtau.length()){ const MGNDDArray* tau; for(int i=0; i<4; i++){ m_cond[i]=MGENDC_1D; m_1deriv[i]=new MGBPointSeq(); if(i%2) tau=&vtau; else tau=&utau; coons.derivative(i).eval_line(*tau,*(m_1deriv[i])); m_11d[i]=coons.d2fdvu(i); m_2deriv[i]=0; } } //Construct from a Boolean sum surface's patch. MGSBRepEndC::MGSBRepEndC( const MGNDDArray& utau, const MGNDDArray& vtau, const MGBSumSurf& bssurf) :m_sdim(bssurf.sdim()), m_nu(utau.length()), m_nv(vtau.length()){ const MGNDDArray* tau; int m=utau.length(), n=vtau.length(); double u0=utau[0], u1=utau[m-1]; double v0=vtau[0], v1=vtau[n-1]; MGPosition uvcorner[4]= {MGPosition(u0,v0), MGPosition(u1,v0),MGPosition(u1,v1),MGPosition(u0,v1)}; MGPosition uv; int id,id2; for(int i=0; i<4; i++){ uv=uvcorner[i]; m_11d[i]=bssurf.eval(uv,1,1); m_cond[i]=MGENDC_1D; if(id=(i%2)) tau=&vtau; else tau=&utau; int taulen=tau->length(); m_1deriv[i]=new MGBPointSeq(taulen,m_sdim); MGBPointSeq& deriv=*(m_1deriv[i]); id2=(id+1)%2; for(int j=0; j& first_derivp) //Set 1st deriv and change condition type to MGENDC_1D or MGENDC_12D. { assert(i<4); MGBPointSeq& first_deriv=*first_derivp; int dim=first_deriv.sdim(); if(!m_sdim || m_sdim& second_derivp) { assert(i<4); MGBPointSeq& second_deriv=*second_derivp; int dim=second_deriv.sdim(); if(!m_sdim || m_sdim