Om  1.0.0
A universal framework for multimedia simulation
Public Types | Public Member Functions | Static Public Member Functions | List of all members
om::graphics::gui::base::ValueCurve Class Reference

A class that represents the scaling curve to use when displaying a value. More...

#include <omGraphicsGUIValueCurve.h>

Public Types

enum  Enum {
  LINEAR = 0, LOGARITHMIC = 1, SQUARE = 2, SQUARE_ROOT = 3,
  CUBE = 4, CUBE_ROOT = 5
}
 An enum that specifies the different kinds of curves. More...
 

Public Member Functions

 ValueCurve ()
 Create a new value curve with the default curve - linear. More...
 
 ValueCurve (Enum newType)
 Create a new value curve using the specified value curve type enum value. More...
 
 operator Enum () const
 Convert this value curve type to an enum value. More...
 
Float evaluate (Float a, const AABB1f &range=AABB1f(0.0f, 1.0f)) const
 Apply this curve to a value with the specified linear parameter from 0 to 1 and output range. More...
 
Double evaluate (Double a, const AABB1d &range=AABB1d(0.0f, 1.0f)) const
 
Float evaluateInverse (Float value, const AABB1f &range=AABB1f(0.0f, 1.0f)) const
 Apply this curve to a value in reverse with the specified value and input range. More...
 
Double evaluateInverse (Double value, const AABB1d &range=AABB1d(0.0f, 1.0f)) const
 
String toString () const
 Return a string representation of the value curve type. More...
 
 operator String () const
 Convert this value curve type into a string representation. More...
 

Static Public Member Functions

static Float transform (Float value, const AABB1f &range, ValueCurve curve)
 Transform a 1D value in the given range by the specified value curve. More...
 
static Vector2f transform (const Vector2f &value, const AABB2f &range, ValueCurve xCurve, ValueCurve yCurve)
 Transform a 2D value in the given range by the specified value curve. More...
 
static Vector3f transform (const Vector3f &value, const AABB3f &range, ValueCurve xCurve, ValueCurve yCurve, ValueCurve zCurve)
 Transform a 3D value in the given range by the specified value curve. More...
 

Detailed Description

A class that represents the scaling curve to use when displaying a value.

This class allows the user to specify how to display slider values, graphs, etc. Certain types of data are better visualized with a log scale, for instance.

Member Enumeration Documentation

An enum that specifies the different kinds of curves.

Enumerator
LINEAR 

The values are spaced evenly in a linear fashion.

LOGARITHMIC 

The value are spaced logarithmically along the number line from the minimum to maximum value.

SQUARE 

The values are spaced using the function x^2.

SQUARE_ROOT 

The values are spaced using the function sqrt(x).

CUBE 

The values are spaced using the function x^3.

CUBE_ROOT 

The values are spaced using the function x^(1/3).

Constructor & Destructor Documentation

om::graphics::gui::base::ValueCurve::ValueCurve ( )
inline

Create a new value curve with the default curve - linear.

om::graphics::gui::base::ValueCurve::ValueCurve ( Enum  newType)
inline

Create a new value curve using the specified value curve type enum value.

Member Function Documentation

om::graphics::gui::base::ValueCurve::operator Enum ( ) const
inline

Convert this value curve type to an enum value.

Float om::graphics::gui::base::ValueCurve::evaluate ( Float  a,
const AABB1f range = AABB1f(0.0f, 1.0f) 
) const

Apply this curve to a value with the specified linear parameter from 0 to 1 and output range.

This method takes a parameter which ranges from 0 to 1, indicating the linear range of the value. It applies the transfer function of this curve to that parameter and returns the result, adjusted to lie within the specified value output range. The result indicates the actual parameter value that should be displayed at the original linear position.

Use this method to convert from a display location to the actual value at the display location.

Double om::graphics::gui::base::ValueCurve::evaluate ( Double  a,
const AABB1d range = AABB1d(0.0f, 1.0f) 
) const
Float om::graphics::gui::base::ValueCurve::evaluateInverse ( Float  value,
const AABB1f range = AABB1f(0.0f, 1.0f) 
) const

Apply this curve to a value in reverse with the specified value and input range.

This method takes a parameter which ranges from its minimum to maximum value and undoes the value curve, producing a linear parameter value that ranges from 0 to 1.

Use this method to convert from actual values to where they should be displayed.

Double om::graphics::gui::base::ValueCurve::evaluateInverse ( Double  value,
const AABB1d range = AABB1d(0.0f, 1.0f) 
) const
String om::graphics::gui::base::ValueCurve::toString ( ) const

Return a string representation of the value curve type.

om::graphics::gui::base::ValueCurve::operator String ( ) const
inline

Convert this value curve type into a string representation.

static Float om::graphics::gui::base::ValueCurve::transform ( Float  value,
const AABB1f range,
ValueCurve  curve 
)
static

Transform a 1D value in the given range by the specified value curve.

static Vector2f om::graphics::gui::base::ValueCurve::transform ( const Vector2f value,
const AABB2f range,
ValueCurve  xCurve,
ValueCurve  yCurve 
)
static

Transform a 2D value in the given range by the specified value curve.

static Vector3f om::graphics::gui::base::ValueCurve::transform ( const Vector3f value,
const AABB3f range,
ValueCurve  xCurve,
ValueCurve  yCurve,
ValueCurve  zCurve 
)
static

Transform a 3D value in the given range by the specified value curve.


The documentation for this class was generated from the following file: