128 lines
2.4 KiB
Bash
128 lines
2.4 KiB
Bash
#!/bin/bash
|
|
|
|
##############
|
|
# BASELINE
|
|
##############
|
|
|
|
echo "Baseline..."
|
|
openscad --version
|
|
|
|
BASELINE=$(mktemp -d)
|
|
FIRST="${BASELINE}/first.stl"
|
|
SECOND="${BASELINE}/second.stl"
|
|
|
|
openscad -q -o "${FIRST}" scad/deterministic.scad
|
|
openscad -q -o "${SECOND}" scad/deterministic2.scad
|
|
|
|
DIFF_VAL=$(diff "${FIRST}" "${SECOND}")
|
|
|
|
if [[ "${DIFF_VAL}" == "" ]]; then
|
|
echo "Files are the same"
|
|
else
|
|
#echo "${DIFF_VAL}"
|
|
echo "Files are different"
|
|
fi
|
|
|
|
rm -rf "${BASELINE}"
|
|
|
|
##############
|
|
# SORT-STL
|
|
##############
|
|
|
|
echo "sort-stl..."
|
|
|
|
SORTSTL=$(mktemp -d)
|
|
FIRST="${SORTSTL}/first.stl"
|
|
SECOND="${SORTSTL}/second.stl"
|
|
|
|
openscad -q -o "${FIRST}" --enable sort-stl scad/deterministic.scad
|
|
openscad -q -o "${SECOND}" --enable sort-stl scad/deterministic2.scad
|
|
|
|
DIFF_VAL=$(diff "${FIRST}" "${SECOND}")
|
|
|
|
if [[ "${DIFF_VAL}" == "" ]]; then
|
|
echo "Files are the same"
|
|
else
|
|
#echo "${DIFF_VAL}"
|
|
echo "Files are different"
|
|
fi
|
|
|
|
rm -rf "${SORTSTL}"
|
|
|
|
##############
|
|
# C14N
|
|
##############
|
|
|
|
echo "C14N..."
|
|
|
|
C14N=$(mktemp -d)
|
|
FIRST="${C14N}/first.stl"
|
|
SECOND="${C14N}/second.stl"
|
|
|
|
openscad -q -o "${FIRST}" scad/deterministic.scad
|
|
python3 python/c14n_stl.py "${FIRST}"
|
|
openscad -q -o "${SECOND}" scad/deterministic2.scad
|
|
python3 python/c14n_stl.py "${SECOND}"
|
|
|
|
DIFF_VAL=$(diff "${FIRST}" "${SECOND}")
|
|
|
|
if [[ "${DIFF_VAL}" == "" ]]; then
|
|
echo "Files are the same"
|
|
else
|
|
#echo "${DIFF_VAL}"
|
|
echo "Files are different"
|
|
fi
|
|
|
|
rm -rf "${C14N}"
|
|
|
|
##############
|
|
# RANDOM_SEED
|
|
##############
|
|
|
|
echo "random_seed..."
|
|
|
|
RANDOM_SEED=$(mktemp -d)
|
|
FIRST="${RANDOM_SEED}/first.stl"
|
|
SECOND="${RANDOM_SEED}/second.stl"
|
|
|
|
openscad -q -o "${FIRST}" scad/deterministic_random_seed.scad
|
|
openscad -q -o "${SECOND}" scad/deterministic_random_seed2.scad
|
|
|
|
DIFF_VAL=$(diff "${FIRST}" "${SECOND}")
|
|
|
|
if [[ "${DIFF_VAL}" == "" ]]; then
|
|
echo "Files are the same"
|
|
else
|
|
#echo "${DIFF_VAL}"
|
|
echo "Files are different"
|
|
fi
|
|
|
|
rm -rf "${RANDOM_SEED}"
|
|
|
|
#--export-format asciistl
|
|
#--export-format binstl
|
|
|
|
##############
|
|
# SORT-STL vs. C14N
|
|
##############
|
|
|
|
echo "sort-stl..."
|
|
|
|
SORTSTL=$(mktemp -d)
|
|
FIRST="${SORTSTL}/first.stl"
|
|
SECOND="${SORTSTL}/second.stl"
|
|
|
|
openscad -q -o "${FIRST}" --enable sort-stl scad/deterministic.scad
|
|
openscad -q -o "${SECOND}" scad/deterministic2.scad
|
|
python3 python/c14n_stl.py "${SECOND}"
|
|
|
|
DIFF_VAL=$(diff "${FIRST}" "${SECOND}")
|
|
|
|
if [[ "${DIFF_VAL}" == "" ]]; then
|
|
echo "Files are the same"
|
|
else
|
|
#echo "${DIFF_VAL}"
|
|
echo "Files are different"
|
|
fi
|
|
|
|
rm -rf "${SORTSTL}" |