Revert some instances of Math::INF back to 1e20

This commit is contained in:
retrotails 2025-06-05 08:39:18 -04:00
parent 445a51834e
commit ae06a2de48
2 changed files with 14 additions and 8 deletions

View file

@ -862,6 +862,7 @@ Vector<Vector3> Geometry3D::compute_convex_mesh_points(const Plane *p_planes, in
}
#define square(m_s) ((m_s) * (m_s))
#define BIG_VAL 1e20
/* dt of 1d function using squared distance */
static void edt(float *f, int stride, int n) {
@ -871,8 +872,8 @@ static void edt(float *f, int stride, int n) {
int k = 0;
v[0] = 0;
z[0] = -Math::INF;
z[1] = +Math::INF;
z[0] = -BIG_VAL;
z[1] = +BIG_VAL;
for (int q = 1; q <= n - 1; q++) {
float s = ((f[q * stride] + square(q)) - (f[v[k] * stride] + square(v[k]))) / (2 * q - 2 * v[k]);
while (s <= z[k]) {
@ -883,7 +884,7 @@ static void edt(float *f, int stride, int n) {
v[k] = q;
z[k] = s;
z[k + 1] = +Math::INF;
z[k + 1] = +BIG_VAL;
}
k = 0;
@ -908,7 +909,7 @@ Vector<uint32_t> Geometry3D::generate_edf(const Vector<bool> &p_voxels, const Ve
float *work_memory = memnew_arr(float, float_count);
for (uint32_t i = 0; i < float_count; i++) {
work_memory[i] = Math::INF;
work_memory[i] = BIG_VAL;
}
uint32_t y_mult = p_size.x;
@ -967,6 +968,8 @@ Vector<uint32_t> Geometry3D::generate_edf(const Vector<bool> &p_voxels, const Ve
return ret;
}
#undef BIG_VAL
Vector<int8_t> Geometry3D::generate_sdf8(const Vector<uint32_t> &p_positive, const Vector<uint32_t> &p_negative) {
ERR_FAIL_COND_V(p_positive.size() != p_negative.size(), Vector<int8_t>());
Vector<int8_t> sdf8;