Skip to content

Commit

Permalink
fix a numPoints bug; increase default spacing; decrease point node th…
Browse files Browse the repository at this point in the history
…reshold
  • Loading branch information
m-schuetz committed Dec 14, 2015
1 parent 01185ba commit 0a0ed37
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 0 additions & 2 deletions PotreeConverter/include/LASPointWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ namespace Potree{
class LASPointWriter : public PointWriter{

public:
string file;
int numPoints = 0;
AABB aabb;
laszip_POINTER writer = NULL;
laszip_header header;
Expand Down
2 changes: 1 addition & 1 deletion PotreeConverter/include/PointWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PointWriter{

public:
string file;
int numPoints;
int numPoints = 0;

virtual ~PointWriter(){};

Expand Down
2 changes: 1 addition & 1 deletion PotreeConverter/include/PotreeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PWNode{
bool addCalledSinceLastFlush = false;
PotreeWriter *potreeWriter;
vector<Point> cache;
int storeLimit = 20'000;
int storeLimit = 2'000;
vector<Point> store;
bool isInMemory = true;

Expand Down
15 changes: 15 additions & 0 deletions PotreeConverter/src/PotreeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ void PWNode::flush(){
for(const auto &e_c : points){
writer->write(e_c);
}

if(append && (writer->numPoints != this->numAccepted)){
cout << "writeToDisk " << writer->numPoints << " != " << this->numAccepted << endl;
exit(1);
}

writer->close();
delete writer;
};
Expand All @@ -259,6 +265,10 @@ void PWNode::flush(){
if(isLeafNode()){
if(addCalledSinceLastFlush){
writeToDisk(store, false);

//if(store.size() != this->numAccepted){
// cout << "store " << store.size() << " != " << this->numAccepted << " - " << this->name() << endl;
//}
}else if(!addCalledSinceLastFlush && isInMemory){
store = vector<Point>();

Expand All @@ -267,6 +277,11 @@ void PWNode::flush(){
}else{
if(addCalledSinceLastFlush){
writeToDisk(cache, true);
//if(cache.size() != this->numAccepted){
// cout << "cache " << cache.size() << " != " << this->numAccepted << " - " << this->name() << endl;
//
// exit(1);
//}
cache = vector<Point>();
}else if(!addCalledSinceLastFlush && isInMemory){
delete grid;
Expand Down
6 changes: 5 additions & 1 deletion PotreeConverter/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct Arguments{
string aabbValuesString;
vector<double> aabbValues;
string pageName = "";
string projection;
};

Arguments parseArguments(int argc, char **argv){
Expand All @@ -86,6 +87,7 @@ Arguments parseArguments(int argc, char **argv){
("aabb", po::value<string>(&a.aabbValuesString), "Bounding cube as \"minX minY minZ maxX maxY maxZ\". If not provided it is automatically computed")
("incremental", "Add new points to existing conversion")
("overwrite", "Replace existing conversion at target directory")
("projection", po::value<string>(&a.projection), "Specify projection in proj4 format.")
("source", po::value<std::vector<std::string> >(), "Source file. Can be LAS, LAZ, PTX or PLY");
po::positional_options_description p;
p.add("source", -1);
Expand Down Expand Up @@ -162,17 +164,19 @@ Arguments parseArguments(int argc, char **argv){
if(!vm.count("input-format")) a.format = "";
if(!vm.count("scale")) a.scale = 0;
if(!vm.count("output-format")) a.outFormatString = "BINARY";

if(a.outFormatString == "BINARY"){
a.outFormat = Potree::OutputFormat::BINARY;
}else if(a.outFormatString == "LAS"){
a.outFormat = Potree::OutputFormat::LAS;
}else if(a.outFormatString == "LAZ"){
a.outFormat = Potree::OutputFormat::LAZ;
}

if (a.diagonalFraction != 0) {
a.spacing = 0;
}else if(a.spacing == 0){
a.diagonalFraction = 250;
a.diagonalFraction = 200;
}

return a;
Expand Down

0 comments on commit 0a0ed37

Please sign in to comment.