![]() |
ARX
1.0
The next-generation open source augmented reality toolkit.
|
#include <ARX/AR/ar.h>
#include <math.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/param.h>
#include <pthread.h>
#include <ARX/ARUtil/file_utils.h>
Macros | |
#define | _GNU_SOURCE |
Functions | |
ARUint32 | arGetVersion (char **versionStringRef) |
Get the artoolkitX version information in numberic and string format. More... | |
int | arUtilGetSquareCenter (ARdouble vertex[4][2], ARdouble *x, ARdouble *y) |
int | arUtilMatMul (const ARdouble s1[3][4], const ARdouble s2[3][4], ARdouble d[3][4]) |
int | arUtilMatMuldff (const ARdouble s1[3][4], const float s2[3][4], float d[3][4]) |
int | arUtilMatMulf (const float s1[3][4], const float s2[3][4], float d[3][4]) |
int | arUtilMatInv (const ARdouble s[3][4], ARdouble d[3][4]) |
int | arUtilMatInvf (const float s[3][4], float d[3][4]) |
int | arUtilMat2QuatPos (const ARdouble m[3][4], ARdouble q[4], ARdouble p[3]) |
int | arUtilQuatPos2Mat (const ARdouble q[4], const ARdouble p[3], ARdouble m[3][4]) |
int | arUtilQuatNorm (ARdouble q[4]) |
int | arUtilGetPixelSize (const AR_PIXEL_FORMAT arPixelFormat) |
Get the size in bytes of a single pixel for a given pixel format. More... | |
const char * | arUtilGetPixelFormatName (const AR_PIXEL_FORMAT arPixelFormat) |
Get a string holding a descriptive name for a given pixel format enumeration. More... | |
const char * | arUtilGetFileNameFromPath (const char *path) |
char * | arUtilGetFileBasenameFromPath (const char *path, const int convertToLowercase) |
Get file base name from a path. More... | |
char * | arUtilGetFileExtensionFromPath (const char *path, const int convertToLowercase) |
Get file extension from a path. More... | |
char * | arUtilGetDirectoryNameFromPath (char *dir, const char *path, const size_t n, const int addSeparator) |
char * | arUtilGetFileURI (const char *path) |
Get a path as a file URI. More... | |
char * | arUtilGetResourcesDirectoryPath (AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR behavior) |
Get the path to the resources directory using the specified behavior. More... | |
char * | arUtilGetAndCreateResourcesDirectoryPath (AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR behavior) |
Get the path to the resources directory using the specified behavior, creating the path if it doesn't already exist. More... | |
int | arUtilChangeToResourcesDirectory (AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR behavior, const char *path) |
Change to the resources directory using the specified behavior. More... | |
int | arUtilReplaceExt (char *filename, int n, char *ext) |
int | arUtilRemoveExt (char *filename) |
int | arUtilDivideExt (const char *filename, char *s1, char *s2) |
void | arUtilPrintTransMat (const ARdouble trans[3][4]) |
Prints a transformation matrix via ARPRINT(...). More... | |
void | arUtilPrintMtx16 (const ARdouble mtx16[16]) |
Prints a 4x4 row-major matrix via ARPRINT(...). More... | |
#define _GNU_SOURCE |
ARUint32 arGetVersion | ( | char ** | versionStringRef | ) |
Get the artoolkitX version information in numberic and string format.
@functiongroup "Utility".
As of version 2.72, ARToolKit now allows querying of the version number of the toolkit available at runtime. It is highly recommended that any calling program that depends on features in a certain artoolkitX version, check at runtime that it is linked to a version of artoolkitX that can supply those features. It is NOT sufficient to check the artoolkitX SDK header versions, since with artoolkitX implemented in dynamically-loaded libraries, there is no guarantee that the version of artoolkitX installed on the machine at run-time will be as recent as the version of the artoolkitX SDK which the host program was compiled against.
The version information is reported in binary-coded decimal format, and optionally in an ASCII string.
A increase in the major version number indicates the removal of functionality previously provided in the API. An increase in the minor version number indicates that new functionality has been added. A change in the tiny version number indicates changes (e.g. bug fixes) which do not affect the API. See the comments in the config.h header for more discussion of the definition of major, minor, tiny and build version numbers.
versionStringRef | If non-NULL, the location pointed to will be filled with a pointer to a string containing the version information. Fields in the version string are separated by spaces. As of version 2.72.0, there is only one field implemented, and this field contains the major, minor and tiny version numbers in dotted-decimal format. The string is guaranteed to contain at least this field in all future versions of the toolkit. Later versions of the toolkit may add other fields to this string to report other types of version information. The storage for the string is malloc'ed inside the function. The caller is responsible for free'ing the string. |
int arUtilChangeToResourcesDirectory | ( | AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR | behavior, |
const char * | path | ||
) |
Change to the resources directory using the specified behavior.
artoolkitX uses relative paths to locate several types of resources, including camera parameter files, pattern files, multimarker files and others. This function provides the convenience of setting the current process working directory to the appropriate value for your application.
On Android only, the function has an optional parameter 'instanceOfAndroidContext'. If behavior is AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_APP_CACHE_DIR, this parameter must be an instance of a class derived from android/content/Context. In all other cases, pass NULL for this parameter.
behavior | See AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR type for allowed values. |
path | When behavior is AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_SUPPLIED_PATH, the path to change to (absolute or relative to current working directory). In all other cases, if this parameter is non-NULL, it will be taken as a subdirectory of the desired path and to which the working directory should be changed. |
int arUtilDivideExt | ( | const char * | filename, |
char * | s1, | ||
char * | s2 | ||
) |
char * arUtilGetAndCreateResourcesDirectoryPath | ( | AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR | behavior | ) |
Get the path to the resources directory using the specified behavior, creating the path if it doesn't already exist.
artoolkitX uses relative paths to locate several types of resources, including camera parameter files, pattern files, multimarker files and others. This function provides the convenience of finding an appropriate value for your application.
On Android only, the function has an optional parameter 'instanceOfAndroidContext'. If behavior is AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_APP_CACHE_DIR, this parameter must be an instance of a class derived from android/content/Context. In all other cases, pass NULL for this parameter.
behavior | See AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR type for allowed values. |
char * arUtilGetDirectoryNameFromPath | ( | char * | dir, |
const char * | path, | ||
const size_t | n, | ||
const int | addSeparator | ||
) |
char * arUtilGetFileBasenameFromPath | ( | const char * | path, |
const int | convertToLowercase | ||
) |
Get file base name from a path.
Given a full or partial pathname passed in string path, returns a string with the base name portion of path, i.e. the text between the rightmost path separator and the the rightmost '.' character, if any. If the filename contains no '.', returns the filename.
path | Full or partial pathname. |
convertToLowercase | If convertToLowercase is TRUE, uppercase ASCII characters in the basename will be converted to lowercase. |
char * arUtilGetFileExtensionFromPath | ( | const char * | path, |
const int | convertToLowercase | ||
) |
Get file extension from a path.
Given a full or partial pathname passed in string path, returns a string with the extension portion of path, i.e. the text after the rightmost '.' character, if any. If the filename contains no '.', NULL is returned.
path | Full or partial pathname. |
convertToLowercase | If convertToLowercase is TRUE, uppercase ASCII characters in the extension will be converted to lowercase. |
const char * arUtilGetFileNameFromPath | ( | const char * | path | ) |
char * arUtilGetFileURI | ( | const char * | path | ) |
Get a path as a file URI.
Given a full or partial pathname passed in string path, returns a string with the file URI for that path.
Partial pathnames are handled by concatening with the process's current working directory.
path | Full or partial pathname. On Windows, both partial pathnames, full pathnames including the drive letter, or UNC pathnames (beginning with "\\" are all OK. |
const char * arUtilGetPixelFormatName | ( | const AR_PIXEL_FORMAT | arPixelFormat | ) |
Get a string holding a descriptive name for a given pixel format enumeration.
On occasions it can be useful to display to the user the format of the pixels which artoolkitX is processing. This funtion converts a pixel-format number into a human-readable string description.
arPixelFormat | Enumerated pixel format number for which to retrieve a name. |
int arUtilGetPixelSize | ( | const AR_PIXEL_FORMAT | arPixelFormat | ) |
Get the size in bytes of a single pixel for a given pixel format.
Different pixel formats have different sizes in bytes, and therefore different storage requirements per row of pixels. Use this function to calculate the number of bytes required to store a single pixel of the given type.
arPixelFormat | The pixel type whose size is to be measured. |
char * arUtilGetResourcesDirectoryPath | ( | AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR | behavior | ) |
Get the path to the resources directory using the specified behavior.
artoolkitX uses relative paths to locate several types of resources, including camera parameter files, pattern files, multimarker files and others. This function provides the convenience of finding an appropriate value for your application.
On Android only, the function has an optional parameter 'instanceOfAndroidContext'. If behavior is AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_APP_CACHE_DIR, this parameter must be an instance of a class derived from android/content/Context. In all other cases, pass NULL for this parameter.
behavior | See AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR type for allowed values. |
int arUtilMatInvf | ( | const float | s[3][4], |
float | d[3][4] | ||
) |
int arUtilMatMuldff | ( | const ARdouble | s1[3][4], |
const float | s2[3][4], | ||
float | d[3][4] | ||
) |
int arUtilMatMulf | ( | const float | s1[3][4], |
const float | s2[3][4], | ||
float | d[3][4] | ||
) |
void arUtilPrintMtx16 | ( | const ARdouble | mtx16[16] | ) |
Prints a 4x4 row-major matrix via ARPRINT(...).
mtx16 | The matrix to print. |
void arUtilPrintTransMat | ( | const ARdouble | trans[3][4] | ) |
Prints a transformation matrix via ARPRINT(...).
trans | The transformation matrix to print. |
int arUtilQuatNorm | ( | ARdouble | q[4] | ) |
int arUtilRemoveExt | ( | char * | filename | ) |
int arUtilReplaceExt | ( | char * | filename, |
int | n, | ||
char * | ext | ||
) |