-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
5,557 additions
and
1,416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,9 @@ | |
{ | ||
"name": "Barrett, Janet" | ||
}, | ||
{ | ||
"name": "Bauck, Kirsten" | ||
}, | ||
{ | ||
"name": "Bauers, Joni" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(sensorutilities VERSION 0.0.1 DESCRIPTION "SensorUtilities library") | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(default_build_type "Release") | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.") | ||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE | ||
STRING "Choose the type of build." FORCE) | ||
endif() | ||
|
||
set(SENSOR_UTILITIES_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
set(SENSOR_UTILITIES_INSTALL_INCLUDE_DIR "include/sensorutilities") | ||
set(SENSOR_UTILITIES_HEADER_FILES "${SENSOR_UTILITIES_INCLUDE_DIR}/SensorUtilities.h" | ||
"${SENSOR_UTILITIES_INCLUDE_DIR}/MathUtils.h") | ||
|
||
add_library(sensorutilities SHARED | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/MathUtils.cpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/SensorUtilities.cpp") | ||
|
||
target_include_directories(sensorutilities | ||
PUBLIC | ||
$<BUILD_INTERFACE:${SENSOR_UTILITIES_INCLUDE_DIR}> | ||
$<INSTALL_INTERFACE:include>) | ||
|
||
install(FILES ${SENSOR_UTILITIES_HEADER_FILES} DESTINATION ${SENSOR_UTILITIES_INSTALL_INCLUDE_DIR}) | ||
install(TARGETS sensorutilities | ||
EXPORT sensorutilitiesConfig | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
INCLUDES DESTINATION include) | ||
export(TARGETS sensorutilities | ||
NAMESPACE sensorutilities:: | ||
FILE "${CMAKE_CURRENT_BINARY_DIR}/sensorutilitiesConfig.cmake") | ||
install(EXPORT sensorutilitiesConfig | ||
NAMESPACE sensorutilities:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) | ||
|
||
|
||
option (SENSOR_UTILITIES_BUILD_TESTS "Build the tests for the SensorUtilities Library" ON) | ||
|
||
if(SENSOR_UTILITIES_BUILD_TESTS) | ||
|
||
enable_testing() | ||
|
||
add_executable(SensorUtilitiesTests | ||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/MathUtilsTests.cpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/SensorUtilitiesTests.cpp") | ||
|
||
target_link_libraries(SensorUtilitiesTests | ||
gmock_main | ||
sensorutilities) | ||
|
||
include(GoogleTest) | ||
gtest_discover_tests(SensorUtilitiesTests | ||
TEST_PREFIX SensorUtilities.) | ||
else() | ||
message(STATUS "Skipping Tests") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
#ifndef MathUtils_H | ||
#define MathUtils_H | ||
|
||
#include <vector> | ||
|
||
namespace SensorUtilities { | ||
|
||
/** | ||
* Structure for a 2-dimensional spherical ground point. | ||
* Latitude and longitude are in radians. | ||
* Longitude is planeto-centric, positive east, and in [-pi, pi]. | ||
*/ | ||
struct GroundPt2D { | ||
double lat; | ||
double lon; | ||
}; | ||
|
||
|
||
/** | ||
* Structure for a 3-dimensional spherical ground point. | ||
* Latitude and longitude are in radians. | ||
* Longitude is planeto-centric, positive east, and in [-pi, pi]. | ||
* Radius is in meters. | ||
*/ | ||
struct GroundPt3D { | ||
double lat; | ||
double lon; | ||
double radius; | ||
}; | ||
|
||
|
||
/** | ||
* Structure for a point in an image. | ||
* The line and sample origin is the upper-left corner at (0, 0). | ||
* The first band in the image is 0. | ||
*/ | ||
struct ImagePt { | ||
double line; | ||
double sample; | ||
int band; | ||
}; | ||
|
||
|
||
/** | ||
* Structure for a 3-dimensional rectangular point or vector. | ||
* Distances are in meters. | ||
*/ | ||
struct Vec { | ||
double x; | ||
double y; | ||
double z; | ||
|
||
/** | ||
* Construct a vector from 3 values | ||
*/ | ||
Vec(double a, double b, double c); | ||
|
||
/** | ||
* Construct a vector from an array with at least 3 values. | ||
* The data is copied into the structure. | ||
*/ | ||
Vec(const double data[3]); | ||
|
||
/** | ||
* Create a std::vector from the structure. | ||
* The data in the std:vector is a copy. | ||
*/ | ||
operator std::vector<double>() const; | ||
}; | ||
|
||
|
||
bool operator==(const GroundPt2D& lhs, const GroundPt2D& rhs); | ||
|
||
|
||
bool operator==(const GroundPt3D& lhs, const GroundPt3D& rhs); | ||
|
||
|
||
bool operator==(const ImagePt& lhs, const ImagePt& rhs); | ||
|
||
|
||
bool operator==(const Vec& lhs, const Vec& rhs); | ||
|
||
|
||
Vec operator+(const Vec& lhs, const Vec& rhs); | ||
|
||
|
||
Vec operator-(const Vec& lhs, const Vec& rhs); | ||
|
||
|
||
/** | ||
* Compute the separation angle between the vectors defined by three points. | ||
* The separation angle is the angle inscribed by the points | ||
* A, B, and C as follows: | ||
* | ||
* A | ||
* / | ||
* / | ||
* B - - - C | ||
* | ||
* @param aPt The first point | ||
* @param bPt The middle point | ||
* @param cPt The second point | ||
* | ||
* @return The separation angle in radians between 0 and pi | ||
*/ | ||
double sepAngle(Vec aPt, Vec bPt, Vec cPt); | ||
|
||
|
||
/** | ||
* Compute the separation angle between two vectors | ||
* | ||
* @param aVec The first vector | ||
* @param bVec The second vector | ||
* | ||
* @return The separation angle in radians between 0 and pi | ||
*/ | ||
double sepAngle(Vec aVec, Vec bVec); | ||
|
||
|
||
/** | ||
* Compute the magnitude of a vector | ||
*/ | ||
double magnitude(Vec vec); | ||
|
||
|
||
/** | ||
* Compute the distance between two points in 3d space | ||
*/ | ||
double distance(Vec start, Vec stop); | ||
|
||
|
||
/** | ||
* Convert spherical coordinates to rectangular coordinates | ||
* | ||
* @param spherical The spherical coordinate as geocentric latitude, longitude, radius | ||
* | ||
* @return The rectangular coordinate as x, y, z | ||
*/ | ||
Vec sphericalToRect(GroundPt3D spherical); | ||
|
||
|
||
/** | ||
* Convert rectangular coordinates to spherical coordinates. | ||
* Returns 0, 0, 0 if the input is the zero vector. | ||
* | ||
* @param rectangular The rectangular coordinate as x, y, z | ||
* | ||
* @return The spherical coordinate as geocentric latitude, longitude, radius | ||
*/ | ||
GroundPt3D rectToSpherical(Vec rectangular); | ||
|
||
} | ||
|
||
#endif | ||
|
Oops, something went wrong.