File indexing completed on 2026-04-09 07:49:23
0001
0002 """
0003 stree_load_test_csg.py
0004 =======================
0005
0006
0007 ::
0008
0009 In [15]: label,n[n[:,lv]==60]
0010 Out[15]:
0011 (' ix dp sx pt nc fc ns lv tc pa bb xf',
0012 array([[242, 2, 0, 244, 0, -1, 243, 60, 110, 151, 151, -1],
0013 [243, 2, 1, 244, 0, -1, -1, 60, 110, 152, 152, 89],
0014 [244, 1, 0, 246, 2, 242, 245, 60, 1, -1, -1, -1],
0015 [245, 1, 1, 246, 0, -1, -1, 60, 110, 153, 153, 90],
0016 [246, 0, -1, -1, 2, 244, -1, 60, 1, -1, -1, -1]], dtype=int32))
0017
0018
0019 int index ; // ix
0020 int depth ; // dp
0021 int sibdex ; // sx
0022 int parent ; // pt
0023
0024 int num_child ; // nc
0025 int first_child ; // fc
0026 int next_sibling ; // ns
0027 int lvid ; // lv
0028
0029 int typecode ; // tc
0030 int param ; // pa
0031 int aabb ; // bb
0032 int xform ; // xf
0033
0034 """
0035
0036 import numpy as np
0037 import builtins
0038 from opticks.ana.fold import Fold
0039 from opticks.sysrap.stree import stree
0040
0041 np.set_printoptions(edgeitems=16)
0042
0043
0044
0045 if __name__ == '__main__':
0046
0047 f = Fold.Load(symbol="f")
0048 print(repr(f))
0049
0050 n = f.node
0051
0052 fields = "ix dp sx pt nc fc ns lv tc pa bb xf".split()
0053 for i, fi in enumerate(fields): setattr(builtins, fi, i)
0054 label = " " * 8 + " ".join(fields)
0055 print(label)
0056
0057
0058 assert np.all( np.arange(len(n)) == n[:,ix] )
0059 assert np.all( n[:,dp] > -1 )
0060 assert np.all( n[:,dp] < 10 )
0061
0062
0063
0064
0065
0066