MCPcopy Create free account
hub / github.com/demoth/jake2 / CM_PointLeafnum_r

Method CM_PointLeafnum_r

qcommon/src/main/java/jake2/qcommon/CM.java:910–932  ·  view source on GitHub ↗

Recursively searches the leaf number that contains the 3d point.

(float[] p, int num)

Source from the content-addressed store, hash-verified

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) {

Callers 3

CM_PointLeafnumMethod · 0.95
PointContentsMethod · 0.95

Calls 1

DotProductMethod · 0.95

Tested by

no test coverage detected