*** 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;
Join(*fragin, newvert, newface, newbord);
float error = Decimate(QUADRIC,
(unsigned int)((newface.size()/3) * 0.5),
float error = Decimate(mode,
(unsigned int)((newface.size()/3) * scaling),
newvert, newface, newbord);
Fragment *fragout = new Fragment;
fragout->error = error;

View File

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

View File

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

View File

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

View File

@ -24,6 +24,9 @@
History
$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
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]);
}
fclose(ft);*/
std::cerr << "Building kd!\n";
//std::cerr << "Building kd!\n";
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,
vector<int> &nears,

View File

@ -24,6 +24,9 @@
History
$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
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++) {
if(counts[i] > max_size || counts[i] > 2 * mean) {
failed++;
cerr << "Failed> " << counts[i] << endl;
//cerr << "Failed> " << counts[i] << endl;
float radius= getClosest(part[i], part);
cerr << "RADIUS: " << radius << endl;
//cerr << "RADIUS: " << radius << endl;
if(radius == 0) {
cerr << "Radius zero???\n";
exit(0);
}
radius /= 3;
if(radius < 0) continue;
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);
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);
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, -1, -1) * radius);
seeds.push_back(part[i] + Point3f(1, 1, -1) * radius);
mark[i];
}
}
@ -462,7 +462,7 @@ void VoronoiChain::BuildLevel(Nexus &nexus, unsigned int offset,
coarse.push_back(patch.Vert(0));
}
float coarse_vmean = totvert/(float)coarse.size();
float coarse_vmean = totface/(float)coarse.size();
coarse.Init();
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++) {
report.Step(idx);
Patch patch = nexus.GetPatch(idx);
for(unsigned int i = 0; i < patch.nv; i++) {
unsigned int ctarget = coarse.Locate(patch.Vert(i));
assert(ctarget < coarse.size());
centroids[ctarget] += patch.Vert(i);
counts[ctarget]++;
for(unsigned int i = 0; i < patch.nf; i++) {
unsigned short *face = patch.Face(i);
Point3f bari = (patch.Vert(face[0]) + patch.Vert(face[1]) + patch.Vert(face[2]))/3;
unsigned int ctarget = coarse.Locate(bari);
assert(ctarget < coarse.size());
centroids[ctarget] += bari;
counts[ctarget]++;
}
}
if(step == steps-1) {
if(!Optimize((int)coarse_vmean, coarse, centroids, counts, false))
step--;
step--;
} else
Optimize((int)coarse_vmean, coarse, centroids, counts, true);
}

View File

@ -24,6 +24,9 @@
History
$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
Using baricenters... lotsa changes.
@ -330,6 +333,8 @@ int main(int argc, char *argv[]) {
Report report;
Dispatcher dispatcher(&nexus, &vchain);
dispatcher.mode = decimation;
dispatcher.scaling = scaling;
if(!dispatcher.Init("servers.txt")) {
cerr << "Could not parse server file: " << "servers.txt"
<< " proceding locally\n";