Repères et hiérarchie: comment ça marche

Separator

Coordonnées des Segments

En toute logique, les coordonnées de la géométrie d'un Segment devraient être exprimées dans le repère du Joint père, qui lui même contiendrait sa transformation par rapport à son père (repères relatifs).

Si on applique ceci au joint HumanoidRoot auquel on apparente un Segment sacrum de taille (0.4 0.3 0.2):

DEF hanim_HumanoidRoot Joint {
  name "HumanoidRoot"
  translation 0 0 0
  rotation 0 0 1 0
  center 0 0.903 -0.025
  children [
    # joints hierarchy ...
    DEF sacrum Segment {
    name "sacrum"
      children Shape {
        appearance Appearance {
          material USE RedMtl
        }
        geometry IndexedFaceSet {
          coord Coordinate {
            point [ -0.2 0 -0.1, 0.2 0 -0.1, 
                    -0.2 0.3 -0.1, 0.2 0.3 -0.1,
                    -0.2 0 0.1, 0.2 0 0.1,
                    -0.2 0.3 0.1, 0.2 0.3 0.1 ]
          }
          coordIndex [ ... ]
        }
      }
    }
  ]
}
Le sacrum (gros cube rouge) apparaît au niveau des pieds du robot: les coordonnées des Segments doivent être exprimées par rapport au repère de l'humanoid RH, situé entre les pieds. Dans l'exemple il suffit d'ajouter 0.903 en Y et d'enlever 0.025 en Z, afin de positionner le Segment correctement par rapport au Joint.

DEF hanim_HumanoidRoot Joint {
  name "HumanoidRoot"
  translation 0 0 0
  rotation 0 0 1 0
  center 0 0.903 -0.025
  children [
    # joints hierarchy ...
    DEF sacrum Segment {
    name "sacrum"
      children Shape {
        appearance Appearance {
          material USE RedMtl
        }
        geometry IndexedFaceSet {
          coord Coordinate {
            point [ -0.2 0.903 -0.125, 0.2 0.903 -0.125, 
                    -0.2 1.203 -0.125, 0.2 1.203 -0.125,
                    -0.2 0.903 0.075, 0.2 0.903 0.075,
                    -0.2 1.203 0.075, 0.2 1.203 0.075 ]
          }
          coordIndex [ ... ]
        }
      }
    }
  ]
}

Repère et transformations des Joints

Comme le montrent les exemples suivants, le champ center d'un Joint donne l'origine du repère local dans lequel seront effectuées les transformations définies dans les champs translation, rotation etc de ce même Joint, l'orientation des axes quant à elle est la même que celle du repère père (pour HumanoidRoot c'est le repère absolu). Ces transformations se transmettent à tous les Joints enfants de par leur organisation arborescente.

HumanoidRoot :
- center translaté par rapport à RH
- rotation de 45° autour de Z
DEF HumanoidRoot Joint {
  ...
  translation 0 0 0
  rotation 0 0 1 0.785
  center 0 0.903 -0.025
  children [
    ...
  ]
}
l_knee :
- center translaté par rapport à RH
- rotation de 45° autour de X
DEF l_knee Joint {
  ...
  translation 0 0 0
  rotation 1 0 0 0.785
  center 0.109 0.493 0.024
  children [
    ...
  ]
}
l_knee :
- center en 0 0 0 (center coincide avec l'origine de RH)
- rotation de 45° autour de X
DEF l_knee Joint {
  ...
  translation 0 0 0
  rotation 1 0 0 0.785
  center 0 0 0
  children [
    ...
  ]
}
HumanoidRoot :
- center en 0 0 0 (center coincide avec l'origine de RH)
- rotation de 45° autour de Z
DEF HumanoidRoot Joint {
  name "HumanoidRoot"
  translation 0 0 0
  rotation 0 0 1 0.785
  center 0 0 0
  children [
    ...
  ]
}
l_knee :
- center translaté par rapport à RH
- rotation de 45° autour de X
DEF l_knee Joint {
  ...
  translation 0 0 0
  rotation 1 0 0 0.785
  center 0.109 0.493 0.024
  children [
    ...
  ]
}
l_knee :
- center en 0 0 0 (center coincide avec l'origine de RH)
- rotation de 45° autour de X
DEF l_knee Joint {
  ...
  translation 0 0 0
  rotation 1 0 0 0.785
  center 0 0 0
  children [
    ...
  ]
}