2005-02-08 13:43:03 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* VCGLib o o *
|
|
|
|
* Visual and Computer Graphics Library o o *
|
|
|
|
* _ O _ *
|
|
|
|
* Copyright(C) 2004 \/)\/ *
|
|
|
|
* Visual Computing Lab /\/| *
|
|
|
|
* ISTI - Italian National Research Council | *
|
|
|
|
* \ *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
|
|
|
* for more details. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
|
|
History
|
|
|
|
|
|
|
|
$Log: not supported by cvs2svn $
|
2005-02-21 18:55:49 +01:00
|
|
|
Revision 1.6 2005/02/08 12:43:03 ponchio
|
|
|
|
Added copyright
|
|
|
|
|
2005-02-08 13:43:03 +01:00
|
|
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
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;
|
2005-02-21 18:55:49 +01:00
|
|
|
vcg::Sphere3f sphere;
|
|
|
|
ANCone3f cone;
|
|
|
|
|
2004-10-19 03:19:46 +02:00
|
|
|
std::vector<vcg::Point3f> vert;
|
|
|
|
std::vector<unsigned short> face;
|
2005-02-21 18:55:49 +01:00
|
|
|
|
2004-10-19 03:19:46 +02:00
|
|
|
std::vector<Link> bord;
|
2005-02-21 18:55:49 +01:00
|
|
|
|
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
|
|
|
};
|
2005-02-21 18:55:49 +01:00
|
|
|
|
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
|