Tin

Examples · modules · 325 of 339

kinematics

A second file: everything declared here is visible to the files that import it.

examples/modules/kinematics.tintin run examples/modules/kinematics.tin
// A second file: everything declared here is visible to the files that import it.

type Joint = { name: string, angle: float, limit: float }

/// The joints that are past their limit.
fn overLimit(joints: Joint[]): string[] {
  var out: string[] = []
  for j in joints {
    if abs(j.angle) > j.limit { out.push(j.name) }
  }
  out
}