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

Method TransformedPointContents

qcommon/src/main/java/jake2/qcommon/CM.java:1029–1053  ·  view source on GitHub ↗
(float[] p, int headnode,
            float[] origin, float[] angles)

Source from the content-addressed store, hash-verified

1027 * entities ==================
1028 */
1029 public int TransformedPointContents(float[] p, int headnode,
1030 float[] origin, float[] angles) {
1031 float[] p_l = { 0, 0, 0 };
1032 float[] temp = { 0, 0, 0 };
1033 float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, up = { 0, 0, 0 };
1034 int l;
1035
1036 // subtract origin offset
1037 Math3D.VectorSubtract(p, origin, p_l);
1038
1039 // rotate start and end into the models frame of reference
1040 if (headnode != box_headnode
1041 && (angles[0] != 0 || angles[1] != 0 || angles[2] != 0)) {
1042 Math3D.AngleVectors(angles, forward, right, up);
1043
1044 Math3D.VectorCopy(p_l, temp);
1045 p_l[0] = Math3D.DotProduct(temp, forward);
1046 p_l[1] = -Math3D.DotProduct(temp, right);
1047 p_l[2] = Math3D.DotProduct(temp, up);
1048 }
1049
1050 l = CM_PointLeafnum_r(p_l, headnode);
1051
1052 return map_leafs[l].contents;
1053 }
1054
1055 /*
1056 * ===============================================================================

Callers 2

PMpointcontentsMethod · 0.80
SV_PointContentsMethod · 0.80

Calls 5

VectorSubtractMethod · 0.95
AngleVectorsMethod · 0.95
VectorCopyMethod · 0.95
DotProductMethod · 0.95
CM_PointLeafnum_rMethod · 0.95

Tested by

no test coverage detected