Implementation:Google deepmind Mujoco User Util Header
| Knowledge Sources | |
|---|---|
| Domains | Physics Simulation, Math Utilities |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Declares utility functions and constants for vector/quaternion math, string parsing, and numeric operations used throughout the user module.
Description
user_util.h declares a comprehensive set of mathematical utility functions including vector operations (mjuu_setvec, mjuu_copyvec, mjuu_addtovec, mjuu_zerovec, mjuu_dot3, mjuu_dist3, mjuu_normvec, mjuu_scalevec), numeric validation (mjuu_defined), matrix addressing (mjuu_matadr), and L1 norm computation. It defines the constants mjEPS (1E-14) for minimum calculation values and mjMINMASS (1E-6) for minimum allowed mass. Template functions provide generic vector copying across different numeric types.
Usage
Included by most files in the user and xml modules as a foundational utility header for mathematical and numeric operations.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: src/user/user_util.h
- Lines: 1-291
Key Functions
const double mjEPS = 1E-14;
const double mjMINMASS = 1E-6;
bool mjuu_defined(double num);
int mjuu_matadr(int g1, int g2, int n);
void mjuu_setvec(double* dest, double x, double y, double z, double w);
void mjuu_setvec(double* dest, double x, double y, double z);
double mjuu_dot3(const double* a, const double* b);
double mjuu_dist3(const double* a, const double* b);
double mjuu_normvec(double* vec, int n);
void mjuu_scalevec(double* res, const double* vec, double s, int n);
template <class T1, class T2>
void mjuu_copyvec(T1* dest, const T2* src, int n);
Import
#include "user/user_util.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| N/A | N/A | N/A | Header declaring utility functions and constants |
Outputs
| Name | Type | Description |
|---|---|---|
| Function declarations | various | Vector, quaternion, numeric utility function declarations |
| Constants | double | mjEPS (1E-14) and mjMINMASS (1E-6) constants |