Skip to content
Snippets Groups Projects
Commit c8245231 authored by Laurent Van Migroet's avatar Laurent Van Migroet
Browse files

Replaced : fmaxf (fminf) by std::max( std::min) for msvcv

Add #include <time.h>
parent 6620d8d0
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
// Contributed by Bastien Gorissen // Contributed by Bastien Gorissen
#include <math.h> #include <math.h>
#include <time.h>
#include <stdlib.h> #include <stdlib.h>
#include "SOrientedBoundingBox.h" #include "SOrientedBoundingBox.h"
#include "GmshMatrix.h" #include "GmshMatrix.h"
...@@ -161,21 +162,23 @@ SOrientedBoundingBox::~SOrientedBoundingBox() { } ...@@ -161,21 +162,23 @@ SOrientedBoundingBox::~SOrientedBoundingBox() { }
double SOrientedBoundingBox::getMaxSize() { double SOrientedBoundingBox::getMaxSize() {
return (fmaxf(this->size[0], fmaxf(this->size[1], this->size[2]))); return (std::max(this->size[0], std::max(this->size[1], this->size[2])));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
SVector3 SOrientedBoundingBox::getAxis(int axis) { SVector3 SOrientedBoundingBox::getAxis(int axis) {
SVector3 ret;
switch (axis) { switch (axis) {
case 0: case 0:
return (this->axisX); ret=this->axisX;
case 1: case 1:
return (this->axisY); ret=this->axisY;
case 2: case 2:
return (this->axisZ); ret=this->axisZ;
} }
return ret;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -289,8 +292,8 @@ SOrientedBoundingBox* SOrientedBoundingBox::buildOBB(vector<SPoint3> vertices) { ...@@ -289,8 +292,8 @@ SOrientedBoundingBox* SOrientedBoundingBox::buildOBB(vector<SPoint3> vertices) {
mins(i) = DBL_MAX; mins(i) = DBL_MAX;
maxs(i) = -DBL_MAX; maxs(i) = -DBL_MAX;
for (int j = 0; j < num_vertices; j++) { for (int j = 0; j < num_vertices; j++) {
maxs(i) = fmaxf(maxs(i),projected(i,j)); maxs(i) =std::max(maxs(i),projected(i,j));
mins(i) = fminf(mins(i),projected(i,j)); mins(i) = std::min(mins(i),projected(i,j));
} }
} }
...@@ -466,8 +469,8 @@ SOrientedBoundingBox* SOrientedBoundingBox::buildOBB(vector<SPoint3> vertices) { ...@@ -466,8 +469,8 @@ SOrientedBoundingBox* SOrientedBoundingBox::buildOBB(vector<SPoint3> vertices) {
double min_pca = DBL_MAX; double min_pca = DBL_MAX;
double max_pca = -DBL_MAX; double max_pca = -DBL_MAX;
for (int i = 0; i < num_vertices; i++) { for (int i = 0; i < num_vertices; i++) {
min_pca = fminf(min_pca,projected(smallest_comp,i)); min_pca = std::min(min_pca,projected(smallest_comp,i));
max_pca = fmaxf(max_pca,projected(smallest_comp,i)); max_pca = std::max(max_pca,projected(smallest_comp,i));
} }
double center_pca = (max_pca+min_pca)/2.0; double center_pca = (max_pca+min_pca)/2.0;
double size_pca = (max_pca-min_pca); double size_pca = (max_pca-min_pca);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment