-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
eb3436a
commit b5aeeaf
Showing
4 changed files
with
463 additions
and
0 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
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 |
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,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 | ||
|
||
|
Oops, something went wrong.