skelly

crates docs actions MIT/Apache loc

Crate for skeleton animation.

Optionally provides inverse-kinematics functionality.

Example

```rust // build a skelly with leg and two arms. let mut skelly = Skelly::::new(); let foot = skelly.add_root(Point3::origin()); let leg = skelly.attach(Vector3::z().into(), foot); let waist = skelly.attach(Vector3::z().into(), leg);

let leftshoulder = skelly.attach(Vector3::z().into(), waist); let leftarm = skelly.attach((-Vector3::x()).into(), leftshoulder); let leftpalm = skelly.attach((-Vector3::x()).into(), left_arm);

let rightshoulder = skelly.attach(Vector3::z().into(), waist); let rightarm = skelly.attach(Vector3::x().into(), rightshoulder); let rightpalm = skelly.attach(Vector3::x().into(), right_arm);

// Write global isometries of every joint into an array. let mut globals = vec![Isometry3::identity(); skelly.len()]; skelly.write_globals(&mut globals);

```

IK example

```rust use {skelly::Skelly, na::{Point3, Vector3, Isometry3}}; let mut skelly = Skelly::::new(); let foot = skelly.addroot(Point3::origin()); let leg = skelly.attach(Vector3::z().into(), foot); let waist = skelly.attach(Vector3::z().into(), leg); let leftshoulder = skelly.attach(Vector3::z().into(), waist); let leftarm = skelly.attach((-Vector3::x()).into(), leftshoulder); let leftpalm = skelly.attach((-Vector3::x()).into(), leftarm); let rightshoulder = skelly.attach(Vector3::z().into(), waist); let rightarm = skelly.attach(Vector3::x().into(), rightshoulder); let rightpalm = skelly.attach(Vector3::x().into(), right_arm); use skelly::ik::rotor::RotorSolver;

// Using the skelly above, do some inverse-kinematics let mut posture = skelly.make_posture(); let mut solver = RotorSolver::new(0.01);

// move left palm to the foot. solver.setpositiongoal(left_palm, Point3::origin());

// Iteratively solve imposed constraints. for _ in 0..100 { solver.solve_step(&skelly, &mut posture); }

// Write global isometries of every joint in the posture into an array. let mut globals = vec![Isometry3::identity(); skelly.len()]; skelly.writeglobalsfor_posture(&posture, &mut globals);

License

Licensed under either of

at your option.

Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.