Use ADMesh to calculate facets and volume of resulting models. Look for significant differences in render time and size between spiral approaches.

This commit is contained in:
mmcwilliams 2020-05-22 19:09:02 -04:00
parent 5f592661ba
commit c677099742
2 changed files with 28 additions and 10 deletions

View File

@ -5,11 +5,13 @@ CPU=`bash ./scripts/cpu.sh`
DATE=`date -u +%s` #timestamp in seconds DATE=`date -u +%s` #timestamp in seconds
NOTES="./notes/benchmark.csv" NOTES="./notes/benchmark.csv"
ROTATIONS=( 1 2 5 10 20 ) ROTATIONS=( 1 2 ) # 5 10 20 )
DIAMETERS=( 47 225 300 ) DIAMETERS=( 47 ) # 225 300 )
COMPLETE=( 40 60 ) COMPLETE=( 40 60 )
echo "version,cpu,date,source,diameter,rotations,$fn,size,time" > $NOTES mkdir -p benchmark
echo "version,cpu,date,source,diameter,rotations,fn,size,facets,volume,time" > $NOTES
for SPIRAL in ./spiral/*.scad for SPIRAL in ./spiral/*.scad
do do
@ -22,19 +24,23 @@ do
do do
: :
echo "Rendering ${SPIRAL} for ${ROT} rotations @ ${D}mm" echo "Rendering ${SPIRAL} for ${ROT} rotations @ ${D}mm"
TMP=`mktemp` #TMP=`mktemp`
TMP="benchmark/${FILENAME}_${D}_${ROT}_100"
start=`date +%s` start=`date +%s`
openscad -o "${TMP}.stl" -D N=${ROT} -D D=${D} -D FN=100 "${SPIRAL}" openscad -o "${TMP}.stl" -D N=${ROT} -D D=${D} -D FN=100 "${SPIRAL}"
end=`date +%s` end=`date +%s`
runtime=$((end-start)) runtime=$((end-start))
size=`wc -c < "${TMP}.stl"` size=`wc -c < "${TMP}.stl"`
size=`echo $size | xargs` size=`echo $size | xargs`
ao=`admesh -c "${TMP}.stl"`
facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`
line="${VERSION},${CPU},${DATE},${FILENAME},${D},${ROT},100,$size,$runtime" line="${VERSION},${CPU},${DATE},${FILENAME},${D},${ROT},100,$size,$facets,$volume,$runtime"
echo $line echo $line
echo $line >> $NOTES echo $line >> $NOTES
rm "${TMP}.stl" #rm "${TMP}.stl"
done done
done done
@ -42,12 +48,21 @@ do
do do
: :
echo "Rendering complete ${SPIRAL} with ${C} rotations" echo "Rendering complete ${SPIRAL} with ${C} rotations"
TMP=`mktemp` #TMP=`mktemp`
TMP="benchmark/${FILENAME}_${D}_${ROT}_100"
start=`date +%s` start=`date +%s`
echo -o "${TMP}.stl" -D N=${C} -D D=47 "${SPIRAL}" echo -o "${TMP}.stl" -D N=${C} -D D=47 "${SPIRAL}"
end=`date +%s` end=`date +%s`
runtime=$((end-start)) runtime=$((end-start))
echo "${TMP}.stl" size=`wc -c < "${TMP}.stl"`
size=`echo $size | xargs`
ao=`admesh -c "${TMP}.stl"`
facets=`echo $ao | grep "Number of facets" | awk '{print $5}'`
volume=`echo $ao | grep "Number of parts" | awk '{print $8}'`
line="${VERSION},${CPU},${DATE},${FILENAME},${D},${ROT},100,$size,$facets,$volume,$runtime"
#echo $line >> $NOTES
echo $line
#rm "${TMP}.stl" #rm "${TMP}.stl"
done done

View File

@ -11,7 +11,7 @@ SIZES=( "50ft" "100ft" )
mkdir -p $DIST mkdir -p $DIST
echo "version,cpu,file,file_hash,file_size,source_hash,source_size,render_time" > $NOTES echo "version,cpu,file,file_hash,file_size,source_hash,source_size,facets,volume,render_time" > $NOTES
for SIZE in "${SIZES[@]}" for SIZE in "${SIZES[@]}"
do do
@ -32,7 +32,10 @@ do
hash=`sha256sum "${DIST}/${SIZE}_v1/gnal_${SIZE}_${FILE}.stl" | awk '{ print $1 }'` hash=`sha256sum "${DIST}/${SIZE}_v1/gnal_${SIZE}_${FILE}.stl" | awk '{ print $1 }'`
fileSize=`wc -c < "${DIST}/${SIZE}_v1/gnal_${SIZE}_${FILE}.stl"` fileSize=`wc -c < "${DIST}/${SIZE}_v1/gnal_${SIZE}_${FILE}.stl"`
fileSize=`echo $fileSize | xargs` fileSize=`echo $fileSize | xargs`
line="${VERSION},${CPU},gnal_${SIZE}_${FILE}.stl,$hash,$fileSize,$srchash,$srcsize,$runtime" ao=`admesh -c "${DIST}/${SIZE}_v1/gnal_${SIZE}_${FILE}.stl"`
facets=`echo $ao | grep "Number of facets" | awk '{print $5}'`
volume=`echo $ao | grep "Number of parts" | awk '{print $8}'`
line="${VERSION},${CPU},gnal_${SIZE}_${FILE}.stl,$hash,$fileSize,$srchash,$srcsize,$facets,$volume,$runtime"
echo "$line" >> $NOTES echo "$line" >> $NOTES
echo "$line" echo "$line"
done done