#include <MDistance.h>
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.
Public Types | |
enum | Unit { , kInches, kFeet, kYards, kMiles, kMillimeters, kCentimeters, kKilometers, kMeters } |
Available Unit Systems. More... | |
Public Member Functions | |
MDistance () | |
MDistance (double value, Unit unitSystem=kCentimeters) | |
MDistance (const MDistance &src) | |
~MDistance () | |
MDistance & | operator= (const MDistance &src) |
Unit | unit () const |
double | value () const |
MStatus | setUnit (Unit newUnit) |
MStatus | setValue (double newValue) |
double | as (Unit newUnit, MStatus *ReturnStatus=NULL) const |
double | asInches () const |
double | asFeet () const |
double | asYards () const |
double | asMiles () const |
double | asMillimeters () const |
double | asCentimeters () const |
double | asKilometers () const |
double | asMeters () const |
Static Public Member Functions | |
static Unit | uiUnit () |
static MStatus | setUIUnit (Unit newUnit) |
static Unit | internalUnit () |
static double | internalToUI (double internalValue) |
static double | uiToInternal (double uiValue) |
static MStatus | setInternalUnit (Unit internalUnit) |
This method is obsolete. |
enum MDistance::Unit |
MDistance::MDistance | ( | ) |
The default class constructor. Initialize the MDistance instance to 0 in the current internal units. (See setInternalUnit and internalUnit below).
MDistance::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 |
MDistance::MDistance | ( | const MDistance & | src | ) |
Copy constructor.
MDistance::~MDistance | ( | ) |
The class destructor.
MDistance::Unit MDistance::unit | ( | ) | const |
Return the units currently in effect for this instance.
double MDistance::value | ( | ) | const |
Return the value of the current instance in the currently set units.
MStatus MDistance::setUnit | ( | MDistance::Unit | newUnit | ) |
Set the units used by this instance.
[in] | newUnit | an element of the MDistance::Unit enum |
MStatus MDistance::setValue | ( | double | newValue | ) |
Set the value of this instance
[in] | newValue | the new value in the units currently in effect |
double MDistance::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 MDistance::asInches | ( | ) | const |
Return the current value of this instance in inches.
double MDistance::asFeet | ( | ) | const |
Return the current value of this instance in feet.
double MDistance::asYards | ( | ) | const |
Return the current value of this instance in yards.
double MDistance::asMiles | ( | ) | const |
Return the current value of this instance in miles.
double MDistance::asMillimeters | ( | ) | const |
Return the current value of this instance in millimeters.
double MDistance::asCentimeters | ( | ) | const |
Return the current value of this instance in centimeters.
double MDistance::asKilometers | ( | ) | const |
Return the current value of this instance in kilometers.
double MDistance::asMeters | ( | ) | const |
Return the current value of this instance in meters.
MDistance::Unit MDistance::uiUnit | ( | ) | [static] |
Returns the Working Units (or UI units) chosen in the settings of the prefs window.
MStatus MDistance::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 MDistance::internalUnit | ( | ) | [static] |
Returns the internal unit system.
double MDistance::internalToUI | ( | double | internalValue | ) | [static] |
Converts a value from internal units to UI units.
[in] | internalValue | a value in internal units |
double MDistance::uiToInternal | ( | double | uiValue | ) | [static] |
Converts a value from UI units to internal units.
[in] | uiValue | a value in UI units |
MStatus MDistance::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 |
Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |