Skip to content

Commit 6b388aa

Browse files
committed
finish oct16 normal support; update page resources
1 parent a8bfba8 commit 6b388aa

17 files changed

+45577
-11
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PotreeConverter/obj
66
Potree.opensdf
77
bin/
88
obj
9-
build*/
9+
build/*
1010
.idea
1111
*.orig
1212
test/converted

PotreeConverter/include/BINPointWriter.hpp

+37
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
#include <iostream>
88
#include <fstream>
99

10+
#include <boost/math/special_functions/math_fwd.hpp>
11+
1012
#include "AABB.h"
1113
#include "PointAttributes.hpp"
1214
#include "PointWriter.hpp"
1315

16+
1417
using std::string;
1518
using std::vector;
1619
using std::ofstream;
1720
using std::ios;
21+
using boost::math::sign;
1822

1923

2024

@@ -83,6 +87,39 @@ class BINPointWriter : public PointWriter{
8387

8488
writer->write((const char*)&bx, 1);
8589
writer->write((const char*)&by, 1);
90+
}else if(attribute == PointAttribute::NORMAL_OCT16){
91+
// see http://lgdv.cs.fau.de/get/1602
92+
93+
float nx = point.nx;
94+
float ny = point.ny;
95+
float nz = point.nz;
96+
97+
float norm1 = abs(nx) + abs(ny) + abs(nz);
98+
99+
nx = nx / norm1;
100+
ny = ny / norm1;
101+
nz = nz / norm1;
102+
103+
float u = 0;
104+
float v = 0;
105+
106+
if(nz >= 0){
107+
u = nx;
108+
v = ny;
109+
}else{
110+
u = sign(nx)*(1-sign(ny)*ny);
111+
v = sign(ny)*(1-sign(nx)*nx);
112+
}
113+
114+
unsigned char bx = (unsigned char)(min((u + 1) * 128, 255.0f));
115+
unsigned char by = (unsigned char)(min((v + 1) * 128, 255.0f));
116+
117+
writer->write((const char*)&bx, 1);
118+
writer->write((const char*)&by, 1);
119+
}else if(attribute == PointAttribute::NORMAL){
120+
writer->write((const char*)&point.nx, sizeof(float));
121+
writer->write((const char*)&point.ny, sizeof(float));
122+
writer->write((const char*)&point.nz, sizeof(float));
86123
}
87124
}
88125

PotreeConverter/include/PointAttributes.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class PointAttribute{
1616
static const PointAttribute INTENSITY;
1717
static const PointAttribute CLASSIFICATION;
1818
static const PointAttribute NORMAL_SPHEREMAPPED;
19+
static const PointAttribute NORMAL_OCT16;
20+
static const PointAttribute NORMAL;
1921

2022
int ordinal;
2123
string name;

PotreeConverter/resources/page_template/build/js/laslaz.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PotreeConverter/resources/page_template/build/js/laslaz.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PotreeConverter/resources/page_template/build/js/potree.js

+9,485
Large diffs are not rendered by default.

PotreeConverter/resources/page_template/build/js/potree.min.js

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)