/
readRot

readRot

Description

Use to read an rotation from a file. Command will fail if at the end of the file.

The following is a listing of the different cast types. Note that data can be lost when casting. 'Signed' means the value can be negative. 'Unsigned' means value will always be positive.

CastDescription
cReads a series of signed characters, or signed 8-bit (1 byte) values, and converts them to floats
ucReads a series of unsigned characters, or unsigned 8-bit (1 byte) values, and converts them to floats
sReads a series of signed short integers, or signed 16-bit (2 bytes) values, and converts them to floats
usReads a series of unsigned short integers, or unsigned 16-bit (2 bytes) values, and converts them to floats
iReads a series of signed integers, or signed 32-bit (4 bytes) values, and converts them to floats
uiReads a series of unsigned integers, or unsigned 32-bit (4 bytes) values, and converts them to floats
fReads a series of floating point values, a 32-bit (4 byte) values, and converts them to floats

Functional area

Disk I/O

Command syntax

Syntax

readRot fileID [-delim string] [-quat] [-rotOrder string] [-cast string] [-rad]

Arguments

NameTypeRequiredComments
fileIDint
ID of file previously opened with fileOpen

Flags

NameFlag argumentsArgument typeExclusive toComments
delim1stringDelimiter to expect between rotation channel values. Cannot be used with binary files. Usually "," or "\t", etc.
quat0rotOrderSpecifies that the rotation should be expected as a quaternion (four float values) rather than an Euler angle (three float values). Can not be used with -rotOrder option
rotOrder1stringquatSpecifies the rotation order that the rotation will be expected in. Can not be used with -quat option (possible values are XYZ, XZY, YXZ,YZX, ZXY, and ZYX)
cast1stringData type to cast to. Possible types are listed above. Note that data can be lost when casting.
rad0quat

Return value

vector

Examples

//Read Rot Example
vector $rot;
int $fileID;
int $fileID = `fileOpen "C:/FileTesting.txt" "r"`;
  
// Read the rotation as an Euler angle
// The -delims flag assumes you are reading from a text file 
$rot = `readRot $fileID -delim ","`;
  
// Or, read the rotation as a quaternion
// The -delims flag assumes you are reading from a text file 
$rot = `readRot $fileID -quat -delim "\t"`;
fileClose $fileID;
  
// Display the value
print $rot;

Additional information

Related commands


© Copyright Vicon Motion Systems. All rights reserved.

Vicon trademarks