Guest User

Untitled

a guest
Sep 27th, 2014
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. # no explicit storage of information
  2. # tree structure implicitly stores information
  3. VoxelNode* = object
  4. case kind*: NodeKind
  5. of leaf:
  6. nil
  7. of node:
  8. children*: array[8, ref VoxelNode]
  9.  
  10. proc hash(x: VoxelNode): THash =
  11. var h: THash = 0
  12. case x.kind:
  13. of leaf:
  14. h = h !& 1
  15. of node:
  16. # hash each child node
  17. for idx in x.children:
  18. h = h !& hash(child)
  19.  
  20. result = !$h
  21.  
  22.  
  23. lib/system.nim(1825, 2) Error: parallel 'fields' iterator does not work for 'case' objects
Advertisement
Add Comment
Please, Sign In to add comment