C++ API Reference

Manipulate Angular Data. More...

#include <MAngle.h>

Public Types

enum  Unit {
  kInvalid, kRadians, kDegrees, kAngMinutes,
  kAngSeconds, kLast
}
 Available Unit Systems. More...
 

Public Member Functions

 MAngle ()
 Default constructor. More...
 
 MAngle (const MAngle &src)
 Copy constructor. More...
 
 MAngle (double value, Unit u=kRadians)
 Class constructor. More...
 
 ~MAngle ()
 Class destructor.
 
MAngleoperator= (const MAngle &other)
 Assignment operator. More...
 
Unit unit () const
 Current unit. More...
 
double value () const
 Current value. More...
 
MStatus setUnit (Unit newUnit)
 Set current unit. More...
 
MStatus setValue (double newValue)
 Set current value. More...
 
double as (Unit otherUnit, MStatus *ReturnStatus=NULL) const
 Unit conversion. More...
 
double asUnits (Unit otherUnit, MStatus *ReturnStatus=NULL) const
 Unit conversion. More...
 
double asRadians () const
 Convert to radians. More...
 
double asDegrees () const
 Convert to degrees. More...
 
double asAngMinutes () const
 Convert to minutes of arc. More...
 
double asAngSeconds () const
 Convert to seconds of arc. More...
 

Static Public Member Functions

static Unit uiUnit ()
 Working unit. More...
 
static MStatus setUIUnit (Unit newUnit)
 Set working unit. More...
 
static Unit internalUnit ()
 Internal unit. More...
 
static double internalToUI (double internalValue)
 Unit conversion. More...
 
static double uiToInternal (double uiValue)
 Unit conversion. More...
 
static const char * className ()
 Returns the name of this class. More...
 
static MStatus setInternalUnit (Unit internalUnit)
 This method is obsolete. More...
 

Detailed Description

Manipulate Angular Data.

Methods for setting and retreiving angular data in various unit systems

The MAngle class provides a fundamental type for the Maya API to hold and manipulate angular data. All API methods that require or return angular information do so through variables of this type.

Examples:
animExportUtil/animFileExport.cpp, animImportExport/animFileUtils.cpp, animImportExport/animFileUtils.h, atomImportExport/atomCachedPlugs.cpp, atomImportExport/atomFileUtils.cpp, atomImportExport/atomFileUtils.h, dx11Shader/dx11Shader.cpp, glslShader/GLSLShader.cpp, shellNode/shellNode.cpp, and swissArmyManip/swissArmyManip.cpp.

Member Enumeration Documentation

enum Unit

Available Unit Systems.

Enumerator
kInvalid 

Invalid value.

kRadians 

Radians.

kDegrees 

Degrees.

kAngMinutes 

Minutes of Arc.

kAngSeconds 

Seconds of Arc.

kLast 

Last enum value.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MAngle ( )

Default constructor.

Initialize the MAngle instance to 0 in the current internal units.

See also
internalUnit().
MAngle ( const MAngle src)

Copy constructor.

Parameters
[in]srcThe source MAngle object.
MAngle ( double  value,
MAngle::Unit  unitSystem = kRadians 
)

Class constructor.

Initialize the MAngle instance to the given value in the given unit system.

Parameters
[in]valueThe initial value of the instance
[in]unitSystemThe unit system for the initial value

Member Function Documentation

MAngle & operator= ( const MAngle src)

Assignment operator.

Parameters
[in]srcThe source MAngle object.
Returns
Reference to the MAngle
MAngle::Unit unit ( ) const

Current unit.

Return the units currently in effect for this instance.

Returns
An element of the MAngle::Unit enum
double value ( ) const

Current value.

Return the value of the current instance in the currently set units.

Returns
The current value of the instance
MStatus setUnit ( MAngle::Unit  newUnit)

Set current unit.

Set the unit used by this instance. This will not affect the current value of the MAngle.

Parameters
[in]newUnitAn element of the MAngle::Unit enum
Returns
Status code.
Status Codes:
  • MS::kSuccess the unit of set succesfully.
  • MS::kFailure the unit is invalid.
MStatus setValue ( double  newValue)

Set current value.

Set the value of this instance.

Parameters
[in]newValueThe new value in the units currently in effect
Returns
Always returns MS::kSuccess
double as ( MAngle::Unit  otherUnit,
MStatus ReturnStatus = NULL 
) const

Unit conversion.

Return the current value of this instance in the provided units.

Parameters
[in]otherUnitAn element of the MAngle::Unit enum specifying the desired units
[out]ReturnStatusReturn status
Returns
The current value in the given units
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
Examples:
animExportUtil/animFileExport.cpp, animImportExport/animFileUtils.cpp, and atomImportExport/atomFileUtils.cpp.
double asUnits ( MAngle::Unit  otherUnit,
MStatus ReturnStatus = NULL 
) const

Unit conversion.

Return the current value of this instance in the provided units.

Parameters
[in]otherUnitAn element of the MAngle::Unit enum specifying the desired units
[out]ReturnStatusReturn status
Returns
The current value in the given units
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed
double asRadians ( ) const

Convert to radians.

Return the current value of this instance in radians.

Returns
The current value in the radians
Examples:
dx11Shader/dx11ConeAngleToHotspotConverter.cpp, shellNode/shellNode.cpp, and swissArmyManip/swissArmyManip.cpp.
double asDegrees ( ) const

Convert to degrees.

Return the current value of this instance in degrees.

Returns
The current value in the degrees
double asAngMinutes ( ) const

Convert to minutes of arc.

Return the current value of this instance in minutes of arc.

Returns
The current value in the minutes of arc
double asAngSeconds ( ) const

Convert to seconds of arc.

Return the current value of this instance in seconds of arc.

Returns
The current value in the seconds of arc
MAngle::Unit uiUnit ( )
static

Working unit.

Returns the Working Units (or UI units) chosen in the settings of the prefs window.

Returns
An element of the MAngle::Unit enum
Examples:
AbcImport/AlembicNode.cpp, animExportUtil/animFileExport.cpp, animImportExport/animFileUtils.cpp, and atomImportExport/atomFileUtils.cpp.
MStatus setUIUnit ( MAngle::Unit  newUnit)
static

Set working unit.

Set the unit system to be used by the user in the UI. This will not change the return value of the MAngle::value() method of this instance of MAngle.

Parameters
[in]newUnitand element of the MAngle::Unit enum.
Returns
MS::kSuccess if a valid unit was provided, MS::kFailure otherwise.
MAngle::Unit internalUnit ( )
static

Internal unit.

Returns the internal unit system used by Maya. This is the unit system Maya stores angles in.

Returns
The internal unit for angles
Examples:
animImportExport/animFileUtils.cpp, and atomImportExport/atomFileUtils.cpp.
double internalToUI ( double  internalValue)
static

Unit conversion.

Converts a value from Maya's internal units to the current units used in the UI.

Parameters
[in]internalValuea value in internal units
Returns
The value in UI units
double uiToInternal ( double  uiValue)
static

Unit conversion.

Converts a value from the units Maya is currently uses in the UI to the Maya internal unit system.

Parameters
[in]uiValuea value in UI units
Returns
The value in internal units.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.
MStatus setInternalUnit ( MAngle::Unit  internalUnit)
static

This method is obsolete.

[From Maya 2019]

Deprecated:
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.
Deprecated:
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.

Sets the internal unit system which Maya uses to store angles.

Parameters
[in]internalUnitthe internal unit for angles
Returns
Status code
Status Codes:
  • MS::kSuccess a valid unit was provided
  • MS::kFailure a valid unit was not provided

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