*** empty log message ***

This commit is contained in:
Federico Ponchio 2004-11-28 07:58:49 +00:00
parent 11b96df32c
commit 4e4b1b89fc
7 changed files with 40 additions and 24 deletions

View File

@ -158,10 +158,10 @@ void Dispatcher::msghandler(message &msg) {
vector<BigLink> newbord; vector<BigLink> newbord;
Join(*fragin, newvert, newface, newbord); Join(*fragin, newvert, newface, newbord);
float error = Decimate(QUADRIC, float error = Decimate(mode,
(unsigned int)((newface.size()/3) * 0.5), (unsigned int)((newface.size()/3) * scaling),
newvert, newface, newbord); newvert, newface, newbord);
Fragment *fragout = new Fragment; Fragment *fragout = new Fragment;
fragout->error = error; fragout->error = error;

View File

@ -7,6 +7,8 @@
#include <map> #include <map>
#include <string> #include <string>
#include "decimate.h"
namespace nxs { namespace nxs {
#define MSG_SEND MSG_USER + 1 #define MSG_SEND MSG_USER + 1
@ -63,6 +65,8 @@ namespace nxs {
int maxqueue; int maxqueue;
Nexus *nexus; Nexus *nexus;
VoronoiChain *chain; VoronoiChain *chain;
Decimation mode;
float scaling;
std::vector<Server *> servers; std::vector<Server *> servers;
std::map<int, FragIO *> frags; std::map<int, FragIO *> frags;
}; };

View File

@ -1,10 +1,12 @@
#include <ptypes/ptime.h> #include <ptypes/ptime.h>
#include <ptypes/pinet.h> #include <ptypes/pinet.h>
#include <ptypes/pasync.h> #include <ptypes/pasync.h>
using namespace pt;
#include "fragment.h" #include "fragment.h"
#include "decimate.h" #include "decimate.h"
using namespace pt;
using namespace nxs; using namespace nxs;
using namespace vcg; using namespace vcg;
using namespace std; using namespace std;

View File

@ -141,7 +141,8 @@ Patch &PatchServer::GetPatch(unsigned int idx,
} }
PTime &ptime = lru[entry.lru_pos]; PTime &ptime = lru[entry.lru_pos];
pexchange(&(ptime.frame), frame++); //pexchange(&(ptime.frame), frame++);
ptime.frame = frame++;
// ramlock.unlock(); // ramlock.unlock();

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.8 2004/11/03 16:31:38 ponchio
Trying to fix big patches.
Revision 1.7 2004/10/30 20:17:03 ponchio Revision 1.7 2004/10/30 20:17:03 ponchio
Fixed big patches problem. Fixed big patches problem.
@ -85,9 +88,9 @@ void VoronoiPartition::Init() {
fprintf(ft, "%f\t%f\t%f\n", operator[](i)[0], operator[](i)[1], operator[](i)[2]); fprintf(ft, "%f\t%f\t%f\n", operator[](i)[0], operator[](i)[1], operator[](i)[2]);
} }
fclose(ft);*/ fclose(ft);*/
std::cerr << "Building kd!\n"; //std::cerr << "Building kd!\n";
bd = new ANNkd_tree(&*points.begin(), size(), 3); bd = new ANNkd_tree(&*points.begin(), size(), 3);
std::cerr << "Done!\n"; //std::cerr << "Done!\n";
} }
void VoronoiPartition::Closest(const vcg::Point3f &p, unsigned int nsize, void VoronoiPartition::Closest(const vcg::Point3f &p, unsigned int nsize,
vector<int> &nears, vector<int> &nears,

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.22 2004/11/28 04:14:12 ponchio
*** empty log message ***
Revision 1.21 2004/11/28 01:23:26 ponchio Revision 1.21 2004/11/28 01:23:26 ponchio
Fixing borders... let's hope. Fixing borders... let's hope.
@ -180,22 +183,19 @@ bool VoronoiChain::Optimize(int mean, VoronoiPartition &part,
for(unsigned int i = 0; i < part.size(); i++) { for(unsigned int i = 0; i < part.size(); i++) {
if(counts[i] > max_size || counts[i] > 2 * mean) { if(counts[i] > max_size || counts[i] > 2 * mean) {
failed++; failed++;
cerr << "Failed> " << counts[i] << endl; //cerr << "Failed> " << counts[i] << endl;
float radius= getClosest(part[i], part); float radius= getClosest(part[i], part);
cerr << "RADIUS: " << radius << endl; //cerr << "RADIUS: " << radius << endl;
if(radius == 0) { if(radius == 0) {
cerr << "Radius zero???\n"; cerr << "Radius zero???\n";
exit(0); exit(0);
} }
radius /= 3; radius /= 3;
if(radius < 0) continue; if(radius < 0) continue;
seeds.push_back(part[i] + Point3f(1, 0, 0) * radius); seeds.push_back(part[i] + Point3f(1, -1, 1) * radius);
seeds.push_back(part[i] + Point3f(0, 1, 0) * radius); seeds.push_back(part[i] + Point3f(-1, 1, 1) * radius);
seeds.push_back(part[i] + Point3f(0, 0, 1) * radius); seeds.push_back(part[i] + Point3f(-1, -1, -1) * radius);
seeds.push_back(part[i] + Point3f(1, 1, -1) * radius);
seeds.push_back(part[i] - Point3f(1, 0, 0) * radius);
seeds.push_back(part[i] - Point3f(0, 1, 0) * radius);
seeds.push_back(part[i] - Point3f(0, 0, 1) * radius);
mark[i]; mark[i];
} }
} }
@ -462,7 +462,7 @@ void VoronoiChain::BuildLevel(Nexus &nexus, unsigned int offset,
coarse.push_back(patch.Vert(0)); coarse.push_back(patch.Vert(0));
} }
float coarse_vmean = totvert/(float)coarse.size(); float coarse_vmean = totface/(float)coarse.size();
coarse.Init(); coarse.Init();
cerr << "Coarse size: " << coarse.size() << endl; cerr << "Coarse size: " << coarse.size() << endl;
@ -485,17 +485,18 @@ void VoronoiChain::BuildLevel(Nexus &nexus, unsigned int offset,
for(unsigned int idx = offset; idx < nexus.index.size(); idx++) { for(unsigned int idx = offset; idx < nexus.index.size(); idx++) {
report.Step(idx); report.Step(idx);
Patch patch = nexus.GetPatch(idx); Patch patch = nexus.GetPatch(idx);
for(unsigned int i = 0; i < patch.nv; i++) { for(unsigned int i = 0; i < patch.nf; i++) {
unsigned short *face = patch.Face(i);
unsigned int ctarget = coarse.Locate(patch.Vert(i)); Point3f bari = (patch.Vert(face[0]) + patch.Vert(face[1]) + patch.Vert(face[2]))/3;
assert(ctarget < coarse.size()); unsigned int ctarget = coarse.Locate(bari);
centroids[ctarget] += patch.Vert(i); assert(ctarget < coarse.size());
counts[ctarget]++; centroids[ctarget] += bari;
counts[ctarget]++;
} }
} }
if(step == steps-1) { if(step == steps-1) {
if(!Optimize((int)coarse_vmean, coarse, centroids, counts, false)) if(!Optimize((int)coarse_vmean, coarse, centroids, counts, false))
step--; step--;
} else } else
Optimize((int)coarse_vmean, coarse, centroids, counts, true); Optimize((int)coarse_vmean, coarse, centroids, counts, true);
} }

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.23 2004/11/28 01:23:26 ponchio
Fixing borders... let's hope.
Revision 1.22 2004/11/18 18:30:15 ponchio Revision 1.22 2004/11/18 18:30:15 ponchio
Using baricenters... lotsa changes. Using baricenters... lotsa changes.
@ -330,6 +333,8 @@ int main(int argc, char *argv[]) {
Report report; Report report;
Dispatcher dispatcher(&nexus, &vchain); Dispatcher dispatcher(&nexus, &vchain);
dispatcher.mode = decimation;
dispatcher.scaling = scaling;
if(!dispatcher.Init("servers.txt")) { if(!dispatcher.Init("servers.txt")) {
cerr << "Could not parse server file: " << "servers.txt" cerr << "Could not parse server file: " << "servers.txt"
<< " proceding locally\n"; << " proceding locally\n";