コード例 #1
0
ファイル: glv_model.cpp プロジェクト: eranws/GLV
// TODO: conform sizes to current size
Data& Data::shape(const int * sizes, int n){
	if(n){
		if(n <= maxDim()){
			for(int i=0;i<n;++i) mSizes[i]=sizes[i];
			for(int i=n;i<maxDim();++i) mSizes[i]=1;
		}
		else{
			for(int i=0;i<maxDim();++i) mSizes[i]=sizes[i];
		}
	}
	return *this; 
}
コード例 #2
0
ファイル: glv_model.cpp プロジェクト: eranws/GLV
int Data::order() const {
	int r=0;
	for(int i=0; i<maxDim(); ++i){
		if(size(i)>0) ++r; 
	}
	return r;
}
コード例 #3
0
ファイル: glv_model.cpp プロジェクト: eranws/GLV
Data& Data::operator= (const Data& v){
	if(&v != this){
		setRaw(v.mData, v.offset(), v.stride(), v.type());
		for(int i=0;i<maxDim();++i) mSizes[i]=v.mSizes[i];
	}
	return *this;
}
コード例 #4
0
ファイル: AxesFunc.cpp プロジェクト: Kopakc/NoiseWorld
Axes axesFromAxisZ(const Vector& z)
{
    int i = maxDim(z);
    Vector u = (i == 0) ? UnitVectorY : (i == 1) ? UnitVectorZ : UnitVectorX;
	Vector x = unit(cross(u, z));
	Vector y = unit(cross(z, x));
    return Axes(x, y, z);
}
コード例 #5
0
ファイル: glv_model.cpp プロジェクト: eranws/GLV
Data& Data::type(Data::Type ty){
	if(type()!=ty && size()){
		resize(ty, mSizes, maxDim());
	}
	else{
		mType=ty;
	}
	return *this;
}
コード例 #6
0
ファイル: glv_model.cpp プロジェクト: eranws/GLV
Data& Data::shapeAll(int n){
	for(int i=0;i<maxDim();++i) mSizes[i]=n;
	return *this;
}