summaryrefslogtreecommitdiff
path: root/src/main/scala/sims/dynamics/Constraint.scala
blob: eaa6952b8aeaa00c66e9531950d9397880f1dfab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Simple Mechanics Simulator (SiMS)
 * copyright (c) 2009 Jakob Odersky
 * made available under the MIT License
*/

package sims.dynamics

/**All constraints in SiMS implement this trait.
 * Position and velocity can be corrected for each constraint.
 * The implementation of constraints was inspired by Erin Catto's box2d.*/
trait Constraint {
  
  /**Corrects the velocities of bodies according to this constraint.
   * @param h a time interval, used for converting forces and impulses*/
  def correctVelocity(h: Double): Unit
  
  /**Corrects the positions of bodies according to this constraint.
   * @param h a time interval, used for converting forces and impulses*/
  def correctPosition(h: Double): Unit
}