#include <c4d_basetime.h>
Cinema 4D uses a sophisticated system for specifying time values.
If only frame numbers were used, changing the frame rate would cause keys either to overlap or disappear.
If only float values (seconds) were used instead, there would be problems because of the limited data precision. For instance when using 30 fps the frame 29 = 29/30 could easily be misinterpreted as frame 28.
BaseTime internally stores the time values as exact fractions independent of the frame rate. For example frame 29 is stored as fraction with nominator 29 and denominator 30.
The class always tries to keep the nominator and denominator as small as possible. Hence 15/30 is stored as 1/2, so if using 30 fps GetFrame() would return 15, but if using 24 fps it would return frame 12.
Private Member Functions | |
void | Reduce () |
Private Attributes | |
Float | numerator |
Float | denominator |
Friends | |
class | BaseFile |
class | AESFile |
Math Operators | |
const BaseTime | operator* (const BaseTime &t1, const BaseTime &t2) |
const BaseTime | operator/ (const BaseTime &t1, const BaseTime &t2) |
const BaseTime | operator+ (const BaseTime &t1, const BaseTime &t2) |
const BaseTime | operator- (const BaseTime &t1, const BaseTime &t2) |
Comparison Operators | |
Bool | operator== (const BaseTime &t1, const BaseTime &t2) |
Bool | operator< (const BaseTime &t1, const BaseTime &t2) |
Bool | operator!= (const BaseTime &t1, const BaseTime &t2) |
Bool | operator<= (const BaseTime &t1, const BaseTime &t2) |
Bool | operator>= (const BaseTime &t1, const BaseTime &t2) |
Bool | operator> (const BaseTime &t1, const BaseTime &t2) |
Constructor/Destructor | |
BaseTime () | |
BaseTime (Float r) | |
BaseTime (Float z, Float n) | |
Numerator/Denominator | |
Float | Get () const |
Float | GetNumerator () const |
Float | GetDenominator () const |
void | SetNumerator (Float r) |
void | SetDenominator (Float r) |
Frames | |
Int32 | GetFrame (Float fps) const |
void | Quantize (Float fps) |
Miscellaneous | |
Int32 | TimeDif (const BaseTime &t2) const |
maxon::HashInt | GetHashCode () const |
BaseTime | ( | ) |
Default constructor.
Initializes the internal time value from a float value in seconds.
Constructor will multiply the seconds by 1000.0 and store it as a fraction with 1000.0 as denominator; after this the fraction will be reduced to its lowest form.
[in] | r | The time in seconds. |
Initializes the internal time value to the given fraction of z/n.
[in] | z | The nominator. |
[in] | n | The denominator. |
|
private |
Float Get | ( | ) | const |
Gets the time in seconds.
Float GetNumerator | ( | ) | const |
Gets the numerator part of the internally stored time.
Float GetDenominator | ( | ) | const |
Gets the denominator part of the internally stored time.
void SetNumerator | ( | Float | r | ) |
Sets the numerator part of the internally stored time.
[in] | r | The numerator. |
void SetDenominator | ( | Float | r | ) |
Sets the denominator part of the internally stored time.
[in] | r | The denominator. |
Gets the number of frames equivalent to the time for the given number of Frames per Second.
[in] | fps | The Frames per Second to use to calculate the frame number for the time. |
void Quantize | ( | Float | fps | ) |
Quantizes the internally stored value so that it is a multiple of the given number of Frames per Second.
[in] | fps | The number of Frames per Second to make the time a multiple of. |
Check which is the largest between the time and t2.
[in] | t2 | The time to compare with. |
maxon::HashInt GetHashCode | ( | ) | const |
|
friend |
|
friend |
Multiplies t1 and t2.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Divides t1 and t2.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Adds t1 and t2.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Subtracts t1 and t2.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Equality operator. Checks if t1 and t2 are equal.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Less than operator. Checks if t1 is less than t2.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Inequality operator. Checks if t1 and t2 are not equal.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Less than or equal operator. Checks if t1 is less than or equal to t2.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Greater than or equal operator. Checks if t1 is greater than or equal to t2.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
Greater than operator. Checks if t1 is greater than t2.
[in] | t1 | Left-operand time. |
[in] | t2 | Right-operand time. |
|
private |
|
private |