File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 293
293
if ( that . integrator == 'euler' ) {
294
294
point . v = point . v . add ( point . f . multiply ( timestep ) ) . multiply ( 1 - that . friction ) ;
295
295
} else {
296
- point . v = point . v . add ( point . f . add ( point . _F ) . multiply ( timestep * 0.5 ) ) . multiply ( 1 - that . friction ) ;
296
+ point . v = point . v . add ( point . f . add ( point . _F . divide ( point . _m ) ) . multiply ( timestep * 0.5 ) ) . multiply ( 1 - that . friction ) ;
297
297
}
298
298
point . f . x = point . f . y = 0
299
299
323
323
} else {
324
324
//this should follow the equation
325
325
//x(t+1) = x(t) + v(t) * timestep + 1/2 * timestep^2 * a(t)
326
- var accelPart = point . f . multiply ( 0.5 * timestep * timestep ) ;
327
- point . p = point . p . add ( point . v . multiply ( timestep ) ) . add ( accelPart ) ;
326
+ var accel = point . f . multiply ( 0.5 * timestep * timestep ) . divide ( point . m ) ;
327
+ point . p = point . p . add ( point . v . multiply ( timestep ) ) . add ( accel ) ;
328
328
}
329
329
330
330
if ( ! bottomright ) {
You can’t perform that action at this time.
0 commit comments