[−][src]Function k::center_of_mass
pub fn center_of_mass<T>(chain: &Chain<T>) -> Vector3<T> where
T: RealField,
Calculate the center of mass of the chain
use k::*; use k::link::*; let j0 = JointBuilder::new() .translation(Translation3::new(0.0, 1.0, 0.0)) .into_node(); let j1 = JointBuilder::new() .translation(Translation3::new(0.0, 0.0, 1.0)) .into_node(); j0.set_link(Some(LinkBuilder::new().inertial(Inertial::from_mass(1.0)).finalize())); j1.set_link(Some(LinkBuilder::new().inertial(Inertial::from_mass(4.0)).finalize())); j1.set_parent(&j0); let tree = Chain::from_root(j0); let com1 = center_of_mass(&tree);