corrected some warning and added support for read/write rosy format
This commit is contained in:
parent
09ff045451
commit
7ffcc407c9
|
|
@ -380,7 +380,7 @@ namespace vcg {
|
||||||
const CoordType &BaseDir)
|
const CoordType &BaseDir)
|
||||||
{
|
{
|
||||||
CoordType sum = CoordType(0,0,0);
|
CoordType sum = CoordType(0,0,0);
|
||||||
for (int i=0;i<TangVect.size();i++)
|
for (unsigned int i=0;i<TangVect.size();i++)
|
||||||
{
|
{
|
||||||
CoordType N1=Norms[i];
|
CoordType N1=Norms[i];
|
||||||
///find the rotation matrix that maps between normals
|
///find the rotation matrix that maps between normals
|
||||||
|
|
@ -710,16 +710,16 @@ namespace vcg {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
///load a field on the mesh, it could be a vfield file (per vertex)
|
///Save a 4 rosy format file as used by
|
||||||
///or an ffield file (per face)
|
///Interactive Visualization of Rotational Symmetry Fields on Surfaces
|
||||||
|
///Jonathan Palacios and Eugene Zhang
|
||||||
static void Save4ROSY(MeshType &mesh,
|
static void Save4ROSY(MeshType &mesh,
|
||||||
const char *path,
|
const char *path)
|
||||||
bool per_vertex=false)
|
|
||||||
{
|
{
|
||||||
FILE *f = fopen(path,"wt");
|
FILE *f = fopen(path,"wt");
|
||||||
fprintf(f,"%d\n",mesh.vn);
|
fprintf(f,"%d\n",mesh.vn);
|
||||||
fprintf(f,"4\n");
|
fprintf(f,"4\n");
|
||||||
for (int i=0;i<mesh.vert.size();i++)
|
for (unsigned int i=0;i<mesh.vert.size();i++)
|
||||||
{
|
{
|
||||||
float dirX=(float)mesh.vert[i].PD1().X();
|
float dirX=(float)mesh.vert[i].PD1().X();
|
||||||
float dirY=(float)mesh.vert[i].PD1().Y();
|
float dirY=(float)mesh.vert[i].PD1().Y();
|
||||||
|
|
@ -730,6 +730,30 @@ namespace vcg {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Load a 4 rosy format file as used by
|
||||||
|
///Interactive Visualization of Rotational Symmetry Fields on Surfaces
|
||||||
|
///Jonathan Palacios and Eugene Zhang
|
||||||
|
static void Load4ROSY(MeshType &mesh,
|
||||||
|
const char *path)
|
||||||
|
{
|
||||||
|
FILE *f = fopen(path,"rt");
|
||||||
|
int num,symm;
|
||||||
|
fscanf(f,"%d",&num);
|
||||||
|
assert(num==mesh.vn);
|
||||||
|
fscanf(f,"%d\n",&symm);
|
||||||
|
assert(symm==4);
|
||||||
|
for (unsigned int i=0;i<num;i++)
|
||||||
|
{
|
||||||
|
float dirX,dirY,dirZ;
|
||||||
|
fscanf(f,"%f %f %f \n",&dirX,&dirY,&dirZ);
|
||||||
|
mesh.vert[i].PD1()=CoordType(dirX,dirY,dirZ);
|
||||||
|
mesh.vert[i].PD2()=mesh.vert[i].PD1()^mesh.vert[i].N();
|
||||||
|
mesh.vert[i].PD1().Normalize();
|
||||||
|
mesh.vert[i].PD2().Normalize();
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
static void MakeDirectionFaceCoherent(MeshType &mesh)
|
static void MakeDirectionFaceCoherent(MeshType &mesh)
|
||||||
{
|
{
|
||||||
vcg::tri::UpdateFlags<MeshType>::FaceClearS(mesh);
|
vcg::tri::UpdateFlags<MeshType>::FaceClearS(mesh);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue