Manipulate Linear Data.
The MDistance class provides a fundamental type for the Maya API to hold and manipulate linear data. All API methods that require or return distance information do so through variables of this type.
#include <MDistance.h>
Public Types |
|
enum | Unit
{ , kInches, kFeet, kYards, kMiles, kMillimeters, kCentimeters, kKilometers, kMeters } |
Available Unit Systems. More... |
|
Public Member Functions |
|
MDistance () | |
The default class constructor. |
|
MDistance (double value, Unit unitSystem=kCentimeters) | |
Class constructor. |
|
MDistance (const MDistance &src) | |
Copy constructor. |
|
~MDistance () | |
The class destructor. |
|
MDistance & | operator= (const MDistance &src) |
The assignment operator. |
|
Unit | unit () const |
Return the units currently in effect for
this instance. |
|
double | value () const |
Return the value of the current instance in
the currently set units. |
|
MStatus | setUnit (Unit newUnit) |
Set the units used by this instance.
|
|
MStatus | setValue (double newValue) |
Set the value of this instance. |
|
double | as (Unit newUnit, MStatus *ReturnStatus=NULL) const |
Return the current value of this instance in
the provided units. |
|
double | asUnits (Unit newUnit, MStatus *ReturnStatus=NULL) const |
Return the current value of this instance in
the provided units. |
|
double | asInches () const |
Return the current value of this instance in
inches. |
|
double | asFeet () const |
Return the current value of this instance in
feet. |
|
double | asYards () const |
Return the current value of this instance in
yards. |
|
double | asMiles () const |
Return the current value of this instance in
miles. |
|
double | asMillimeters () const |
Return the current value of this instance in
millimeters. |
|
double | asCentimeters () const |
Return the current value of this instance in
centimeters. |
|
double | asKilometers () const |
Return the current value of this instance in
kilometers. |
|
double | asMeters () const |
Return the current value of this instance in
meters. |
|
Static Public Member Functions |
|
static Unit | uiUnit () |
Returns the Working Units (or UI units)
chosen in the settings of the prefs window. |
|
static MStatus | setUIUnit (Unit newUnit) |
Set the unit system to be used by the user
in the UI. |
|
static Unit | internalUnit () |
Returns the internal unit system. |
|
static double | internalToUI (double internalValue) |
Converts a value from internal units to UI
units. |
|
static double | uiToInternal (double uiValue) |
Converts a value from UI units to internal
units. |
|
static const char * | className () |
Returns the name of this class. |
|
static MStatus | setInternalUnit (Unit internalUnit) |
This method is obsolete. |
enum Unit |
Available Unit Systems.
MDistance | ( | ) |
The default class constructor.
Initialize the MDistance instance to 0 in the current internal units. (See setInternalUnit and internalUnit below).
MDistance | ( | double | newValue, |
MDistance::Unit | newUnit =
kCentimeters |
||
) |
Class constructor.
Initialize the MDistance instance to the given value in the given unit system
[in] | newValue | the initial value of the instance |
[in] | newUnit | the unit system for the initial value |
Copy constructor.
[in] | src | Existing MDistance object from which to initialize the new one. |
MDistance::Unit unit | ( | ) | const |
Return the units currently in effect for this instance.
double value | ( | ) | const |
Return the value of the current instance in the currently set units.
MStatus setUnit | ( | MDistance::Unit | newUnit | ) |
Set the units used by this instance.
[in] | newUnit | an element of the MDistance::Unit enum |
MStatus setValue | ( | double | newValue | ) |
Set the value of this instance.
[in] | newValue | the new value in the units currently in effect |
double as | ( | MDistance::Unit | otherUnit, |
MStatus * | ReturnStatus =
NULL |
||
) | const |
Return the current value of this instance in the provided units.
[in] | otherUnit | an element of the MDistance::Unit enum specifying the desired units |
[out] | ReturnStatus | return status |
double asUnits | ( | MDistance::Unit | otherUnit, |
MStatus * | ReturnStatus =
NULL |
||
) | const |
Return the current value of this instance in the provided units.
[in] | otherUnit | an element of the MDistance::Unit enum specifying the desired units |
[out] | ReturnStatus | return status |
double asInches | ( | ) | const |
Return the current value of this instance in inches.
double asFeet | ( | ) | const |
Return the current value of this instance in feet.
double asYards | ( | ) | const |
Return the current value of this instance in yards.
double asMiles | ( | ) | const |
Return the current value of this instance in miles.
double asMillimeters | ( | ) | const |
Return the current value of this instance in millimeters.
double asCentimeters | ( | ) | const |
Return the current value of this instance in centimeters.
double asKilometers | ( | ) | const |
Return the current value of this instance in kilometers.
double asMeters | ( | ) | const |
Return the current value of this instance in meters.
MDistance::Unit uiUnit | ( | ) | [static] |
Returns the Working Units (or UI units) chosen in the settings of the prefs window.
MStatus setUIUnit | ( | MDistance::Unit | newUnit | ) | [static] |
Set the unit system to be used by the user in the UI.
[in] | newUnit | and element of the MDistance::Unit enum. |
MDistance::Unit internalUnit | ( | ) | [static] |
Returns the internal unit system.
double internalToUI | ( | double | internalValue | ) | [static] |
Converts a value from internal units to UI units.
[in] | internalValue | a value in internal units |
double uiToInternal | ( | double | uiValue | ) | [static] |
Converts a value from UI units to internal units.
[in] | uiValue | a value in UI units |
const char * className | ( | ) | [static] |
MStatus setInternalUnit | ( | MDistance::Unit | internalUnit | ) | [static] |
This method is obsolete.
Changing the internal units is generally not a good idea and using the method may often produce unexpected results. It is recommended to just read the values and convert them to the units desired.
Set the internal unit system.
[in] | internalUnit | the internal unit to be used by distance |