Skip to main content
Version: 14 Oct 2024

ml_types.h

Classes

Name
structMLVec2f
structMLXYZf
Internal structure used to simplify access of MLVec3f. Do not create this structure directly and always use MLVec3f instead.
structMLVec3f
structMLQuaternionf
structMLTransform
structMLMat4f
structMLRectf
structMLRecti
structMLColor32
structMLColor4f
structMLUUID
structMLPose

Types

Name
typedef struct MLVec2fMLVec2f
typedef struct MLXYZfMLXYZf
Internal structure used to simplify access of MLVec3f. Do not create this structure directly and always use MLVec3f instead.
typedef struct MLVec3fMLVec3f
typedef struct MLQuaternionfMLQuaternionf
typedef struct MLTransformMLTransform
typedef struct MLMat4fMLMat4f
typedef struct MLRectfMLRectf
typedef struct MLRectiMLRecti
typedef struct MLColor32MLColor32
typedef struct MLColor4fMLColor4f
typedef struct MLUUIDMLUUID
typedef int64_tMLTime
typedef struct MLPoseMLPose

Types Documentation

MLVec2f

typedef struct MLVec2f MLVec2f;

2D vector represented with X and Y floats.

More Info


MLXYZf

typedef struct MLXYZf MLXYZf;

Internal structure used to simplify access of MLVec3f. Do not create this structure directly and always use MLVec3f instead.

More Info


MLVec3f

typedef struct MLVec3f MLVec3f;

3D vector represented with X, Y, and Z floats.

More Info


MLQuaternionf

typedef struct MLQuaternionf MLQuaternionf;

Quaternion stored as X, Y, Z, W floats.

More Info


MLTransform

typedef struct MLTransform MLTransform;

Information used to transform from one coordinate frame to another.

More Info


MLMat4f

typedef struct MLMat4f MLMat4f;

An arbitrary 4x4 matrix represented with an array of floats.

More Info


MLRectf

typedef struct MLRectf MLRectf;

A 2D float rectangle.

More Info


MLRecti

typedef struct MLRecti MLRecti;

A 2D integer rectangle.

More Info


MLColor32

typedef struct MLColor32 MLColor32;

Color represented by 4 unsigned bytes.

More Info


MLColor4f

typedef struct MLColor4f MLColor4f;

Color represented by 4 floats.

More Info


MLUUID

typedef struct MLUUID MLUUID;

Universally Unique Identifier.

More Info


MLTime

typedef int64_t MLTime;

Represents an ML API wide timestamp in nanoseconds that is not guaranteed to be synced with any system time.


MLPose

typedef struct MLPose MLPose;

Geometric relationship between two coordinate frames.

More Info


Source code

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2017 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

#pragma once

#include "ml_api.h"

ML_EXTERN_C_BEGIN

typedef struct MLVec2f {
float x;
float y;
} MLVec2f;

typedef struct MLXYZf {
float x;
float y;
float z;
} MLXYZf;

typedef struct MLVec3f {
union {
MLXYZf xyz;
float values[3];
struct {
float x;
float y;
float z;
};
};
} MLVec3f;

typedef struct MLQuaternionf {
union {
float values[4];
struct {
float x;
float y;
float z;
float w;
};
};
} MLQuaternionf;

typedef struct MLTransform {
MLQuaternionf rotation;
MLVec3f position;
} MLTransform;

typedef struct MLMat4f {
float matrix_colmajor[16];
} MLMat4f;

typedef struct MLRectf {
float x;
float y;
float w;
float h;
} MLRectf;

typedef struct MLRecti {
int32_t x;
int32_t y;
int32_t w;
int32_t h;
} MLRecti;

typedef struct MLColor32 {
union {
struct {
uint8_t a;
uint8_t b;
uint8_t g;
uint8_t r;
};
uint32_t rgba;
};
} MLColor32;

typedef struct MLColor4f {
float r;
float g;
float b;
float a;
} MLColor4f;

typedef struct MLUUID {
union {
struct {
uint32_t time_low;
uint16_t time_mid;
uint16_t time_hi_and_version;
uint8_t clock_seq_hi_and_reserved;
uint8_t clock_seq_low;
uint8_t node[6];
};
uint8_t data[16];
};
} MLUUID;

typedef int64_t MLTime;

typedef struct MLPose {
MLTransform transform;
bool has_derivatives;
MLVec3f linear_velocity;
MLVec3f linear_acceleration;
MLVec3f angular_velocity;
MLVec3f angular_acceleration;

MLTime origin_time_ns;
MLTime predict_time_ns;
} MLPose;

ML_EXTERN_C_END