Recursively searches the leaf number that contains the 3d point.
(float[] p, int num)
| 908 | |
| 909 | /** Recursively searches the leaf number that contains the 3d point. */ |
| 910 | private int CM_PointLeafnum_r(float[] p, int num) { |
| 911 | float d; |
| 912 | cnode_t node; |
| 913 | cplane_t plane; |
| 914 | |
| 915 | while (num >= 0) { |
| 916 | node = map_nodes[num]; |
| 917 | plane = node.plane; |
| 918 | |
| 919 | if (plane.type < 3) |
| 920 | d = p[plane.type] - plane.dist; |
| 921 | else |
| 922 | d = Math3D.DotProduct(plane.normal, p) - plane.dist; |
| 923 | if (d < 0) |
| 924 | num = node.children[1]; |
| 925 | else |
| 926 | num = node.children[0]; |
| 927 | } |
| 928 | |
| 929 | Globals.c_pointcontents++; // optimize counter |
| 930 | |
| 931 | return -1 - num; |
| 932 | } |
| 933 | |
| 934 | /** Searches the leaf number that contains the 3d point. */ |
| 935 | public int CM_PointLeafnum(float[] p) { |
no test coverage detected