File indexing completed on 2026-04-09 07:49:00
0001
0002 usage(){ cat << EOU
0003 sdf_geochain.sh using CSGSignedDistanceFieldTest.cc and test/CSGSignedDistanceFieldTest.py
0004 ===========================================================================================
0005
0006 Rendering CSGFoundry geometry using SDF distance fields
0007 and pyvista contouring techniques such as marching cubes.::
0008
0009 cd ~/opticks/CSG
0010 ./sdf_geochain.sh
0011
0012 CAUTION: only a few primitive distance functions are implemented in csg_intersect_node.h
0013 This will causing missing pieces for many GEOM depending on what primitives are used.
0014
0015 SDF rendering of GeoChain geometries converted from G4VSolid
0016 -------------------------------------------------------------
0017
0018 See GeoChain/run.sh for available GEOM names, examples::
0019
0020 GEOM=XJfixtureConstruction ./sdf_geochain.sh
0021 GEOM=AltXJfixtureConstruction ./sdf_geochain.sh
0022
0023 GEOM=XJfixtureConstruction EDGES=1 ./sdf_geochain.sh
0024 GEOM=AltXJfixtureConstruction EDGES=1 ./sdf_geochain.sh
0025
0026
0027
0028
0029 SDF rendering of Adhoc CSGMaker geometries
0030 ---------------------------------------------
0031
0032 See CSG/CSGMaker.cc CSGMaker::make for GEOM names::
0033
0034 GEOM=UnionBoxSphere ./sdf_geochain.sh
0035 GEOM=DifferenceBoxSphere ./sdf_geochain.sh
0036 GEOM=IntersectionBoxSphere ./sdf_geochain.sh
0037
0038 TODO: extend to working with CSGPrim grabbed from standard geometry
0039 ---------------------------------------------------------------------
0040
0041 Maybe better to do this in another script, probably use MOI for picking.
0042
0043 EOU
0044 }
0045
0046 msg="=== $BASH_SOURCE :"
0047
0048 geom=AltXJfixtureConstruction
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071 catgeom=$(cat ~/.opticks/GEOM.txt 2>/dev/null | grep -v \#) && [ -n "$catgeom" ] && echo $msg catgeom $catgeom override of default geom $geom && geom=$(echo ${catgeom%%_*})
0072 export GEOM=${GEOM:-$geom}
0073
0074 if [ "$(uname)" == "Linux" ]; then
0075 cfname=GeoChain/$GEOM
0076 else
0077 cfname=GeoChain_Darwin/$GEOM
0078 fi
0079
0080 moi=ALL
0081
0082 export MOI=${1:-$moi}
0083 export CFNAME=${CFNAME:-$cfname}
0084 cfbase=/tmp/$USER/opticks/${CFNAME}
0085
0086 if [ -n "$CFNAME" -a -d "$cfbase/CSGFoundry" ]; then
0087 echo $msg CFNAME $CFNAME cfbase $cfbase exists : proceed with initFD_cfbase
0088 export CFBASE=$cfbase
0089 else
0090 echo $msg CFNAME $CFNAME cfbase $cfbase DOES NOT EXIST : proceed with adhoc CSGMaker initFD_geom
0091 unset CFBASE
0092 fi
0093
0094 ars="GEOM MOI CFNAME CFBASE"
0095 echo $msg
0096 for var in $vars ; do printf "%-20s : %s \n" $var "${!var}" ; done
0097
0098
0099 bin=CSGSignedDistanceFieldTest
0100
0101 which $bin
0102
0103
0104
0105 if [ -n "$DBG" -a "$(uname)" == "Darwin" ]; then
0106 lldb__ $bin
0107 else
0108 $bin
0109 fi
0110
0111 [ $? -ne 0 ] && echo $msg runtime error && exit 1
0112
0113 ${IPYTHON:-ipython} -i tests/CSGSignedDistanceFieldTest.py
0114 [ $? -ne 0 ] && echo $msg ana error && exit 2
0115
0116 exit 0
0117
0118