Skip to content

Commit e1b12eb

Browse files
committed
Correctly handle the nan init values when figuring out the bounding box extents
1 parent ef8ee8e commit e1b12eb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/mesh/triangulation.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ void triangulation::from_json(pt::ptree &mesh)
245245
_max_z = std::max(_max_z,vertex[2]);
246246
_min_z = std::min(_min_z,vertex[2]);
247247

248-
_bounding_box.x_max = std::max(_bounding_box.x_max, vertex[0]);
249-
_bounding_box.x_min = std::min(_bounding_box.x_min, vertex[0]);
248+
_bounding_box.x_max = std::fmax(_bounding_box.x_max, vertex[0]);
249+
_bounding_box.x_min = std::fmin(_bounding_box.x_min, vertex[0]);
250250

251-
_bounding_box.y_max = std::max(_bounding_box.y_max, vertex[1]);
252-
_bounding_box.y_min = std::min(_bounding_box.y_min, vertex[1]);
251+
_bounding_box.y_max = std::fmax(_bounding_box.y_max, vertex[1]);
252+
_bounding_box.y_min = std::fmin(_bounding_box.y_min, vertex[1]);
253253

254254

255255
Vertex_handle Vh = this->create_vertex();
@@ -879,11 +879,11 @@ void triangulation::load_mesh_from_h5(const std::string& mesh_filename)
879879
_max_z = std::max(_max_z, vertex[i][2]);
880880
_min_z = std::min(_min_z, vertex[i][2]);
881881

882-
_bounding_box.x_max = std::max(_bounding_box.x_max, vertex[i][0]);
883-
_bounding_box.x_min = std::min(_bounding_box.x_min, vertex[i][0]);
882+
_bounding_box.x_max = std::fmax(_bounding_box.x_max, vertex[i][0]);
883+
_bounding_box.x_min = std::fmin(_bounding_box.x_min, vertex[i][0]);
884884

885-
_bounding_box.y_max = std::max(_bounding_box.y_max, vertex[i][1]);
886-
_bounding_box.y_min = std::min(_bounding_box.y_min, vertex[i][1]);
885+
_bounding_box.y_max = std::fmax(_bounding_box.y_max, vertex[i][1]);
886+
_bounding_box.y_min = std::fmin(_bounding_box.y_min, vertex[i][1]);
887887

888888
Vertex_handle Vh = this->create_vertex();
889889
Vh->set_point(pt);

0 commit comments

Comments
 (0)