r3unitcv

r3unitcv

Class

real/code/r3unitcv.h

Library

r3code

Description:

UnitConversion class

See Also

oops/r3model.h

Super Class

r3Model

R3CLID_MODEL

JavaScript

r3Unitconversion

Class Identifier

R3CLID_UNITCONVERSION - 93

Methods

STRINGTOVECTOR, STRINGTOFLOAT, VECTORTOSTRING, FLOATTOSTRING, FRAMESTOREALTIME, REALTIMETOFRAMES, SECONDSTOREALTIM, REALTIMETOSECOND, FRAMESTOSECONDS, SECONDSTOFRAMES, FLOATTOSTRINGFIX, STRINGTOFLOATFIX, RADIANSTODEGREES, DEGREESTORADIANS, RGBCOLORTOSTRING, RGBACOLORTOSTRIN, INTTOSTRINGFIXED, STRINGTOINTFIXED, INTTOSTRING, STRINGTOINT, CURRENTTOABSSPAC, ABSTOCURRENTSPAC,

Attributes

DistanceUnit, AngleUnit, VectorUnit, CommandLanguage, Decimals, TimeUnit, FirstFrameIndex, SeparateVectorFi, Space, AreaUnit, VolumeUnit,

Registration

int R3RegisterUnitConversionClass(R3APP *app);

R3UNITCONVM_STRINGTOVECTOR

Method

STRINGTOVECTOR

Identifier

R3UNITCONVM_STRINGTOVECTOR

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

char*, string to be converted

Param 3:

R3VECTOR, result

JavaScript

obj.STRINGTOVECTOR(p1, p2, p3);

Description

Convert string to a vector

R3UNITCONVM_STRINGTOFLOAT

Method

STRINGTOFLOAT

Identifier

R3UNITCONVM_STRINGTOFLOAT

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

char*, string to be converted

Param 3:

R3FLOAT, result

JavaScript

obj.STRINGTOFLOAT(p1, p2, p3);

Description

Convert string to a float

R3UNITCONVM_VECTORTOSTRING

Method

VECTORTOSTRING

Identifier

R3UNITCONVM_VECTORTOSTRING

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

R3VECTOR, vector to be converted

Param 3:

char*, string buffer for the resul

JavaScript

obj.VECTORTOSTRING(p1, p2, p3);

Description

Convert vector to string

R3UNITCONVM_FLOATTOSTRING

Method

FLOATTOSTRING

Identifier

R3UNITCONVM_FLOATTOSTRING

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

R3FLOAT, vector to be converted

Param 3:

char*, string buffer for the resul

JavaScript

obj.FLOATTOSTRING(p1, p2, p3);

Description

Convert float to string

R3UNITCONVM_FRAMESTOREALTIME

Method

FRAMESTOREALTIME

Identifier

R3UNITCONVM_FRAMESTOREALTIME

Param 1:

R3INT, frame

JavaScript

obj.FRAMESTOREALTIME(p1, 0);

Description

Convert frames to real time.

R3UNITCONVM_REALTIMETOFRAMES

Method

REALTIMETOFRAMES

Identifier

R3UNITCONVM_REALTIMETOFRAMES

Param 3:

R3INT*, frames

JavaScript

obj.REALTIMETOFRAMES(p3);

Description

Convert real time to frames

R3UNITCONVM_SECONDSTOREALTIM

Method

SECONDSTOREALTIM

Identifier

R3UNITCONVM_SECONDSTOREALTIM

Param 1:

R3FLOAT, seconds

JavaScript

obj.SECONDSTOREALTIM(p1, 0);

Description

Convert seconds to real time

R3UNITCONVM_REALTIMETOSECOND

Method

REALTIMETOSECOND

Identifier

R3UNITCONVM_REALTIMETOSECOND

Param 3:

R3FLOAT, seconds

JavaScript

obj.REALTIMETOSECOND(p3);

Description

Convert real time to seconds

R3UNITCONVM_FRAMESTOSECONDS

Method

FRAMESTOSECONDS

Identifier

R3UNITCONVM_FRAMESTOSECONDS

Param 1:

R3INT, frames

Param 3:

R3FLOAT, seconds

JavaScript

obj.FRAMESTOSECONDS(p1, p3);

Description

Convert frames to seconds (seconds = frames / frames_per_second).

R3UNITCONVM_SECONDSTOFRAMES

Method

SECONDSTOFRAMES

Identifier

R3UNITCONVM_SECONDSTOFRAMES

Param 1:

R3FLOAT, seconds

Param 3:

R3INT*, frames

JavaScript

obj.SECONDSTOFRAMES(p1, p3);

Description

Convert seconds to frames

R3UNITCONVM_FLOATTOSTRINGFIX

Method

FLOATTOSTRINGFIX

Identifier

R3UNITCONVM_FLOATTOSTRINGFIX

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

R3FLOAT, float to be converted

Param 3:

R3TAG*, R3UNITCONVA_Unit, R3UNITCONVA_String

JavaScript

obj.FLOATTOSTRINGFIX(p1, p2, p3);

Description

Convert float to string with given unit

R3UNITCONVM_STRINGTOFLOATFIX

Method

STRINGTOFLOATFIX

Identifier

R3UNITCONVM_STRINGTOFLOATFIX

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

char*, string to be converted

Param 3:

R3TAG*, R3UNITCONVA_Unit, R3UNITCONVA_Float

JavaScript

obj.STRINGTOFLOATFIX(p1, p2, p3);

Description

Convert string to float with the given unit

R3UNITCONVM_RADIANSTODEGREES

Method

RADIANSTODEGREES

Identifier

R3UNITCONVM_RADIANSTODEGREES

Param 1:

R3FLOAT, radians

Param 3:

R3FLOAT, degrees

JavaScript

obj.RADIANSTODEGREES(p1, p3);

Description

Convert radians to degrees

R3UNITCONVM_DEGREESTORADIANS

Method

DEGREESTORADIANS

Identifier

R3UNITCONVM_DEGREESTORADIANS

Param 1:

R3FLOAT, degrees

Param 3:

R3FLOAT, radians

JavaScript

obj.DEGREESTORADIANS(p1, p3);

Description

Convert degrees to radians

R3UNITCONVM_RGBCOLORTOSTRING

Method

RGBCOLORTOSTRING

Identifier

R3UNITCONVM_RGBCOLORTOSTRING

Param 1:

R3INT, must be 0

Param 2:

R3FLOATCOLOR3, rgb color to be converted

Param 3:

char*, buffer for the result

JavaScript

obj.RGBCOLORTOSTRING(p1, p2, p3);

Description

Convert rgb color to string

R3UNITCONVM_RGBACOLORTOSTRIN

Method

RGBACOLORTOSTRIN

Identifier

R3UNITCONVM_RGBACOLORTOSTRIN

Param 1:

R3INT, must be 0

Param 2:

R3FLOATCOLOR, rgba color to be converted

Param 3:

char*, buffer for the result

JavaScript

obj.RGBACOLORTOSTRIN(p1, p2, p3);

Description

Convert rgba color to string

R3UNITCONVM_INTTOSTRINGFIXED

Method

INTTOSTRINGFIXED

Identifier

R3UNITCONVM_INTTOSTRINGFIXED

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

R3INT, vector to be converted

Param 3:

R3TAG*, R3UNITCONVA_Unit, R3UNITCONVA_String

JavaScript

obj.INTTOSTRINGFIXED(p1, p2, p3);

Description

Convert integer to string with given unit

R3UNITCONVM_STRINGTOINTFIXED

Method

STRINGTOINTFIXED

Identifier

R3UNITCONVM_STRINGTOINTFIXED

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

char*, string to be converted

Param 3:

R3TAG*, R3UNITCONVA_Unit, R3UNITCONVA_Int

JavaScript

obj.STRINGTOINTFIXED(p1, p2, p3);

Description

Convert string to integer with the given unit

R3UNITCONVM_INTTOSTRING

Method

INTTOSTRING

Identifier

R3UNITCONVM_INTTOSTRING

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

R3INT, integer to be converted

Param 3:

char*, string buffer for the resul

JavaScript

obj.INTTOSTRING(p1, p2, p3);

Description

Convert int to string

R3UNITCONVM_STRINGTOINT

Method

STRINGTOINT

Identifier

R3UNITCONVM_STRINGTOINT

Param 1:

R3INT, unit type, see R3UNIU_ codes

Param 2:

char*, string to be converted

Param 3:

R3INT*, result

JavaScript

obj.STRINGTOINT(p1, p2, p3);

Description

Convert string to a int

R3UNITCONVM_CURRENTTOABSSPAC

Method

CURRENTTOABSSPAC

Identifier

R3UNITCONVM_CURRENTTOABSSPAC

Param 3:

R3VECTOR, value to be mapped

JavaScript

obj.CURRENTTOABSSPAC(p3);

Description

map current space orientation to absolute space

R3UNITCONVM_ABSTOCURRENTSPAC

Method

ABSTOCURRENTSPAC

Identifier

R3UNITCONVM_ABSTOCURRENTSPAC

Param 3:

R3VECTOR, value to be mapped

JavaScript

obj.ABSTOCURRENTSPAC(p3);

Description

map absolute space to current space orientation

DistanceUnit

Attribute

DistanceUnit

Identifier

R3UNITCONVA_DistanceUnit

JavaScript type

Integer

C type

R3INT

Description

see distance units

Syntax


jsobj.SetDistanceUnit(value);
value = jsobj.GetDistanceUnit();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_DistanceUnit, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_DistanceUnit, &value, R3TAG_END);

AngleUnit

Attribute

AngleUnit

Identifier

R3UNITCONVA_AngleUnit

JavaScript type

Integer

C type

R3INT

Description

see angle units below

Syntax


jsobj.SetAngleUnit(value);
value = jsobj.GetAngleUnit();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_AngleUnit, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_AngleUnit, &value, R3TAG_END);

VectorUnit

Attribute

VectorUnit

Identifier

R3UNITCONVA_VectorUnit

JavaScript type

Integer

C type

R3INT

Description

see vector units below

Syntax


jsobj.SetVectorUnit(value);
value = jsobj.GetVectorUnit();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_VectorUnit, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_VectorUnit, &value, R3TAG_END);

CommandLanguage

Attribute

CommandLanguage

Identifier

R3UNITCONVA_CommandLanguage

JavaScript type

Integer

C type

int

Description

for expression evaluation

Syntax


jsobj.SetCommandLanguage(value);
value = jsobj.GetCommandLanguage();


int value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_CommandLanguage, value, R3TAG_END);
int value;
R3GetAttrs(r3obj, R3UNITCONVA_CommandLanguage, &value, R3TAG_END);

Decimals

Attribute

Decimals

Identifier

R3UNITCONVA_Decimals

JavaScript type

Integer

C type

R3INT

Description

number of decimals for floats

Syntax


jsobj.SetDecimals(value);
value = jsobj.GetDecimals();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_Decimals, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_Decimals, &value, R3TAG_END);

TimeUnit

Attribute

TimeUnit

Identifier

R3UNITCONVA_TimeUnit

JavaScript type

Integer

C type

R3INT

Description

see time units below

Syntax


jsobj.SetTimeUnit(value);
value = jsobj.GetTimeUnit();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_TimeUnit, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_TimeUnit, &value, R3TAG_END);

FirstFrameIndex

Attribute

FirstFrameIndex

Identifier

R3UNITCONVA_FirstFrameIndex

JavaScript type

Integer

C type

R3INT

Description

first frame index (usually 0 or 1)

Syntax


jsobj.SetFirstFrameIndex(value);
value = jsobj.GetFirstFrameIndex();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_FirstFrameIndex, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_FirstFrameIndex, &value, R3TAG_END);

SeparateVectorFi

Attribute

SeparateVectorFi

Identifier

R3UNITCONVA_SeparateVectorFi

JavaScript type

Boolean

C type

R3BOOL

Description

true to get three field vector gadgets

Syntax


jsobj.SetSeparateVectorFi(value);
value = jsobj.GetSeparateVectorFi();


R3BOOL value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_SeparateVectorFields, value, R3TAG_END);
R3BOOL value;
R3GetAttrs(r3obj, R3UNITCONVA_SeparateVectorFields, &value, R3TAG_END);

Space

Attribute

Space

Identifier

R3UNITCONVA_Space

JavaScript type

Integer

C type

R3INT

Description

see enum below

Syntax


jsobj.SetSpace(value);
value = jsobj.GetSpace();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_Space, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_Space, &value, R3TAG_END);

AreaUnit

Attribute

AreaUnit

Identifier

R3UNITCONVA_AreaUnit

JavaScript type

Integer

C type

R3INT

Description

see area units

Syntax


jsobj.SetAreaUnit(value);
value = jsobj.GetAreaUnit();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_AreaUnit, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_AreaUnit, &value, R3TAG_END);

VolumeUnit

Attribute

VolumeUnit

Identifier

R3UNITCONVA_VolumeUnit

JavaScript type

Integer

C type

R3INT

Description

see vol units

Syntax


jsobj.SetVolumeUnit(value);
value = jsobj.GetVolumeUnit();


R3INT value = ...;
R3SetAttrs(r3obj, R3UNITCONVA_VolumeUnit, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3UNITCONVA_VolumeUnit, &value, R3TAG_END);

1D

R3UNIU_DISTANCE
R3UNIU_ANGLE
R3UNIU_VELOCITY
R3UNIU_TIME
R3UNIU_ABSOLUTE
R3UNIU_AREA
R3UNIU_VOLUME

Distance units

R3UNID_METERS
R3UNID_MILLIMETERS
R3UNID_CENTIMETERS
R3UNID_KILOMETERS
R3UNID_INCHES
R3UNID_FEET
R3UNID_YARDS
R3UNID_MILES

Area units

R3UNIA_SQUAREMILLIMETERS
R3UNIA_SQUARECENTIMETERS
R3UNIA_SQUAREMETERS
R3UNIA_ARES
R3UNIA_HECTARES
R3UNIA_SQUAREKILOMETERS
R3UNIA_SQUAREINCHES
R3UNIA_SQUAREFEET
R3UNIA_SQUAREYARDS
R3UNIA_ACRES
R3UNIA_SQUAREMILES

Volume units

R3UNIV_MILLILITERS
R3UNIV_CENTILITERS
R3UNIV_DECILITERS
R3UNIV_LITERS
R3UNIV_DECALITERS
R3UNIV_HECTOLITERS
R3UNIV_CUBICMETERS
R3UNIV_CUBICINCHES
R3UNIV_CUBICFEET
R3UNIV_CUBICYARDS
R3UNIV_USFLUIDOUNCES
R3UNIV_USFLUIDGALLONS

Angle units

R3UNIA_DEGREES
R3UNIA_RADIANS

Vector units

R3UNIV_CARTESIAN
R3UNIV_POLAR

Time units

R3UNIT_FRAME
R3UNIT_TIME
R3UNIT_SECONDS

Space

R3SPACE_YUP
R3SPACE_ZUP

Structure for representing real time

Structure for conversion to nad for frames


r3appobj *

Tags

Tags

R3UNITCONVA_reserved
R3UNITCONVA_Int
R3UNITCONVA_Unit
R3UNITCONVA_String
R3UNITCONVA_Float