Change MuJoCo engine source code function-spacing convention from 3 blank lines to 2

PiperOrigin-RevId: 813754244
Change-Id: I6836e41c3b021cb727e922c25c60f629b9814c93
This commit is contained in:
Yuval Tassa
2025-10-01 07:57:17 -07:00
committed by Copybara-Service
parent c439628f82
commit edbdb5195c
36 changed files with 8 additions and 651 deletions
+1 -29
View File
@@ -36,6 +36,7 @@
#include "engine/engine_vis_init.h"
#include "engine/engine_vis_interact.h"
//----------------------------- utility functions and macros ---------------------------------------
static const mjtNum IDENTITY[9] = {1, 0, 0,
@@ -49,7 +50,6 @@ static void f2f(float* dest, const float* src, int n) {
}
// make text label
static void makeLabel(const mjModel* m, mjtObj type, int id, char* label) {
const char* typestr = mju_type2Str(type);
@@ -71,7 +71,6 @@ static void makeLabel(const mjModel* m, mjtObj type, int id, char* label) {
}
// convert HSV to RGB
static void hsv2rgb(float *RGB, float H, float S, float V) {
float R, G, B;
@@ -106,7 +105,6 @@ static void hsv2rgb(float *RGB, float H, float S, float V) {
}
static const float kIslandSaturation = 0.8;
static const float kIslandValue = 0.7;
@@ -136,7 +134,6 @@ static void mixcolor(float rgba[4], const float ref[4], int flg1, int flg2) {
}
// a body is static if it is welded to the world and is not a mocap body
static int bodycategory(const mjModel* m, int bodyid) {
if (m->body_weldid[bodyid] == 0 && m->body_mocapid[bodyid] == -1) {
@@ -180,7 +177,6 @@ void releaseGeom(mjvGeom** geom, mjvScene* scn) {
}
// make a triangle in thisgeom at coordinates v0, v1, v2 with a given color
static void makeTriangle(mjvGeom* thisgeom, const mjtNum v0[3], const mjtNum v1[3],
const mjtNum v2[3], const float rgba[4]) {
@@ -196,7 +192,6 @@ static void makeTriangle(mjvGeom* thisgeom, const mjtNum v0[3], const mjtNum v1[
}
// copy material fields from model to visual geom
static void setMaterial(const mjModel* m, mjvGeom* geom, int matid, const float* rgba,
const mjtByte* flags) {
@@ -226,7 +221,6 @@ static void setMaterial(const mjModel* m, mjvGeom* geom, int matid, const float*
}
// set (type, size, pos, mat) connector-type geom between given points
// assume that mjv_initGeom was already called to set all other properties
void mjv_connector(mjvGeom* geom, int type, mjtNum width,
@@ -269,7 +263,6 @@ void mjv_connector(mjvGeom* geom, int type, mjtNum width,
}
// initialize given fields when not NULL, set the rest to their default values
void mjv_initGeom(mjvGeom* geom, int type, const mjtNum* size,
const mjtNum* pos, const mjtNum* mat, const float* rgba) {
@@ -353,7 +346,6 @@ void mjv_initGeom(mjvGeom* geom, int type, const mjtNum* size,
}
// mark geom as selected
static void markselected(const mjVisual* vis, mjvGeom* geom) {
// add emission
@@ -361,7 +353,6 @@ static void markselected(const mjVisual* vis, mjvGeom* geom) {
}
// draw 3 cylinders representing a "frame" decor element
void addFrameGeoms(mjvScene* scn, int i, mjtNum* pos, mjtNum* rot, float length, float width) {
// draw separate geoms for each axis
@@ -393,7 +384,6 @@ void addFrameGeoms(mjvScene* scn, int i, mjtNum* pos, mjtNum* rot, float length,
}
//----------------------------- camera functions --------------------------------------------------
// computes the camera frustum
@@ -410,7 +400,6 @@ static void getFrustum(float zver[2], float zhor[2], float znear,
}
void mjv_cameraFrame(mjtNum headpos[3], mjtNum forward[3], mjtNum up[3], mjtNum right[3],
const mjData* d, const mjvCamera* cam) {
switch (cam->type) {
@@ -534,7 +523,6 @@ void mjv_cameraFrustum(float zver[2], float zhor[2], float zclip[2], const mjMod
}
//----------------------------- main API functions -------------------------------------------------
// add contact-related geoms in mjvObject
@@ -2506,7 +2494,6 @@ void mjv_addGeoms(const mjModel* m, mjData* d, const mjvOption* vopt,
}
// make list of lights only
void mjv_makeLights(const mjModel* m, const mjData* d, mjvScene* scn) {
mjvLight* thislight;
@@ -2582,7 +2569,6 @@ void mjv_makeLights(const mjModel* m, const mjData* d, mjvScene* scn) {
}
// update camera only
void mjv_updateCamera(const mjModel* m, const mjData* d, mjvCamera* cam, mjvScene* scn) {
// return if nothing to do
@@ -2659,7 +2645,6 @@ void mjv_updateCamera(const mjModel* m, const mjData* d, mjvCamera* cam, mjvScen
}
// construct face, flat normals
static void makeFace(float* _face, float* _normal, mjtNum radius, const mjtNum* vertxpos,
int nface, int i0, int i1, int i2) {
@@ -2692,7 +2677,6 @@ static void makeFace(float* _face, float* _normal, mjtNum radius, const mjtNum*
}
// add face normal to vertices
static void addNormal(mjtNum* vertnorm, const mjtNum* vertxpos,
int i0, int i1, int i2) {
@@ -2713,7 +2697,6 @@ static void addNormal(mjtNum* vertnorm, const mjtNum* vertxpos,
}
// construct face, smooth normals
static void makeSmooth(float* _face, float* _normal, mjtNum radius, mjtByte flg_flat,
const mjtNum* vertnorm, const mjtNum* vertxpos,
@@ -2761,7 +2744,6 @@ static void makeSmooth(float* _face, float* _normal, mjtNum radius, mjtByte flg_
}
// construct side in 2D face
static void makeSide(float* _face, float* _normal, mjtNum radius,
const mjtNum* vertnorm, const mjtNum* vertxpos,
@@ -2798,7 +2780,6 @@ static void makeSide(float* _face, float* _normal, mjtNum radius,
}
// copy texcoord for face
static void copyTex(float* dst, const float* src, int nface, int i0, int i1, int i2) {
if (!dst || !src) {
@@ -2814,7 +2795,6 @@ static void copyTex(float* dst, const float* src, int nface, int i0, int i1, int
}
// update visible flexes only
void mjv_updateActiveFlex(const mjModel* m, mjData* d, mjvScene* scn, const mjvOption* opt) {
// save flex visualization flags in scene (needed by renderer)
@@ -2974,7 +2954,6 @@ void mjv_updateActiveFlex(const mjModel* m, mjData* d, mjvScene* scn, const mjvO
}
// update all skins, here for backward API compatibility
void mjv_updateSkin(const mjModel* m, const mjData* d, mjvScene* scn) {
mjvOption opt;
@@ -2984,7 +2963,6 @@ void mjv_updateSkin(const mjModel* m, const mjData* d, mjvScene* scn) {
}
// update visible skins only
void mjv_updateActiveSkin(const mjModel* m, const mjData* d, mjvScene* scn, const mjvOption* opt) {
// process skins
@@ -3113,7 +3091,6 @@ void mjv_updateActiveSkin(const mjModel* m, const mjData* d, mjvScene* scn, cons
}
// update entire scene
void mjv_updateScene(const mjModel* m, mjData* d, const mjvOption* opt,
const mjvPerturb* pert, mjvCamera* cam, int catmask, mjvScene* scn) {
@@ -3163,7 +3140,6 @@ void mjv_updateScene(const mjModel* m, mjData* d, const mjvOption* opt,
}
//----------------------------------- catenary functions -------------------------------------------
// returns hyperbolic cosine and optionally computes hyperbolic sine
@@ -3176,14 +3152,12 @@ static inline mjtNum cosh_sinh(mjtNum x, mjtNum* sinh) {
}
// returns intercept of the catenary equation
static inline mjtNum catenary_intercept(mjtNum v, mjtNum h, mjtNum length) {
return 1/mju_sqrt(mju_sqrt(length*length - v*v)/h - 1);
}
// returns residual of catenary equation and optionally computes its gradient w.r.t b
static inline mjtNum catenary_residual(mjtNum b, mjtNum intercept, mjtNum* grad) {
mjtNum a = 0.5 / b;
@@ -3195,7 +3169,6 @@ static inline mjtNum catenary_residual(mjtNum b, mjtNum intercept, mjtNum* grad)
}
// convergence tolerance for catenary solver
static const mjtNum tolerance = 1e-9;
@@ -3240,7 +3213,6 @@ static inline mjtNum solve_catenary(mjtNum v, mjtNum h, mjtNum length) {
}
// points along catenary of given length between x0 and x1, returns number of points
int mjv_catenary(const mjtNum x0[3], const mjtNum x1[3], const mjtNum gravity[3], mjtNum length,
mjtNum* catenary, int ncatenary) {