struct mrpt::opengl::CAngularObservationMesh::TDoubleRange

Range specification type, with several uses.

#include <mrpt/opengl/CAngularObservationMesh.h>

struct TDoubleRange
{
    // unions

    union rd;

    // construction

    TDoubleRange(double a, double b, double c);
    TDoubleRange(double a, double b, size_t c);
    TDoubleRange(double a, size_t b, bool c);

    //
methods

    double aperture() const;
    double initialValue() const;
    double finalValue() const;
    double increment() const;
    size_t amount() const;
    void values(std::vector<double>& vals) const;
    bool negToPos() const;
    static TDoubleRange CreateFromIncrement(double initial, double final, double increment);
    static TDoubleRange CreateFromAmount(double initial, double final, size_t amount);
    static TDoubleRange CreateFromAperture(double aperture, size_t amount, bool negToPos = true);
};

Construction

TDoubleRange(double a, double b, double c)

Constructor from initial value, final value and range.

TDoubleRange(double a, double b, size_t c)

Constructor from initial value, final value and amount of samples.

TDoubleRange(double a, size_t b, bool c)

Constructor from aperture, amount of samples and scan direction.

Methods

double aperture() const

Returns the total aperture of the range.

Parameters:

std::logic_error

on invalid range type.

double initialValue() const

Returns the first value of the range.

Parameters:

std::logic_error

on invalid range type.

double finalValue() const

Returns the last value of the range.

Parameters:

std::logic_error

on invalid range type.

double increment() const

Returns the increment between two consecutive values of the range.

Parameters:

std::logic_error

on invalid range type.

size_t amount() const

Returns the total amount of values in this range.

Parameters:

std::logic_error

on invalid range type.

void values(std::vector<double>& vals) const

Gets a vector with every value in the range.

Parameters:

std::logic_error

on invalid range type.

bool negToPos() const

Returns the direction of the scan.

True if the increment is positive, false otherwise.

Parameters:

std::logic_error

on invalid range type.

static TDoubleRange CreateFromIncrement(
    double initial,
    double final,
    double increment
    )

Creates a range of values from the initial value, the final value and the increment.

Parameters:

std::logic_error

if the increment is zero.

static TDoubleRange CreateFromAmount(
    double initial,
    double final,
    size_t amount
    )

Creates a range of values from the initial value, the final value and a desired amount of samples.

static TDoubleRange CreateFromAperture(
    double aperture,
    size_t amount,
    bool negToPos = true
    )

Creates a zero-centered range of values from an aperture, an amount of samples and a direction.