fix: lines cannot be 0 length

This commit is contained in:
Sara Gerretsen 2026-03-03 21:37:05 +01:00
parent 0446f302f7
commit 9c8f160edd

View file

@ -311,6 +311,9 @@ float TerrainModifierPath::evaluate_at(Vector2 world_coordinate, float before) {
for (int i{ 0 }; i < count; i++) {
Vector3 const ipos{ this->points[i] };
Vector3 const next_pos{ this->points[Math::wrapi(i + 1, 0, this->points.size())] };
if (ipos == next_pos) {
continue;
}
float dot, distance, percentage;
bool const is_start{ !this->closed && i == 0 }, is_end{ !this->closed && i == count - 1 };
float height{ evaluate_line(ipos, is_start, next_pos, is_end, world_coordinate, dot, distance, percentage) };