int Atm_controller::event( int id ) { switch ( id ) { case EVT_ON: return eval_all(); case EVT_OFF: return !eval_all(); } return 0; }
//In case of SGI V7.3, following declaration must be done. //Evaluate right continuous surface data. //Evaluate all positional data, 1st and 2nd derivatives. void MGSBRep::eval_all( const MGPosition& uv, // Parameter value of the surface. MGPosition& f, // Positional data. MGVector& fu, // df(u,v)/du MGVector& fv, // df/dv MGVector& fuv, // d**2f/(du*dv) MGVector& fuu, // d**2f/(du**2) MGVector& fvv // d**2f/(dv**2) ) const{ eval_all(uv(0),uv(1),f,fu,fv,fuv,fuu,fvv);}
//Evaluate right continuous ndu'th and ndv'th derivative data. //Function's return value is (d(ndu+ndv)f(u,v))/(du**ndu*dv**ndv). // ndu=0 and ndv=0 means positional data evaluation. MGVector MGRSBRep::eval( double u, double v, // Parameter value of the surface. size_t ndu, // Order of Derivative along u. size_t ndv // Order of Derivative along v. )const{ size_t m; size_t dim=sdim(); MGVector result(dim); if(ndu==0 && ndv==0){ MGVector data=m_surface.eval(u,v); double weight=data.ref(dim); for(m=0; m<dim; m++) result(m)=data.ref(m)/weight; }else{ double* deriv; double deriva[27]; size_t len=dim*(ndu+1)*(ndv+1); if(len<=27) deriv=deriva; else deriv=new double[len]; eval_all(u,v,ndu,ndv,deriv); result=MGVector(dim,deriv+len-dim); if(len>27) delete[] deriv; } return result; }
//Compute position, 1st and 2nd derivatives. // パラメータ値を与えて位置、一次微分値、二次微分値をもとめる。 //Evaluate right continuous surface data. //Evaluate all positional data and 1st and 2nd derivatives. void MGRSBRep::eval_all( double u, double v, // Parameter value of the surface. MGPosition& f, // Positional data. MGVector& fu, // df(u,v)/du MGVector& fv, // df/dv MGVector& fuv, // d**2f/(du*dv) MGVector& fuu, // d**2f/(du**2) MGVector& fvv // d**2f/(dv**2) ) const { size_t dim=sdim(); size_t iid=3*dim; double data_area[27]; double* data; if(dim<=3) data=data_area; else data=new double[dim*3*3]; eval_all(u,v,2,2,data); f=MGPosition(dim,data); fu=MGVector(dim,data+iid); fv=MGVector(dim,data+dim); fuv=MGVector(dim,data+dim+iid); fuu=MGVector(dim,data+2*iid); fvv=MGVector(dim,data+2*dim); if(dim>3) delete[] data; }