Initial commit

parent 9e6f2365
cmake_minimum_required(VERSION 2.8.7)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
include(AppendCompilerFlags)
project(GraCTv2)
set(PROJECT_VENDOR "Adrián Gómez Brandón")
set(CMAKE_PROJECT_NAME "GraCT")
set(PROJECT_CONTACT "adrian.gbrandon@udc.es")
set(CMAKE_INSTALL_PREFIX /home/adrian/software)
set(CMAKE_BUILD_TYPE "Debug")
# C++11 compiler Check
if(NOT CMAKE_CXX_COMPILER_VERSION) # work around for cmake versions smaller than 2.8.10
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION)
endif()
if(CMAKE_CXX_COMPILER MATCHES ".*clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if( (CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.7) OR
(CMAKE_COMPILER_IS_CLANGXX AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.2))
message(FATAL_ERROR "Your C++ compiler does not support C++11. Please install g++ 4.7 (or greater) or clang 3.2 (or greater)")
else()
message(STATUS "Compiler is recent enough to support C++11.")
endif()
if( CMAKE_COMPILER_IS_GNUCXX )
append_cxx_compiler_flags("-std=c++11 -Wall -Wextra " "GCC" CMAKE_CXX_FLAGS)
append_cxx_compiler_flags("-msse4.2 -O3 -ffast-math -funroll-loops -fno-omit-frame-pointer -g" "GCC" CMAKE_CXX_FLAGS_RELEASE)
else()
append_cxx_compiler_flags("-std=c++11" "CLANG" CMAKE_CXX_FLAGS)
append_cxx_compiler_flags("-stdlib=libc++" "CLANG" CMAKE_CXX_FLAGS)
append_cxx_compiler_flags("-msse4.2 -O3 -ffast-math -funroll-loops -DNDEBUG" "CLANG" CMAKE_CXX_FLAGS_RELEASE)
endif()
include(CheckSSE)
FindSSE ()
if( SSE4_2_FOUND )
if( CMAKE_COMPILER_IS_GNUCXX )
append_cxx_compiler_flags("-msse4.2" "GCC" CMAKE_CXX_FLAGS)
else()
append_cxx_compiler_flags("-msse4.2" "CLANG" CMAKE_CXX_FLAGS)
endif()
message(STATUS "CPU does support SSE4.2.")
else()
message(STATUS "CPU does NOT support SSE4.2")
endif()
add_subdirectory(external/sdsl-lite)
add_subdirectory(external/repair_gn)
include_directories("${PROJECT_SOURCE_DIR}/external/googletest/include"
${CMAKE_HOME_DIRECTORY}/include
${CMAKE_BINARY_DIR}/external/sdsl-lite/include
${CMAKE_BINARY_DIR}/external/sdsl-lite/external/libdivsufsort/include/
${CMAKE_HOME_DIRECTORY}/external/googletest/include
${CMAKE_HOME_DIRECTORY}/external/sdsl-lite/external/FastPFor/headers/
${CMAKE_HOME_DIRECTORY}/external/repair_gn
${STXXL_INCLUDE_DIRS}
)
add_executable(GraCT_create_index src/create_index.cpp)
target_link_libraries(GraCT_create_index libRepairGN sdsl divsufsort divsufsort64)
add_executable(GraCT_run_queries src/run_queries.cpp)
target_link_libraries(GraCT_run_queries libRepairGN sdsl divsufsort divsufsort64)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
macro(append_c_compiler_flags _flags _name _result)
set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}")
string(TOUPPER "${cname}" cname)
foreach(flag ${_flags})
string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}")
string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}")
string(TOUPPER "${flagname}" flagname)
set(have_flag "HAVE_${cname}_${flagname}")
set(CMAKE_REQUIRED_FLAGS "${flag}")
check_c_source_compiles("int main() { return 0; }" ${have_flag})
if(${have_flag})
set(${_result} "${${_result}} ${flag}")
endif(${have_flag})
endforeach(flag)
set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
endmacro(append_c_compiler_flags)
macro(append_cxx_compiler_flags _flags _name _result)
set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}")
string(TOUPPER "${cname}" cname)
foreach(flag ${_flags})
string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}")
string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}")
string(TOUPPER "${flagname}" flagname)
set(have_flag "HAVE_${cname}_${flagname}")
set(CMAKE_REQUIRED_FLAGS "${flag}")
check_cxx_source_compiles("int main() { return 0; }" ${have_flag})
if(${have_flag})
set(${_result} "${${_result}} ${flag}")
endif(${have_flag})
endforeach(flag)
set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS})
endmacro(append_cxx_compiler_flags)
# Check if SSE instructions are available on the machine where
# the project is compiled.
MACRO (FindSSE)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)
IF (SSE2_TRUE)
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
ELSE (SSE2_TRUE)
set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
ENDIF (SSE2_TRUE)
# /proc/cpuinfo apparently omits sse3 :(
STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE)
IF (NOT SSE3_TRUE)
STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE)
ENDIF (NOT SSE3_TRUE)
STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE)
IF (SSE3_TRUE OR SSSE3_TRUE)
set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
ELSE (SSE3_TRUE OR SSSE3_TRUE)
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
ENDIF (SSE3_TRUE OR SSSE3_TRUE)
IF (SSSE3_TRUE)
set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
ELSE (SSSE3_TRUE)
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
ENDIF (SSSE3_TRUE)
STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE)
IF (SSE41_TRUE)
set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
ELSE (SSE41_TRUE)
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
ENDIF (SSE41_TRUE)
STRING(REGEX REPLACE "^.*(sse4_2).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse4_2" "${SSE_THERE}" SSE42_TRUE)
IF (SSE42_TRUE)
set(SSE4_2_FOUND true CACHE BOOL "SSE4.2 available on host")
ELSE (SSE42_TRUE)
set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host")
ENDIF (SSE42_TRUE)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE
CPUINFO)
STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE)
IF (SSE2_TRUE)
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
ELSE (SSE2_TRUE)
set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
ENDIF (SSE2_TRUE)
STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE)
IF (SSE3_TRUE)
set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
ELSE (SSE3_TRUE)
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
ENDIF (SSE3_TRUE)
STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE)
IF (SSSE3_TRUE)
set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
ELSE (SSSE3_TRUE)
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
ENDIF (SSSE3_TRUE)
STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE)
IF (SSE41_TRUE)
set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
ELSE (SSE41_TRUE)
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
ENDIF (SSE41_TRUE)
STRING(REGEX REPLACE "^.*(SSE4.2).*$" "\\1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "SSE4.2" "${SSE_THERE}" SSE42_TRUE)
IF (SSE42_TRUE)
set(SSE4_2_FOUND true CACHE BOOL "SSE4.2 available on host")
ELSE (SSE42_TRUE)
set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host")
ENDIF (SSE42_TRUE)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
# TODO
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host")
ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(CMAKE_COMPILER_IS_GNUCXX)
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
IF(GCC_VERSION VERSION_LESS 4.2)
set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host" FORCE)
set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host" FORCE)
ENDIF()
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
if(NOT SSE2_FOUND)
MESSAGE(STATUS "Could not find support for SSE2 on this machine.")
endif(NOT SSE2_FOUND)
if(NOT SSE3_FOUND)
MESSAGE(STATUS "Could not find support for SSE3 on this machine.")
endif(NOT SSE3_FOUND)
if(NOT SSSE3_FOUND)
MESSAGE(STATUS "Could not find support for SSSE3 on this machine.")
endif(NOT SSSE3_FOUND)
if(NOT SSE4_1_FOUND)
MESSAGE(STATUS "Could not find support for SSE4.1 on this machine.")
endif(NOT SSE4_1_FOUND)
if(NOT SSE4_2_FOUND)
MESSAGE(STATUS "Could not find support for SSE4.2 on this machine.")
endif(NOT SSE4_2_FOUND)
mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND SSE4_2_FOUND)
ENDMACRO(FindSSE)
//
// Created by adrian on 26/12/17.
//
#ifndef GRACTV2_ALTERNATIVE_CODER_HPP
#define GRACTV2_ALTERNATIVE_CODER_HPP
namespace gract_ct {
class alternative_coder {
public:
static uint64_t encode(int64_t v){
uint absValue =(uint) std::abs(v)*2;
if(v < 0){
return absValue-1;
}
return absValue;
}
static int64_t decode(uint64_t code){
int64_t absValue =(int64_t) std::ceil((double) code / 2);
uint64_t negative = code % 2;
if(negative){
return -absValue;
}
return absValue;
};
};
}
#endif //GRACTV2_SPIRAL_MATRIX_CODER_HPP
//
// Created by adrian on 17/04/18.
//
#ifndef GRACT3D_CLEAN_HPP
#define GRACT3D_CLEAN_HPP
#include <cmath>
#include <string>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <vector>
#include <geo_util.hpp>
#include <limits>
namespace gract_ct {
class clean {
private:
static std::vector<std::string> read_next_row(std::ifstream &i_stream){
std::string line;
std::getline(i_stream, line);
std::stringstream line_stream(line);
std::string cell;
std::vector<std::string> line_values;
while(std::getline(line_stream, cell, ','))
{
line_values.push_back(cell);
}
if (!line_stream && cell.empty())
{
// If there was a trailing comma then add an empty element.
line_values.push_back("");
}
return line_values;
}
static long to_seconds(const std::string date_string){
std::istringstream ss(date_string);
std::tm t{};
ss >> std::get_time(&t, "%Y-%m-%d %H:%M:%S");
return mktime(&t);
}
public:
static void run(const std::string input_file, const std::string output_file){
std::ifstream i_stream(input_file);
std::ofstream o_stream(output_file);
uint64_t t_s, t_e;
std::string t_start, t_end;
float lon_start, lat_start, lon_end, lat_end;
while(i_stream){
std::vector<std::string> values = read_next_row(i_stream);
if(i_stream.eof()) break; //last-line toca narices
t_start = values[1];
t_end = values[2];
for(uint64_t i = 0; i < values.size(); i++){
std::cout << "i: " << values[i] << std::endl;
}
lon_start = std::stof(values[5]);
lat_start = std::stof(values[6]);
lon_end = std::stof(values[9]);
lat_end = std::stof(values[10]);
t_s = static_cast<uint64_t >(to_seconds(t_start));
t_e = static_cast<uint64_t >(to_seconds(t_end));
o_stream << t_s << "," << t_e << "," << lon_start << ","
<< lat_start << "," << lon_end << "," << lat_end << std::endl;
}
i_stream.close();
o_stream.close();
}
};
}
#endif //GRACT3D_DATASET_GRID_HPP
This diff is collapsed.
//
// Created by adrian on 12/12/17.
//
#ifndef SUCCINCTCT_DATA_TRAJ_HPP
#define SUCCINCTCT_DATA_TRAJ_HPP
namespace gract_ct{
class data_traj {
public:
typedef uint32_t value_type;
typedef uint32_t time_type;
value_type m_id;
time_type m_t;
value_type m_x;
value_type m_y;
data_traj(value_type id, time_type t, value_type x, value_type y){
m_id = id;
m_t = t;
m_x = x;
m_y = y;
}
data_traj(){}
};
}
#endif //SUCCINCTCT_DATA_TRAJ_HPP
//
// Created by adrian on 17/04/18.
//
#ifndef GRACT3D_DATASET_GRID_HPP
#define GRACT3D_DATASET_GRID_HPP
#include <cmath>
#include <string>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <vector>
#include <geo_util.hpp>
#include <limits>
namespace gract_ct {
class dataset_grid {
private:
static std::vector<std::string> read_next_row(std::ifstream &i_stream){
std::string line;
std::getline(i_stream, line);
std::stringstream line_stream(line);
std::string cell;
std::vector<std::string> line_values;
while(std::getline(line_stream, cell, ','))
{
line_values.push_back(cell);
}
if (!line_stream && cell.empty())
{
// If there was a trailing comma then add an empty element.
line_values.push_back("");
}
return line_values;
}
static void init(std::ifstream &stream, double_t &x_o, double_t &y_o, uint64_t &t_start){
x_o = std::numeric_limits<double_t>::max();
y_o = std::numeric_limits<double_t>::max();
t_start = std::numeric_limits<uint64_t>::max();
while(stream) {
std::vector<std::string> values = read_next_row(stream);
if (stream.eof()) break; //last-line toca narices
uint64_t t = std::strtoull(values[1].c_str(), NULL, 0);
double_t x_degree = std::strtod(values[2].c_str(), NULL);
double_t y_degree = std::strtod(values[3].c_str(), NULL);
if(x_degree < x_o) x_o = x_degree;
if(y_degree < y_o) y_o = y_degree;
if(t < t_start) t_start = t;
}
stream.close();
}
static void stats(std::ifstream &stream){
uint64_t id = 0, id_prev = -1, t, t_prev;
uint64_t x, x_prev, y, y_prev;
uint64_t max_x = 0, max_y = 0;
uint64_t max_t = 0, ids = 0;
double_t max_speed = 0, n_objects = 0;
uint64_t line = 0;
while(stream){
stream >> id >> t >> x >> y;
if(stream.eof()) break;
if(id != id_prev) ++ids;
if(t > max_t) max_t = t;
if(x > max_x) max_x = x;
if(y > max_y) max_y = y;
if(line > 0 && id == id_prev){
double_t speed_x = std::abs(std::ceil((int64_t) (x-x_prev) / (double_t) (t - t_prev)));
if(max_speed < speed_x) max_speed = speed_x;
double_t speed_y = std::abs(std::ceil((int64_t) (y-y_prev) / (double_t) (t - t_prev)));
if(max_speed < speed_y) max_speed = speed_y;
}
if(line == 0 || id != id_prev) ++n_objects;
id_prev = id;
t_prev = t;
x_prev = x;
y_prev = y;
line++;
}
std::cout << "---------------------------" << std::endl;
std::cout << " stats " << std::endl;
std::cout << "---------------------------" << std::endl;
std::cout << "Maximum t: " << max_t << std::endl;
std::cout << "Maximum x: " << max_x << std::endl;
std::cout << "Maximum y: " << max_y << std::endl;
std::cout << "Maximum s: " << max_speed << std::endl;
std::cout << "Number ob: " << n_objects << std::endl;
std::cout << "---------------------------" << std::endl;
std::cout << std::endl;
}
public:
static void transform(const std::string input_file, const std::string output_file,
const uint64_t t_interval, const uint64_t meters_x, const uint64_t meters_y){
std::ifstream i_stream(input_file);
std::ofstream o_stream(output_file);
double_t x_o, y_o;
uint64_t t_start;
init(i_stream, x_o, y_o, t_start);
i_stream.open(input_file);
uint64_t t, t2=0;
double x_degree, y_degree;
bool first = true;
uint64_t t_value, x_value, y_value, z_value, interval_value = 0;
uint64_t t_p, x_p, y_p, z_p, id, id_p, line = 0;
while(i_stream){
std::vector<std::string> values = read_next_row(i_stream);
if(i_stream.eof()) break; //last-line toca narices
id = std::strtoull(values[0].c_str(), NULL, 0);
t = std::strtoull(values[1].c_str(), NULL, 0);
x_degree = std::strtod(values[2].c_str(), NULL);
y_degree = std::strtod(values[3].c_str(), NULL);
std::pair<double_t , double_t > dist = compute_distance(x_o, y_o, x_degree, y_degree);
t_value = (t-t_start)/t_interval;
if(line == 0 || id != id_p || t_value > interval_value){
interval_value = t_value;
x_value = (uint64_t) (std::ceil(dist.first/(double_t) meters_x));
y_value = (uint64_t) (std::ceil(dist.second/(double_t) meters_y));
o_stream << values[0] << " " << t_value << " " << x_value << " " << y_value << " " << std::endl;
}
id_p = id;
line++;
}
i_stream.close();
o_stream.close();
std::cout << "t2: " << t2 << std::endl;
std::cout << "tstart: " << t_start << std::endl;
std::ifstream result_stream(output_file);
stats(result_stream);
result_stream.close();
}
};
}
#endif //GRACT3D_DATASET_GRID_HPP
//
// Created by adrian on 27/04/17.
//
#ifndef GRACT_DATASET_READER_HPP
#define GRACT_DATASET_READER_HPP
#include <string>
#include <vector>
#include <fstream>
#include "data_traj.hpp"
namespace gract_ct {
class dataset_rw {
private:
std::string m_dataset;
public:
dataset_rw(std::string file){
m_dataset = file;
};
std::vector<data_traj> read(){
std::ifstream fin(m_dataset);
uint64_t t;
uint32_t id, x, y;
std::vector<data_traj> result;
while (fin) {
//File format
fin >> id >> t >> x >> y ;
if(fin.eof()) break; //last-line toca narices
//if(id < 4){
result.push_back(data_traj(id, t, x ,y));
//}
}
fin.close();
return result;
}
};
};
#endif //GRACT_DATASET_READER_HPP
//
// Created by adrian on 10/05/18.
//
#ifndef GRACT3D_GEO_UTIL_HPP
#define GRACT3D_GEO_UTIL_HPP
namespace gract_ct {
typedef long double distance_t;
static double radians(double degrees){
return degrees * M_PI / 180;
}
static distance_t haversine_formule(double x_o, double y_o, double x_p, double y_p){
int R = 6371000; // Earth’s mean radius in meter
distance_t dLat = radians(y_p - y_o);
distance_t dLong = radians(x_p - x_o);
distance_t a = std::sin(dLat / 2) * std::sin(dLat / 2) + std::cos(radians(y_o)) * std::cos(radians(y_p)) *
std::sin(dLong / 2) * std::sin(dLong / 2);
distance_t c = 2 * std::atan2(std::sqrt(a), std::sqrt(1 - a));
distance_t d = R * c; //meters
return std::ceil(d);
}
static std::pair<distance_t, distance_t> compute_distance(double x_o, double y_o, double x_p, double y_p){
distance_t x_meters = haversine_formule(x_o, y_o, x_p, y_o);
distance_t y_meters = haversine_formule(x_o, y_o, x_o, y_p);
return std::pair<distance_t , distance_t >(x_meters, y_meters);
}
}
#endif //GRACT3D_GEO_UTIL_HPP
//
// Created by adrian on 24/04/17.
//
#ifndef SUCCINCTCT_GEOMETRY_HPP
#define SUCCINCTCT_GEOMETRY_HPP
#include <sdsl/int_vector.hpp>
namespace gract_ct {
class point {
public:
typedef int64_t value_type;
value_type m_x;
value_type m_y;
point(){};
point(value_type x, value_type y){
m_x = x;
m_y = y;
}
};
class region {
public:
typedef point::value_type value_type;
typedef sdsl::int_vector<>::size_type size_type;
point m_min_p;
point m_max_p;
region(){};
region(value_type min_x, value_type min_y, value_type max_x, value_type max_y){
m_min_p = point(min_x, min_y);