vcglib/apps/nexus/fragment.h

72 lines
1.4 KiB
C
Raw Normal View History

2004-10-19 03:19:46 +02:00
#ifndef NXS_FRAGMENT_H
#define NXS_FRAGMENT_H
#include <vector>
#include <ptypes/pstreams.h>
#include "nexus.h"
namespace nxs {
class VoronoiPartition;
2004-10-22 12:34:13 +02:00
struct BigLink {
unsigned int start_vert;
unsigned int end_patch;
unsigned int end_vert;
bool operator<(const BigLink &l) const {
if(end_patch == l.end_patch) {
if(start_vert == l.start_vert) {
return end_vert < l.end_vert;
} else
return start_vert < l.start_vert;
} else
return end_patch < l.end_patch;
}
};
2004-10-19 03:19:46 +02:00
class NxsPatch {
public:
2004-10-22 12:34:13 +02:00
//this fields is the patch number in the infragment
//and the seeds id in the outfragment
2004-10-19 03:19:46 +02:00
unsigned int patch;
std::vector<vcg::Point3f> vert;
std::vector<unsigned short> face;
2004-11-18 19:30:15 +01:00
2004-10-19 03:19:46 +02:00
std::vector<Link> bord;
2004-10-22 12:34:13 +02:00
void Write(pt::outstm *out);
void Read(pt::instm *in);
2004-10-19 03:19:46 +02:00
};
class Fragment {
public:
unsigned int id;
float error;
2004-10-22 12:34:13 +02:00
2004-10-30 22:17:03 +02:00
std::vector<vcg::Point3f> seeds;
2004-10-22 12:34:13 +02:00
std::vector<unsigned int> seeds_id;
2004-10-19 03:19:46 +02:00
std::vector<NxsPatch> pieces;
2004-11-18 19:30:15 +01:00
bool Write(pt::outstm *out);
bool Read(pt::instm *in);
2004-10-22 12:34:13 +02:00
//returns the index of the seed
unsigned int Locate(const vcg::Point3f &p);
2004-10-19 03:19:46 +02:00
};
2004-10-22 12:34:13 +02:00
void Join(Fragment &in,
2004-10-19 03:19:46 +02:00
std::vector<vcg::Point3f> &newvert,
std::vector<unsigned int> &newface,
2004-10-22 12:34:13 +02:00
std::vector<BigLink> &newbord);
2004-10-19 03:19:46 +02:00
2004-10-22 12:34:13 +02:00
void Split(Fragment &out,
2004-10-19 03:19:46 +02:00
std::vector<vcg::Point3f> &newvert,
std::vector<unsigned int> &newface,
2004-11-18 19:30:15 +01:00
std::vector<BigLink> &newbord);
2004-10-19 03:19:46 +02:00
}
#endif