blob: baf401a4713baff3a5e8c8c97ebe108c7b0c5024 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/*
* Simple Mechanics Simulator (SiMS)
* copyright (c) 2009 Jakob Odersky
* made available under the MIT License
*/
package sims.collision
import geometry._
import dynamics._
/**Kollision zwischen zwei Kreisen.*/
case class CircleCollision(c1: Circle, c2: Circle) extends Collision {
val shape1 = c1
val shape2 = c2
val normal = (c2.pos - c1.pos).unit
val points = {
val distance = (c2.pos - c1.pos).length
val p = shape1.pos + normal * (distance - c2.radius)
List(p)
}
}
|