Remove comments from ray files
All checks were successful
CI / build-and-analyze (push) Successful in 38s

This commit is contained in:
2026-07-04 09:16:23 +03:00
parent 3dd61dbbf2
commit ba1ef9a88e
2 changed files with 0 additions and 25 deletions

15
Ray3f.c
View File

@@ -10,15 +10,12 @@ int CgeRay3fIntersectPlane(const float start[3], const float direction[3],
float tmp1[3];
float denom, time;
/* Calculate intersection time */
denom = CgeVec3fDot(direction, plane);
time = (plane[3] - CgeVec3fDot(plane, start)) / denom;
/* Check for ray/plane parallel to each other or point is behing the ray. */
if (fabsf(denom) < EPSILON || time < 0.0f)
return 0;
/* Compute intersection point */
CgeVec3fScale(direction, time, tmp1);
CgeVec3fAdd(start, tmp1, out);
*t = time;
@@ -32,15 +29,12 @@ int CgeRay3fIntersectTriangle(const float start[3], const float direction[3],
float tmp1[3], tmp2[3], tmp3[3];
float time;
/* Compute plane */
if (!CgePlaneFromPoints(a, b, c, plane))
return 0;
/* Compute intersection point in ray against plane */
if (!CgeRay3fIntersectPlane(start, direction, plane, &time, tmp3))
return 0;
/* Check if point inside rectangle */
CgeVec3fSub(b, a, tmp1);
CgeVec3fSub(tmp3, a, tmp2);
CgeVec3fCross(tmp2, tmp1, tmp1);
@@ -59,7 +53,6 @@ int CgeRay3fIntersectTriangle(const float start[3], const float direction[3],
if (CgeVec3fDot(tmp1, plane) < 0.0f)
return 0;
/* Copy intersection point */
memcpy(out, tmp3, sizeof(tmp3));
*t = time;
return 1;
@@ -70,16 +63,13 @@ int CgeSegment3fIntersectPlane(const float start[3], const float end[3],
float tmp[3];
float denom, time;
/* Calculate intersection time */
CgeVec3fSub(end, start, tmp);
denom = CgeVec3fDot(tmp, plane);
time = (plane[3] - CgeVec3fDot(plane, start)) / denom;
/* Check for ray/plane parallel to each other or point is behing the ray. */
if (fabsf(denom) < EPSILON || time < 0.0f || time > 1.0f)
return 0;
/* Compute intersection point */
CgeVec3fScale(tmp, time, tmp);
CgeVec3fAdd(start, tmp, out);
*t = time;
@@ -93,15 +83,12 @@ int CgeSegment3fIntersectTriangle(const float start[3], const float end[3],
float tmp1[3], tmp2[3], tmp3[3];
float time;
/* Compute plane */
if (!CgePlaneFromPoints(a, b, c, plane))
return 0;
/* Compute intersection point in ray against plane */
if (!CgeSegment3fIntersectPlane(start, end, plane, &time, tmp3))
return 0;
/* Check if point inside rectangle */
CgeVec3fSub(b, a, tmp1);
CgeVec3fSub(tmp3, a, tmp2);
CgeVec3fCross(tmp2, tmp1, tmp1);
@@ -120,7 +107,6 @@ int CgeSegment3fIntersectTriangle(const float start[3], const float end[3],
if (CgeVec3fDot(tmp1, plane) < 0.0f)
return 0;
/* Copy intersection point */
memcpy(out, tmp3, sizeof(tmp3));
*t = time;
return 1;
@@ -135,7 +121,6 @@ int CgeRay3fIntersectBox3f(const float aStart[3], const float aDirection[3],
timeNear = -1.0f / 0.0f;
timeFar = 1.0f / 0.0f;
/* Check each axis for the minimal and maximum intersection time */
for (i = 0; i < 3; i++) {
if (fabsf(aDirection[i]) < EPSILON) {
if (aStart[i] < bMin[i] || aStart[i] > bMax[i])