11import { Equation } from './Equation'
22import { Vec3 } from '../math/Vec3'
3+ import type { Body } from '../objects/Body'
34
45/**
56 * Contact/non-penetration constraint equation
@@ -11,35 +12,21 @@ import { Vec3 } from '../math/Vec3'
1112 * @extends Equation
1213 */
1314export class ContactEquation extends Equation {
14- constructor ( bodyA , bodyB , maxForce = 1e6 ) {
15- super ( bodyA , bodyB , 0 , maxForce )
15+ restitution : number // "bounciness": u1 = -e*u0
16+ ri : Vec3 // World-oriented vector that goes from the center of bi to the contact point.
17+ rj : Vec3 // World-oriented vector that starts in body j position and goes to the contact point.
18+ ni : Vec3 // Contact normal, pointing out of body i.
1619
17- /**
18- * @property restitution
19- * @type {Number }
20- */
21- this . restitution = 0.0 // "bounciness": u1 = -e*u0
20+ constructor ( bodyA : Body , bodyB : Body , maxForce = 1e6 ) {
21+ super ( bodyA , bodyB , 0 , maxForce )
2222
23- /**
24- * World-oriented vector that goes from the center of bi to the contact point.
25- * @property {Vec3 } ri
26- */
23+ this . restitution = 0.0
2724 this . ri = new Vec3 ( )
28-
29- /**
30- * World-oriented vector that starts in body j position and goes to the contact point.
31- * @property {Vec3 } rj
32- */
3325 this . rj = new Vec3 ( )
34-
35- /**
36- * Contact normal, pointing out of body i.
37- * @property {Vec3 } ni
38- */
3926 this . ni = new Vec3 ( )
4027 }
4128
42- computeB ( h ) {
29+ computeB ( h : number ) : number {
4330 const a = this . a
4431 const b = this . b
4532 const bi = this . bi
@@ -95,7 +82,7 @@ export class ContactEquation extends Equation {
9582 * @method getImpactVelocityAlongNormal
9683 * @return {number }
9784 */
98- getImpactVelocityAlongNormal ( ) {
85+ getImpactVelocityAlongNormal ( ) : number {
9986 const vi = ContactEquation_getImpactVelocityAlongNormal_vi
10087 const vj = ContactEquation_getImpactVelocityAlongNormal_vj
10188 const xi = ContactEquation_getImpactVelocityAlongNormal_xi
0 commit comments