fix: lines cannot be 0 length
This commit is contained in:
parent
0446f302f7
commit
9c8f160edd
1 changed files with 3 additions and 0 deletions
|
|
@ -311,6 +311,9 @@ float TerrainModifierPath::evaluate_at(Vector2 world_coordinate, float before) {
|
||||||
for (int i{ 0 }; i < count; i++) {
|
for (int i{ 0 }; i < count; i++) {
|
||||||
Vector3 const ipos{ this->points[i] };
|
Vector3 const ipos{ this->points[i] };
|
||||||
Vector3 const next_pos{ this->points[Math::wrapi(i + 1, 0, this->points.size())] };
|
Vector3 const next_pos{ this->points[Math::wrapi(i + 1, 0, this->points.size())] };
|
||||||
|
if (ipos == next_pos) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
float dot, distance, percentage;
|
float dot, distance, percentage;
|
||||||
bool const is_start{ !this->closed && i == 0 }, is_end{ !this->closed && i == count - 1 };
|
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) };
|
float height{ evaluate_line(ipos, is_start, next_pos, is_end, world_coordinate, dot, distance, percentage) };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue