C++ API Reference
MTimeRange Class Reference

Introduced in 2020.0 More...

#include <MTimeRange.h>

Public Member Functions

 MTimeRange ()
 Construct an empty set of time.
 
 MTimeRange (MTime, MTime) noexcept
 Construct closed-time-interval [start, end].
 
bool contains (MTime) const noexcept
 Checks if the given time point belongs to this time range.
 
bool contains (MTime, MTime) const noexcept
 Checks if the given closed-time-interval [start, end] is a subset of this time range.
 
bool intersects (MTime, MTime) const noexcept
 Check if the given closed-time-interval [start, end] is intersecting with this time range (the intersection is non-empty)
 
bool empty () const noexcept
 Checks if this time range is an empty set.
 
MClosedTimeInterval bounds () const noexcept
 Introduced in 2022.0 More...
 
 operator bool () const
 Checks if this set is an empty set.
 
MTimeRange operator| (const MTimeRange &) const
 Returns the set-union of this and rhs.
 
bool operator== (const MTimeRange &) const noexcept
 Checks if this set is exactly the same as rhs.
 

Detailed Description

Introduced in 2020.0

2020.0:
Introduced in this version.

Mathematic type that represent a set of pseudo-real-number (in the unit of time), such as [-1s, +1s] U [+2, +5s]

Allows to query if a specific time-point or time-interval is contained in this set

Warning
Unlike MTime, Maya represent the time in MTimeRange with an 64-bits signed integer (ticks) (1 tick == 1/6000 second). The time you can represent in this range is [0.167 milliseconds, 48 million-years). For times smaller than 1 tick, Maya will round it to the closest tick. For times greater than 2^62 ticks, Maya may consider them as 'infinity' and arithmetic rules may not work properly. For times greater than 2^63 ticks, result are overflowed and any use of them are undefined behavior.
Examples:
simplePhysicsEngine/simplePhysicsEngine.cpp, and simpleSimulationNode/simpleSimulationNode.cpp.

Member Function Documentation

MClosedTimeInterval bounds ( ) const
noexcept

Introduced in 2022.0

Return the tight bounding closed-time-interval of this time range E.g.

2022.0:
Introduced in this version.

bounds [-1,+3] U [+5,+7] -> [-1,+7]

Examples:
simplePhysicsEngine/simplePhysicsEngine.cpp.

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