diff --git a/doc/APIreference/APItypes.rst b/doc/APIreference/APItypes.rst index 75f9a7c1..bca236ad 100644 --- a/doc/APIreference/APItypes.rst +++ b/doc/APIreference/APItypes.rst @@ -1081,7 +1081,7 @@ is initialized, others change at runtime. Model Editing ^^^^^^^^^^^^^ -The strucs below are defined in +The structs below are defined in `mjspec.h `__ and, with the exception of the top level :ref:`mjSpec` struct, begin with the ``mjs`` prefix. For more details, see the :doc:`Model Editing <../programming/modeledit>` chapter. @@ -1101,21 +1101,15 @@ Model specification. mjsElement ~~~~~~~~~~ -Special type corresponding to any element. +Special type corresponding to any element. This struct is the first member of all other elements; in the low-level C++ +implementation, it is not included as a member but via class inheritance. Inclusion via inheritance allows the compiler +to ``static_cast`` an ``mjsElement`` to the correct C++ object class. Unlike all other attributes of the structs below, +which are user-settable by design, modifying the contents of an ``mjsElement`` is not allowed and leads to undefined +behavior. .. mujoco-include:: mjsElement -.. _mjsOrientation: - -mjsOrientation -~~~~~~~~~~~~~~ - -Alternative orientation specifiers. - -.. mujoco-include:: mjsOrientation - - .. _mjsBody: mjsBody @@ -1376,6 +1370,16 @@ Plugin specification. .. mujoco-include:: mjsPlugin +.. _mjsOrientation: + +mjsOrientation +~~~~~~~~~~~~~~ + +Alternative orientation specifiers. + +.. mujoco-include:: mjsOrientation + + .. _ArrayHandles: .. _mjString: diff --git a/doc/changelog.rst b/doc/changelog.rst index d84fb4a3..d84e670d 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -57,9 +57,9 @@ General point, as usual. If ``mjUSESINGLE`` is defined, MuJoCo will use single-precision floating point. See :ref:`mjtNum`. Relatedly, fixed various type errors that prevented building with single-precision. -13. Quaternions in ``mjData->qpos`` and ``mjData->mocap_quat`` are no longer normalized in-place by +13. Quaternions in ``mjData.qpos`` and ``mjData.mocap_quat`` are no longer normalized in-place by :ref:`mj_kinematics`. Instead they are normalized when they are used. After the first step, quaternions in - ``mjData->qpos`` will be normalized. + ``mjData.qpos`` will be normalized. 14. Mesh loading in the compiler, which is usually the slowest part of the loading process, is now multi-threaded. MJX diff --git a/src/user/user_api.cc b/src/user/user_api.cc index 454e3199..79c20224 100644 --- a/src/user/user_api.cc +++ b/src/user/user_api.cc @@ -639,7 +639,7 @@ mjsBody* mjs_asBody(mjsElement* element) { if (element && element->elemtype == mjOBJ_BODY) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -649,7 +649,7 @@ mjsGeom* mjs_asGeom(mjsElement* element) { if (element && element->elemtype == mjOBJ_GEOM) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -659,7 +659,7 @@ mjsJoint* mjs_asJoint(mjsElement* element) { if (element && element->elemtype == mjOBJ_JOINT) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -669,7 +669,7 @@ mjsSite* mjs_asSite(mjsElement* element) { if (element && element->elemtype == mjOBJ_SITE) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -679,7 +679,7 @@ mjsCamera* mjs_asCamera(mjsElement* element) { if (element && element->elemtype == mjOBJ_CAMERA) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -689,7 +689,7 @@ mjsLight* mjs_asLight(mjsElement* element) { if (element && element->elemtype == mjOBJ_LIGHT) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -699,7 +699,7 @@ mjsFrame* mjs_asFrame(mjsElement* element) { if (element && element->elemtype == mjOBJ_FRAME) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -709,7 +709,7 @@ mjsActuator* mjs_asActuator(mjsElement* element) { if (element && element->elemtype == mjOBJ_ACTUATOR) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -719,7 +719,7 @@ mjsSensor* mjs_asSensor(mjsElement* element) { if (element && element->elemtype == mjOBJ_SENSOR) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -729,7 +729,7 @@ mjsFlex* mjs_asFlex(mjsElement* element) { if (element && element->elemtype == mjOBJ_FLEX) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -739,7 +739,7 @@ mjsPair* mjs_asPair(mjsElement* element) { if (element && element->elemtype == mjOBJ_PAIR) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -749,7 +749,7 @@ mjsEquality* mjs_asEquality(mjsElement* element) { if (element && element->elemtype == mjOBJ_EQUALITY) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -759,7 +759,7 @@ mjsExclude* mjs_asExclude(mjsElement* element) { if (element && element->elemtype == mjOBJ_EXCLUDE) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -769,7 +769,7 @@ mjsTendon* mjs_asTendon(mjsElement* element) { if (element && element->elemtype == mjOBJ_TENDON) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -779,7 +779,7 @@ mjsNumeric* mjs_asNumeric(mjsElement* element) { if (element && element->elemtype == mjOBJ_NUMERIC) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -789,7 +789,7 @@ mjsText* mjs_asText(mjsElement* element) { if (element && element->elemtype == mjOBJ_TEXT) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -799,7 +799,7 @@ mjsTuple* mjs_asTuple(mjsElement* element) { if (element && element->elemtype == mjOBJ_TUPLE) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -809,7 +809,7 @@ mjsKey* mjs_asKey(mjsElement* element) { if (element && element->elemtype == mjOBJ_KEY) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -819,7 +819,7 @@ mjsMesh* mjs_asMesh(mjsElement* element) { if (element && element->elemtype == mjOBJ_MESH) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -829,7 +829,7 @@ mjsHField* mjs_asHField(mjsElement* element) { if (element && element->elemtype == mjOBJ_HFIELD) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -839,7 +839,7 @@ mjsSkin* mjs_asSkin(mjsElement* element) { if (element && element->elemtype == mjOBJ_SKIN) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -849,7 +849,7 @@ mjsTexture* mjs_asTexture(mjsElement* element) { if (element && element->elemtype == mjOBJ_TEXTURE) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; } @@ -859,7 +859,7 @@ mjsMaterial* mjs_asMaterial(mjsElement* element) { if (element && element->elemtype == mjOBJ_MATERIAL) { return &(static_cast(element)->spec); } - return nullptr; + return nullptr; }