Skip to content
Snippets Groups Projects
Commit 3587f986 authored by Christoph Sprunk's avatar Christoph Sprunk
Browse files

some fixes for ms visual studio by Rainer Kuemmerle

parent 071956d3
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,13 @@ set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
if(WIN32)
add_definitions(-DWINDOWS)
if(MSVC)
# SSE2 optimizations
ADD_DEFINITIONS("/arch:SSE2")
endif()
endif()
#SET(CMAKE_BUILD_TYPE Debug)
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
......
......@@ -4,7 +4,7 @@
#include "csm_all.h"
int minmax(int from, int to, int x) {
return std::max(std::min(x,to),from);
return (std::max)((std::min)(x,to),from);
}
void possible_interval(
......@@ -186,7 +186,7 @@ double dist_to_segment_d(const double a[2], const double b[2], const double x[2]
/* the projection is inside the segment */
return distance;
} else
return sqrt(std::min( distance_squared_d(a,x), distance_squared_d(b,x)));
return sqrt((std::min)( distance_squared_d(a,x), distance_squared_d(b,x)));
}
int count_equal(const int*v, int n, int value) {
......
......@@ -59,7 +59,7 @@ void kill_outliers_double(struct sm_params*params) {
if(!ld_valid_corr(laser_sens, i)) continue;
int j1 = laser_sens->corr[i].j1;
dist2_i[i] = laser_sens->corr[i].dist2_j1;
dist2_j[j1] = std::min(dist2_j[j1], dist2_i[i]);
dist2_j[j1] = (std::min)(dist2_j[j1], dist2_i[i]);
}
int nkilled = 0;
......@@ -121,7 +121,7 @@ void kill_outliers_trim(struct sm_params*params, double*total_error) {
/* two errors limits are defined: */
/* In any case, we don't want more than outliers_maxPerc% */
int order = (int)floor(k*(params->outliers_maxPerc));
order = std::max(0, std::min(order, k-1));
order = (std::max)(0, (std::min)(order, k-1));
/* The dists for the correspondence are sorted
in ascending order */
......@@ -131,10 +131,10 @@ void kill_outliers_trim(struct sm_params*params, double*total_error) {
/* Then we take a order statics (o*K) */
/* And we say that the error must be less than alpha*dist(o*K) */
int order2 = (int)floor(k*params->outliers_adaptive_order);
order2 = std::max(0, std::min(order2, k-1));
order2 = (std::max)(0, (std::min)(order2, k-1));
double error_limit2 = params->outliers_adaptive_mult*dist2[order2];
double error_limit = std::min(error_limit1, error_limit2);
double error_limit = (std::min)(error_limit1, error_limit2);
#if 0
double error_limit1_ho = hoare_selection(dist2_copy, 0, k-1, order);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment