Angles

Introduction

Simplifies the calls to angle-related functions such as angle wrapping, degree-radian conversions, rotation matrix representations.

Compiling & Linking

Include the following at the top of any translation unit that uses geometry functions or classes.

You will also need to link to -lecl_geometry.

Usage

Functions

For those who prefer to use function based libraries, the ecl::wrap_angle function can be used to operate on simple float types.

double angle = wrap_angle(3.33);

For conversions:

double rads = radians_to_degrees(1.44);
double degrees = degrees_to_radians(rads);

Classes

The angle class is a convenience class that automates storage and angle wrapping for you. It uses by default, radians (which any good engineer/mathematician should default to!). Take this into consideration if using it where speed is of the essence. That is, don't use Angle and then do all your calculations in degrees - there will be alot of copying!

Angle<double> a(3.33); // automatically wraps on -pi:pi
double degrees = a.degrees();
Angle<double> b = a + 3.24; // again, will automatically wrap the answer.
Angle<double>::RotationMatrix matrix = a.rotationMatrix(); // currently using a 2d eigen matrix.

Unit Tests

    - src/test/angles.cpp
angle.hpp
C++ interface for angles (degrees/radians).
ecl::radians_to_degrees
ecl_geometry_PUBLIC T radians_to_degrees(const T &radians, typename enable_if< ecl::is_float< T > >::type *dummy=0)
Converts radians to degrees and returns the result.
Definition: angle.hpp:47
ecl::degrees_to_radians
ecl_geometry_PUBLIC T degrees_to_radians(const T &degrees, typename enable_if< ecl::is_float< T > >::type *dummy=0)
Converts degrees to radians and returns the result.
Definition: angle.hpp:60
ecl::wrap_angle
const ecl_geometry_PUBLIC float & wrap_angle(float &angle)
Wrap the angle on -pi,pi (float types).
Definition: angle.cpp:33
ecl::Angle
Parent template definition for angles.
Definition: angle.hpp:119


ecl_geometry
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:39