-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
357 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Potree Utils | ||
|
||
## Hierarchy | ||
|
||
### Summarize | ||
|
||
```console | ||
foo@bar:~$ potree-utils hierarchy summarize --metadata heidentor/metadata.json | ||
| Level | Nodes | Average | Min | Max | Total | Volume | Spacing | | ||
|--------|----------|----------|----------|----------|--------------|-----------------|--------------| | ||
| 0 | 1 | 20640 | 20640 | 20640 | 20640 | 3765.8351 | 0.1215469 | | ||
| 1 | 8 | 7888 | 1610 | 18043 | 63104 | 470.7294 | 0.0607734 | | ||
| 2 | 42 | 6117 | 251 | 18823 | 256932 | 58.8412 | 0.0303867 | | ||
| 3 | 164 | 6162 | 3 | 14552 | 1010691 | 7.3551 | 0.0151934 | | ||
| 4 | 626 | 6098 | 2 | 19973 | 3817612 | 0.9194 | 0.0075967 | | ||
| 5 | 2265 | 4623 | 1 | 12535 | 10471591 | 0.1149 | 0.0037983 | | ||
| 6 | 5769 | 1767 | 1 | 5405 | 10194083 | 0.0144 | 0.0018992 | | ||
| 7 | 7 | 252 | 1 | 486 | 1764 | 0.0018 | 0.0009496 | | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
package ply_test | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/EliCDavis/polyform/formats/ply" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestHeaderTextureFiles(t *testing.T) { | ||
tests := map[string]struct { | ||
input ply.Header | ||
want []string | ||
}{ | ||
"no textures": { | ||
input: ply.Header{ | ||
Comments: []string{ | ||
"test", | ||
}, | ||
}, | ||
want: []string{}, | ||
}, | ||
"single tex": { | ||
input: ply.Header{ | ||
Comments: []string{ | ||
"texturefile a.png", | ||
}, | ||
}, | ||
want: []string{ | ||
"a.png", | ||
}, | ||
}, | ||
"multiple textures": { | ||
input: ply.Header{ | ||
Comments: []string{ | ||
"something", | ||
"texturefile a.png", | ||
"other something", | ||
"TEXTUREFILE b.png", | ||
"TextureFile with a space.jpg", | ||
}, | ||
}, | ||
want: []string{ | ||
"a.png", | ||
"b.png", | ||
"with a space.jpg", | ||
}, | ||
}, | ||
} | ||
|
||
for name, tc := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
assert.Equal(t, tc.want, tc.input.TextureFiles()) | ||
}) | ||
} | ||
} | ||
|
||
func TestHeaderWrite(t *testing.T) { | ||
tests := map[string]struct { | ||
input ply.Header | ||
want string | ||
}{ | ||
"empty ascii": { | ||
input: ply.Header{ | ||
Format: ply.ASCII, | ||
}, | ||
want: `ply | ||
format ascii 1.0 | ||
end_header | ||
`, | ||
}, | ||
"empty little endian": { | ||
input: ply.Header{ | ||
Format: ply.BinaryLittleEndian, | ||
}, | ||
want: `ply | ||
format binary_little_endian 1.0 | ||
end_header | ||
`, | ||
}, | ||
"empty big endian": { | ||
input: ply.Header{ | ||
Format: ply.BinaryBigEndian, | ||
}, | ||
want: `ply | ||
format binary_big_endian 1.0 | ||
end_header | ||
`, | ||
}, | ||
"obj_info": { | ||
input: ply.Header{ | ||
Format: ply.ASCII, | ||
ObjInfo: []string{ | ||
"test one two", | ||
"test three four", | ||
}, | ||
}, | ||
want: `ply | ||
format ascii 1.0 | ||
obj_info test one two | ||
obj_info test three four | ||
end_header | ||
`, | ||
}, | ||
"comments": { | ||
input: ply.Header{ | ||
Format: ply.ASCII, | ||
Comments: []string{ | ||
"test one two", | ||
"test three four", | ||
}, | ||
}, | ||
want: `ply | ||
format ascii 1.0 | ||
comment test one two | ||
comment test three four | ||
end_header | ||
`, | ||
}, | ||
"single element": { | ||
input: ply.Header{ | ||
Format: ply.ASCII, | ||
Comments: []string{ | ||
"Test Comment", | ||
}, | ||
ObjInfo: []string{ | ||
"Test OBJ", | ||
}, | ||
Elements: []ply.Element{ | ||
{ | ||
Name: "test", | ||
Count: 12345678, | ||
Properties: []ply.Property{ | ||
ply.ScalarProperty{ | ||
PropertyName: "foo", | ||
Type: ply.UChar, | ||
}, | ||
ply.ScalarProperty{ | ||
PropertyName: "Bar", | ||
Type: ply.Double, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
want: `ply | ||
format ascii 1.0 | ||
comment Test Comment | ||
obj_info Test OBJ | ||
element test 12345678 | ||
property uchar foo | ||
property double Bar | ||
end_header | ||
`, | ||
}, | ||
} | ||
|
||
for name, tc := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
buf := &bytes.Buffer{} | ||
assert.NoError(t, tc.input.Write(buf)) | ||
assert.Equal(t, tc.want, buf.String()) | ||
assert.Equal(t, tc.want, string(tc.input.Bytes())) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.