HPoint_nD<T,N> operator*(const MatrixRT<T>& M, const HPoint_nD<T,N>& P){ HPoint_nD<T,N> P2 ; P2.x() = M(0,0)*(T)P.x() + M(0,1)*(T)P.y() + M(0,2)*(T)P.z() + M(0,3)*(T)P.w() ; P2.y() = M(1,0)*(T)P.x() + M(1,1)*(T)P.y() + M(1,2)*(T)P.z() + M(1,3)*(T)P.w() ; P2.z() = M(2,0)*(T)P.x() + M(2,1)*(T)P.y() + M(2,2)*(T)P.z() + M(2,3)*(T)P.w() ; P2.w() = M(3,0)*(T)P.x() + M(3,1)*(T)P.y() + M(3,2)*(T)P.z() + M(3,3)*(T)P.w() ; return P2 ; }
void NurbsCurveSP<T,N>::modOnlySurfCPby(int i, const HPoint_nD<T,N>& a) { Vector<T> u(2*deg_+3) ; Vector< Point_nD<T,N> > pts(2*deg_+3) ; int n=0; for(int j=i-deg_-1; j<=i+deg_+1; ++j) { if(j<0) continue ; if(j>=P.n()) break ; u[n] = maxAt_[j] ; if( j == i) { pts[n].x() = a.x() ; pts[n].y() = a.y() ; pts[n].z() = a.z() ; } //else // pts[n] = Point3D(0,0,0) ; pts is alredy set to 0,0,0 ++n ; } u.resize(n) ; pts.resize(n) ; movePoint(u,pts) ; }
void NurbsSurfaceSP<T,N>::modOnlySurfCPby(int i, int j, const HPoint_nD<T,N>& a){ int sizeU, sizeV ; sizeU = 2*this->degU+3 ; if(i-this->degU-1<0) sizeU += i-this->degU-1 ; if(i+this->degU+1>=this->P.rows()) sizeU -= i+this->degU+1-this->P.rows() ; sizeV = 2*this->degV+3 ; if(j-this->degV-1<0) sizeV += j-this->degV-1 ; if(j+this->degV+1>=this->P.cols()) sizeV -= j+this->degV+1-this->P.cols() ; Vector<T> u(sizeU) ; Vector<T> v(sizeV) ; Vector<Point_nD<T,N> > pts(sizeU*sizeV) ; Vector<int> pu(sizeU*sizeV) ; Vector<int> pv(sizeU*sizeV) ; int n=0; int nu = 0 ; int nv = 0 ; for(int k=i-this->degU-1;k<=i+this->degU+1;++k){ if(k<0) continue ; if(k>=this->P.rows()) break ; nv = 0 ; for(int l=j-this->degV-1;l<=j+this->degV+1;++l){ if(l<0) continue ; if(l>=this->P.cols()) break ; if( k == i && j==l){ pts[n].x() = a.x() ; pts[n].y() = a.y() ; pts[n].z() = a.z() ; } //else //pts[n] = Point3D(0,0,0) ; pu[n] = nu ; pv[n] = nv ; if(k==i){ v[nv] = maxAtV_[l] ; // only need to initialise this once } ++n ; ++nv ; } u[nu] = maxAtU_[k] ; ++nu ; } u.resize(nu) ; v.resize(nv) ; pts.resize(n) ; pu.resize(n) ; pv.resize(n) ; movePoint(u,v,pts,pu,pv) ; }