Correct real_math.h limit3d and midpoint3d inline bodies

Header prerequisite with +2 strict exact functions / 112 padded bytes.
- limit3d now follows January's aim_assist.obj COMDAT: scale by
  length*reciprocal_square_root(dot) inside the dot > length*length branch and
  return FALSE at the end. aim_assist's inline copies _limit3d (96) and
  _reciprocal_square_root (16), which January emits out of line in that object,
  become strict exact.
- midpoint3d returns its result pointer as its signature (and January's
  mangled atlas record, returning real_point3d *) require; previously the
  function fell off the end without a value.

Blast radius: real_math.h has 185 includers. Full build passes; the stable
diff against the H1 commit shows exactly the two gains and 0 regressions;
parks 465 active, 0 stale. A bisection of the proposed packet showed that
adding a pin_normal_to_cone3d prototype to this header alone regresses three
unrelated exact functions (decals, rasterizer_xbox_draw_primitives,
error_geometry) and drifts four parks through declaration count, so that
prototype is not included.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Jonas VolmanandClaude Opus 5 committed 2026-09-13 14:25:01 -07:00
1 parent 858bedd049
commit c86aa48bd0
1 file changed
+7 -4
+7 -4
View File
@@ -1165,11 +1165,13 @@ __inline boolean limit3d(
real length)
{
real dot = vector->i*vector->i + vector->j*vector->j + vector->k*vector->k;
if (dot <= length*length)
return FALSE;
if (dot > length*length)
{
scale_vector3d(vector, length*reciprocal_square_root(dot), vector);
return TRUE;
}
scale_vector3d(vector, length / square_root(dot), vector);
return TRUE;
return FALSE;
}
__inline real distance_squared3d(
@@ -1196,6 +1198,7 @@ __inline real_point3d *midpoint3d(
result->x = (p0->x + p1->x) * 0.5f;
result->y = (p0->y + p1->y) * 0.5f;
result->z = (p0->z + p1->z) * 0.5f;
return result;
}
#ifdef REAL_MATH_EXTERNAL_DOT_PRODUCT3D