Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/danesfield/data/octahedron.ply
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ply
format ascii 1.0
element vertex 6
property float64 x
property float64 y
property float64 z
property uint8 red
property uint8 green
property uint8 blue
end_header
-1.0 1.0 0.0 255 0 0
-1.0 -1.0 0.0 0 255 0
1.0 -1.0 0.0 0 0 255
1.0 1.0 0.0 255 0 255
0.0 0.0 0.7 255 255 255
0.0 0.0 -0.7 0 0 0
29 changes: 29 additions & 0 deletions tests/danesfield/tools/test_ply2txt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
###############################################################################
# Copyright Kitware Inc. and Contributors
# Distributed under the Apache License, 2.0 (apache.org/licenses/LICENSE-2.0)
# See accompanying Copyright.txt and LICENSE files for details
###############################################################################

from tools.ply2txt import convert
from os.path import dirname, join
from os import remove

data_dir = join(dirname(dirname(__file__)), 'data')


def test_ply2txt():
ply_source = join(data_dir, 'octahedron.ply')
txt_target = join(data_dir, 'octahedron.txt')
convert([ply_source, txt_target])

with open(txt_target, 'r') as f:
lines = f.readlines()
assert lines == ['-1.0 1.0 0.0\n',
'-1.0 -1.0 0.0\n',
'1.0 -1.0 0.0\n',
'1.0 1.0 0.0\n',
'0.0 0.0 0.7\n',
'0.0 0.0 -0.7\n']

# clean up temporary output
remove(txt_target)