corrected some error in Import/export 4rosy
This commit is contained in:
parent
f2a5f1ef72
commit
9e4394a656
|
|
@ -94,15 +94,14 @@ public:
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
FILE *f = fopen(path,"wt");
|
FILE *f = fopen(path,"wt");
|
||||||
fprintf(f,"%d\n",mesh.vn);
|
fprintf(f,"%d\n",mesh.fn);
|
||||||
fprintf(f,"4\n");
|
fprintf(f,"4\n");
|
||||||
for (unsigned int i=0;i<mesh.vert.size();i++)
|
for (unsigned int i=0;i<mesh.face.size();i++)
|
||||||
{
|
{
|
||||||
float dirX=(float)mesh.vert[i].PD1().X();
|
float dirX=(float)mesh.face[i].PD1().X();
|
||||||
float dirY=(float)mesh.vert[i].PD1().Y();
|
float dirY=(float)mesh.face[i].PD1().Y();
|
||||||
float dirZ=(float)mesh.vert[i].PD1().Z();
|
float dirZ=(float)mesh.face[i].PD1().Z();
|
||||||
fprintf(f,"%f %f %f \n",dirX,dirY,dirZ);
|
fprintf(f,"%f %f %f \n",dirX,dirY,dirZ);
|
||||||
|
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -219,25 +219,30 @@ public:
|
||||||
///Load a 4 rosy format file as used by
|
///Load a 4 rosy format file as used by
|
||||||
///Interactive Visualization of Rotational Symmetry Fields on Surfaces
|
///Interactive Visualization of Rotational Symmetry Fields on Surfaces
|
||||||
///Jonathan Palacios and Eugene Zhang
|
///Jonathan Palacios and Eugene Zhang
|
||||||
static void Load4ROSY(MeshType &mesh,
|
static bool Load4ROSY(MeshType &mesh,
|
||||||
const char *path)
|
const char *path)
|
||||||
{
|
{
|
||||||
FILE *f = fopen(path,"rt");
|
FILE *f = fopen(path,"rt");
|
||||||
|
if (!f)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
int num,symm;
|
int num,symm;
|
||||||
fscanf(f,"%d",&num);
|
fscanf(f,"%d",&num);
|
||||||
assert(num==mesh.vn);
|
assert(num==mesh.fn);
|
||||||
fscanf(f,"%d\n",&symm);
|
fscanf(f,"%d\n",&symm);
|
||||||
assert(symm==4);
|
assert(symm==4);
|
||||||
for (unsigned int i=0;i<num;i++)
|
for (int i=0;i<num;i++)
|
||||||
{
|
{
|
||||||
float dirX,dirY,dirZ;
|
float dirX,dirY,dirZ;
|
||||||
fscanf(f,"%f %f %f \n",&dirX,&dirY,&dirZ);
|
fscanf(f,"%f %f %f \n",&dirX,&dirY,&dirZ);
|
||||||
mesh.vert[i].PD1()=CoordType(dirX,dirY,dirZ);
|
mesh.face[i].PD1()=CoordType(dirX,dirY,dirZ);
|
||||||
mesh.vert[i].PD2()=mesh.vert[i].PD1()^mesh.vert[i].N();
|
mesh.face[i].PD2()=mesh.face[i].PD1()^mesh.face[i].N();
|
||||||
mesh.vert[i].PD1().Normalize();
|
mesh.face[i].PD1().Normalize();
|
||||||
mesh.vert[i].PD2().Normalize();
|
mesh.face[i].PD2().Normalize();
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue