1 import des.math.linear.vector; 2 import des.math.util.mathstruct; 3 4 static struct Point 5 { 6 vec3 pos, vel; 7 mixin( BasicMathOp!"pos vel" ); 8 } 9 10 Point rpart( in Point p, double time ) 11 { return Point( p.vel, vec3(0,0,0) ); } 12 13 auto v = Point( vec3(10,3,1), vec3(5,4,3) ); 14 15 double time = 0, ft = 10, step = .01; 16 foreach( i; 0 .. 1000 ) 17 v = runge( v, &rpart, time+=step, step ); 18 19 assert( eq_approx( v.pos, vec3(60,43,31), 1e-3 ) );