All pastes #605033 Raw Edit

Untitled

public text v1 · immutable
·published 2007-07-05 22:24 UTC
rendered paste body
#!/bin/sh
vertex=$(grep '^v' "$1" | wc -l )
face=$(grep '^f' "$1" | wc -l )

echo "ply"
echo "format ascii 1.0"
echo "comment converted with obj2ply"
echo "element vertex $vertex"
echo "property float x"
echo "property float y"
echo "property float z"
echo "element face $face"
echo "property list uchar int vertex_indices"
echo "end_header"

grep '^v' "$1" | sed 's/^v[ \t]*//'
grep '^f' "$1" | sed 's/^f[ \t]*//' | awk '{ ORS=" " ; print NF ; x=1 ; while(x <= NF) { print $x-1 ; x++ } ; print "\n" }'