3 ms·
I'm not entirely clear on what's going on with gs and hs - but at least gs seem to only be used with an additional multiply with distance - but I don't think th
by e12e 5y ago
I'm not entirely clear on what's going on with gs and hs - but at least gs seem to only be used with an additional multiply with distance - but I don't think that immediately allows to simplify away the sqrt by squaring both sides of the divide in the definition?
let gs =
2. * weight * (distance - ideal_distance) /
(ideal_distance_squared * distance);
let distance_cubed =
distance_squared * distance;
unsafe {
*self.g.get_unchecked_mut(
i * n + u) += distance * gs };
}
But hs seems to simplify to 0 in how it's used?:
let hs =
2. * -weight /
(ideal_distance_squared * distance_cubed);
let idk = hs
* (2. * distance_cubed
+ ideal_distance * (distance * distance - distance_squared));
Unless the intent is some kind of float precision error handling?
(distance * distance - distance_squared) =
(distance_squared - distance_squared) = 0
Or is hs and gs used for something I'm missing?(could be, I'm on mobile)