vcglib/apps/nexus/remapping.h

96 lines
3.4 KiB
C
Raw Normal View History

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 $
****************************************************************************/
2004-11-30 23:50:30 +01:00
#ifndef NXS_REMAPPING_H
#define NXS_REMAPPING_H
#include <vector>
#include <string>
#include "nxstypes.h"
#include "vchain.h"
2004-12-02 21:16:13 +01:00
#include "nexus.h"
2004-11-30 23:50:30 +01:00
#include "vfile.h"
namespace nxs {
struct BlockEntry {
BlockEntry(int64 o = 0, unsigned int s = 0): offset(o), size(s) {}
int64 offset;
unsigned int size;
};
class BlockIndex: public std::vector<nxs::BlockEntry> {
public:
bool Save(const std::string &file);
bool Load(const std::string &file);
};
void Remap(VChain &chain,
VFile<vcg::Point3f> &points,
VFile<unsigned int> &remap,
BlockIndex &index,
unsigned int target_size,
unsigned int min_size,
unsigned int max_size,
float scaling,
int step);
void BuildPartition(VPartition &part,
VFile<vcg::Point3f> &points,
unsigned int target_size,
unsigned int min_size,
unsigned int max_size,
int steps);
2004-12-02 21:16:13 +01:00
void BuildLevel(VChain &chain,
Nexus &nexus,
unsigned int offset,
float scaling,
unsigned int target_size,
unsigned int min_size,
unsigned int max_size,
int steps);
2004-11-30 23:50:30 +01:00
//removes small or really big patches.
bool Optimize(VPartition &part,
2004-12-09 23:33:28 +01:00
unsigned int target_cells,
2004-11-30 23:50:30 +01:00
unsigned int target_size,
unsigned int min_size,
unsigned int max_size,
std::vector<vcg::Point3f> &centroids,
std::vector<unsigned int> &counts,
bool join);
int GetBest(VPartition &part, unsigned int seed,
std::vector<bool> &mark,
std::vector<unsigned int> &counts);
}
#endif