Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
naredokitsch authored Jul 23, 2016
1 parent eb3436a commit b5aeeaf
Show file tree
Hide file tree
Showing 4 changed files with 463 additions and 0 deletions.
30 changes: 30 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

ply=${1/.txt/.ply}

cut -d " " -f 2,3,4 $1 | sed '1d' > tmp.txt

num_rows=$(wc -l tmp.txt)
num_Rows=${num_rows/ tmp.txt/}

echo "ply" > cabeza.txt
echo "format ascii 1.0" >> cabeza.txt
echo "comment merged by NaredoKitsch" >> cabeza.txt
echo "element vertex $num_Rows" >> cabeza.txt
sed 's/ / /g' cabeza.txt > cabeza2.txt
echo "property float x" >> cabeza2.txt
echo "property float y" >> cabeza2.txt
echo "property float z" >> cabeza2.txt
echo "end_header" >> cabeza2.txt
cat tmp.txt >> cabeza2.txt

cp cabeza2.txt $ply


rm tmp.txt
rm cabeza.txt
rm cabeza2.txt

open $ply

rm $1
50 changes: 50 additions & 0 deletions get_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

threeDFile=$1
fileName=${threeDFile/.ply/}
textFile=$fileName.txt

######################################################

if [ ! -d "$fileName" ]; then
mkdir $fileName
else
:
fi

cd $fileName

cp ../$threeDFile $textFile
mv ../$threeDFile $threeDFile

#####################################################

grep -E 'ply|format|comment|element|property|end_header' $textFile > $fileName.header.txt

######################################################

numsVertex=$(grep element $textFile | grep vertex | cut -d " " -f 3)
numsFaces=$(grep element $textFile | grep face | cut -d " " -f 3)

grep property $textFile | grep -v list | cut -d " " -f 3 > tmp.txt
header=$(tr -d "[\000-\011\013-\020]" < tmp.txt | awk ' BEGIN { ORS="\t" } { print }')

grep -v ply $textFile | grep -v format | grep -v element | grep -v property | grep -v comment | grep -v end_header > elements.txt

sed -n -e "1,$numsVertex p" -e "$numsVertex q" elements.txt | sed 's/ / /g' > $fileName.xyz.txt

echo $header | cat - $fileName.xyz.txt > temp && mv temp $fileName.xyz.txt

sed 's/ / /g' $fileName.xyz.txt | sed '/^\s*$/d' > $fileName.vertex.txt

######################################################

sed -n -e "$numsVertex,$(cat elements.txt | wc -l) p" -e "$(cat elements.txt | wc -l) q" elements.txt | sed 's/ / /g' | sed '1d' | sed '/^\s*$/d' > $fileName.faces.txt

######################################################

rm $fileName.xyz.txt
rm tmp.txt
rm elements.txt


Loading

0 comments on commit b5aeeaf

Please sign in to comment.