fixed gcc template compatibility issues.

This commit is contained in:
Federico Ponchio 2004-09-16 14:23:57 +00:00
parent 1466557a9f
commit 4033168ecc
2 changed files with 26 additions and 10 deletions

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.2 2004/09/10 14:02:20 cignoni
Added Cone directions
Revision 1.1 2004/09/09 22:38:57 cignoni
Initial Update
@ -46,7 +49,9 @@ static void Random(int vn, std::vector<Point3<ScalarType > > &NN)
NN.clear();
while(NN.size()<vn)
{
Point3x pp(float(rand())/RAND_MAX,float(rand())/RAND_MAX,float(rand())/RAND_MAX);
Point3x pp(((float)rand())/RAND_MAX,
((float)rand())/RAND_MAX,
((float)rand())/RAND_MAX);
pp=pp*2.0-Point3x(1,1,1);
if(pp.SquaredNorm()<1)
{
@ -67,7 +72,7 @@ static void UniformCone(int vn, std::vector<Point3<ScalarType > > &NN, ScalarTyp
printf("----------AngleRad %f Angledeg %f ratio %f vn %i vn2 %i \n",AngleRad,math::ToDeg(AngleRad),Ratio,vn,int(vn/Ratio));
Uniform(vn/Ratio,NNT);
std::vector<Point3x>::iterator vi;
typename std::vector<Point3<ScalarType> >::iterator vi;
ScalarType DotProd = cos(AngleRad);
for(vi=NNT.begin();vi!=NNT.end();++vi)
@ -82,7 +87,7 @@ static void Uniform(int vn, std::vector<Point3<ScalarType > > &NN)
OctaLevel pp;
int ll=10;
while(pow(4,ll)+2>vn) ll--;
while(pow(4.0f,ll)+2>vn) ll--;
pp.Init(ll);
sort(pp.v.begin(),pp.v.end());
@ -97,9 +102,12 @@ static void Perturb(std::vector<Point3<ScalarType > > &NN)
{
float width=0.2f/sqrt(float(NN.size()));
for(vector<Point3x>::iterator vi=NN.begin(); vi!=NN.end();++vi)
typename std::vector<Point3<ScalarType> >::iterator vi;
for(vi=NN.begin(); vi!=NN.end();++vi)
{
Point3x pp(float(rand())/RAND_MAX,float(rand())/RAND_MAX,float(rand())/RAND_MAX);
Point3x pp(((float)rand())/RAND_MAX,
((float)rand())/RAND_MAX,
((float)rand())/RAND_MAX);
pp=pp*2.0-Point3x(1,1,1);
pp*=width;
(*vi)+=pp;
@ -124,7 +132,7 @@ class OctaLevel
void Init(int lev)
{
sz=pow(2,lev+1)+1;
sz=pow(2.0f,lev+1)+1;
v.resize(sz*sz);
if(lev==0)
{
@ -151,7 +159,8 @@ class OctaLevel
if((i%2)!=0 && (j%2)!=0)
Val(i,j)=(tmp.Val(i/2+0,j/2+0)+tmp.Val(i/2+0,j/2+1)+tmp.Val(i/2+1,j/2+0)+tmp.Val(i/2+1,j/2+1))/4.0;
}
for(vector<Point3x>::iterator vi=v.begin(); vi!=v.end();++vi)
typename std::vector<Point3<ScalarType> >::iterator vi;
for(vi=v.begin(); vi!=v.end();++vi)
(*vi).Normalize();
}

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.6 2004/09/10 14:02:20 cignoni
Added Cone directions
Revision 1.5 2004/09/09 22:59:21 cignoni
Removed many small warnings
@ -195,7 +198,9 @@ void ComputeHalf(int nn, Point3x &dir, CallBack *cb)
VN.clear();
std::vector<Point3x> nvt;
GenNormal(nn*2,nvt);
assert(0 && "This is only my guess (to compile). (Ponchio)");
assert(0 && "Was: GenNormal(nn*2, nvt);");
GenNormal<ScalarType>::Uniform(nn*2,nvt);
for(int i=0;i<nvt.size();++i)
if(dir*nvt[i]>0) VN.push_back(nvt[i]);
@ -207,7 +212,8 @@ void ComputeUniformCone(int nn, std::vector<Point3x> &vv, ScalarType AngleRad, P
{
VN.clear();
GenNormal<ScalarType>::UniformCone(nn,VN,AngleRad,ConeDir);
for(vector<Point3x>::iterator vi=VN.begin();vi!=VN.end();++vi)
typename std::vector<Point3x>::iterator vi;
for(vi=VN.begin();vi!=VN.end();++vi)
vv.push_back(*vi);
char buf[256];
@ -219,7 +225,8 @@ void ComputeUniform(int nn, std::vector<Point3x> &vv, CallBack *cb)
{
VN.clear();
GenNormal<ScalarType>::Uniform(nn,VN);
for(vector<Point3x>::iterator vi=VN.begin();vi!=VN.end();++vi)
typename std::vector<Point3x>::iterator vi;
for(vi=VN.begin();vi!=VN.end();++vi)
vv.push_back(*vi);
char buf[256];