class ThreeDViewer.Utils.DoubleExtension

Overview

Class that contains all the extensions for the double class. More…

class DoubleExtension
{
public:
    // methods

    static bool AlmostEqualsWithAbsTolerance(
        this double a,
        double b,
        double maxAbsoluteError
        );

    static double Map(this double s, double a1, double a2, double b1, double b2);
};

Detailed Documentation

Class that contains all the extensions for the double class.

Methods

static bool AlmostEqualsWithAbsTolerance(
    this double a,
    double b,
    double maxAbsoluteError
    )

Comparator within an absolute tolerance.

Parameters:

a

The double to compare to.

b

The double to compare with.

maxAbsoluteError

The tolerance for the comparison compared against the difference of the two doubles.

Returns:

True if the doubles are equal within a tolerance.

static double Map(this double s, double a1, double a2, double b1, double b2)

Linearly maps the value s that’s in the range [a1, a2] to the range [b1, b2].

Parameters:

s

The value to map.

a1

The first limit of the range that s belongs to.

a2

The second limit of the range that s belongs to.

b1

The first limit of the ouput range.

b2

The second limit of the ouput range.

Returns:

The mapped value in the [b1, b2] range.