30 std::vector<PForce*>
vec;
39 int s = pp.vec.size();
60 int s = pp.vec.size();
81 int s = pp.vec.size();
104 float xx = x.Index(time);
105 float yy = y.Index(time);
106 float zz = z.Index(time);
107 return Point(xx,yy,zz);
121 : p(p), xf(p), yf(p), zf(p), delta(delta)
133 return comb.
Index(time);
143 float Length()
const {
return 100000.0; }
160 : pl(u_p, u_x, u_y) { }
172 int Index(
float x)
const {
return 0; }
187 std::pair<Point, int>
Index(
float time)
const
189 return std::make_pair(curve.Index(time), 0);
195template<
class A,
class B>
199 A Index(std::pair<A,B> p)
const {
return p.first; }
202template<
class A,
class B>
206 B Index(std::pair<A,B> p)
const {
return p.second; }
209template<
class T,
class A,
class B>
214 std::pair<A,B>
Index(
T p)
const {
return std::make_pair(f.Index(p), f2.Index(p)); }
222class CalculateCollisionPoint
225 CalculateCollisionPoint(Function<float, Point> &curve,
226 Function<Point, float> &space,
float start_time,
float end_time)
227 : pairfunc(curve), pb(space, zero, fst, snd, pairfunc, start_time, end_time)
229 float get_time()
const {
return pb.Elem().value; }
230 Point get_point()
const {
return pb.get_A(); }
233 FloatPullback<std::pair<Point,int>, Point,
int> pb;
241template<
class P1,
class P2>
246 std::pair<P1,P2>
Index(std::pair<float,float> p)
const
248 return std::make_pair(f1.Index(p.first), f2.Index(p.second));
271 if (p.
x<tl.
x)
return false;
272 if (p.
x>br.
x)
return false;
273 if (p.
y<tl.
y)
return false;
274 if (p.
y>br.
y)
return false;
299 return fabs(f.Index(p)-t) <0.001;
310 float val = f.Index(p);
322 if (p.
x<tl.
x)
return false;
323 if (p.
x>br.
x)
return false;
324 if (p.
y<tl.
y)
return false;
325 if (p.
y>br.
y)
return false;
326 if (p.
z<tl.
z)
return false;
327 if (p.
z>br.
z)
return false;
358 return std::make_pair(p.
x,p.
y);
366 return std::make_pair(std::make_pair(p.
p.
x,p.
p.
y),p.
p.
z);
375 : line1(p_1, p_1+v_1), line2(p_2,p_2+v_2), tl(-1000.0,-1000.0), br(1000.0,1000.0), pb(line1, line2, fst, snd, pair) { }
381 LineIn2d line1, line2;
382 Distance2dPullback<std::pair<float,float>, Point2d, Point2d> pb;
383 FloatPairToStdPair pair;
393 return surf.Index(p.first,p.second);
407 pb(surf_func, r, proj_a, proj_b, comb, tl, br)
411 std::pair<float,float> p = pb.get_A();
418 float p = pb.get_B();
433class RenderingEquationBitmap :
public Bitmap<Point2d>
436 RenderingEquationBitmap(Point ray_p, Vector ray_x, Vector ray_y, Vector ray_z, SurfaceIn3d &surf,
int sx,
int sy) : ray_p(ray_p), ray_x(ray_x), ray_y(ray_y), ray_z(ray_z), surf(surf), tl(ray_p), br(ray_p+ray_x+ray_y+ray_z), sx(sx), sy(sy) { }
437 void Collect(CollectVisitor &vis) { }
442 virtual int SizeX()
const {
return sx; }
443 virtual int SizeY()
const {
return sy; }
444 virtual Point2d
Map(
int x,
int y)
const
446 float xx = x / float(sx);
447 float yy = y / float(sy);
448 Vector u_x = ray_x * xx;
449 Vector u_y = ray_y * yy;
451 Point p = ray_p + u_x + u_y;
452 RenderingEquation eq(p, u_z, surf, tl, br);
455 Point2d pp = eq.SurfacePos();
458 float ssx = surf.XSize();
459 float ssy = surf.YSize();
480 Point2d p2 = { -1.0, -1.0 };
486 Vector ray_x, ray_y, ray_z;
495class TextureBitmap :
public Bitmap<Color>
498 TextureBitmap(Bitmap<Point2d> &coords, SurfaceIn3d &surf) : coords(coords), surface(surf) { }
502 void Prepare() { coords.Prepare(); }
504 virtual int SizeX()
const {
return coords.SizeX(); }
505 virtual int SizeY()
const {
return coords.SizeY(); }
506 virtual Color
Map(
int x,
int y)
const
508 Point2d p = coords.Map(x,y);
509 unsigned int c = surface.Color(p.
x, p.
y);
514 Bitmap<Point2d> &coords;
515 SurfaceIn3d &surface;
542 float mass()
const {
return (time_evo.mom(t2).mass - time_evo.mom(t1).mass)/(t2-t1); }
556 float mass()
const {
return mass2; }
559 float time1()
const {
return f.time1(); }
560 float time2()
const {
return f.time2(); }
570 InvMoment(InvForce &
f, Vector v) :
f(
f), v(v) { }
571 Moment moment1()
const
578 Moment moment2()
const
582 vv.
v = v +
f.accel()*(
f.time2()-
f.time1());
P func(int c, EveryApi &ev)
Definition test.cpp:59
SM Any(std::vector< char > alphabet)
Definition Language.hh:1006
Point2d SolveWithFailure(Function< Point2d, float > &func, Point2d tl, Point2d br, bool &b)
Definition Physics.cc:12
Vector SplitToComponent(Vector vec, Vector base)
Definition Physics.cc:4
void error(std::string err, std::string fail_reason)
Definition check.cc:18
Definition compiled_tests.cpp:1189
Definition Physics.hh:170
int Index(float x) const
Definition Physics.hh:172
Definition compiled_tests.cpp:1200
virtual int SizeY() const =0
virtual int SizeX() const =0
virtual C Map(int x, int y) const =0
virtual void Collect(CollectVisitor &vis)=0
Definition GameApi.cc:43596
virtual void HeavyPrepare()=0
CollisionDistanceToPlane(Point u_p, Vector u_x, Vector u_y)
Definition Physics.hh:159
float Index(Point p) const
Definition Physics.hh:161
CombinePositions(Function< float, float > &x, Function< float, float > &y, Function< float, float > &z)
Definition Physics.hh:99
Point Index(float time) const
Definition Physics.hh:102
Definition Equalizer.hh:1122
Definition Physics.hh:354
std::pair< float, float > Index(FloatPair p) const
Definition Physics.hh:356
Definition Physics.hh:362
std::pair< std::pair< float, float >, float > Index(FloatPoint p) const
Definition Physics.hh:364
Definition Physics.hh:539
float time1() const
Definition Physics.hh:545
float time2() const
Definition Physics.hh:546
float mass() const
Definition Physics.hh:542
Force(MomentInTime &time_evo, float t1, float t2)
Definition Physics.hh:541
Definition Equalizer.hh:121
Definition Equalizer.hh:102
Gravity(float g)
Definition Physics.hh:17
Vector Force(Point p) const
Definition Physics.hh:18
Definition Equalizer.hh:158
float time1() const
Definition Physics.hh:559
float time2() const
Definition Physics.hh:560
float mass() const
Definition Physics.hh:556
InvForce(Force &f, float mass2)
Definition Physics.hh:555
Definition Physics.hh:533
virtual Moment mom(float time) const =0
std::pair< A, B > Index(T p) const
Definition Physics.hh:214
PairFunc2(Function< T, A > &f, Function< T, B > &f2)
Definition Physics.hh:213
PairFunc(Function< float, Point > &curve)
Definition Physics.hh:186
std::pair< Point, int > Index(float time) const
Definition Physics.hh:187
Definition VectorTools.hh:350
float Length() const
Definition Physics.hh:143
Vector Speed(float time) const
Definition Physics.hh:135
Point Index(float time) const
Definition Physics.hh:123
PointMovement(PPoint &p, float time_step, float delta)
Definition Physics.hh:120
PosFunc(Function< float, P1 > &f1, Function< float, P2 > &f2)
Definition Physics.hh:245
std::pair< P1, P2 > Index(std::pair< float, float > p) const
Definition Physics.hh:246
Definition Physics.hh:197
A Index(std::pair< A, B > p) const
Definition Physics.hh:199
Definition Physics.hh:204
B Index(std::pair< A, B > p) const
Definition Physics.hh:206
Definition Effect.hh:10156
RenderingEquation(Point ray_p, Vector ray_dir, SurfaceIn3d &surf, Point tl_, Point br_)
Definition Physics.hh:403
Point2d SurfacePos() const
Definition Physics.hh:410
bool Success() const
Definition Physics.hh:421
float RayPos() const
Definition Physics.hh:417
Point InternalPos() const
Definition Physics.hh:409
Definition Physics.hh:388
SurfaceFunction(SurfaceIn3d &surf)
Definition Physics.hh:390
Point Index(std::pair< float, float > p) const
Definition Physics.hh:391
Definition Effect.hh:1880
bool InsideBox(Point2d p, Point2d tl, Point2d br)
Definition Physics.hh:269
SurfacePlaneIntersection(Function< Point2d, float > &surface, float y)
Definition Physics.hh:259
Point2d Step(Point2d p) const
Definition Physics.hh:261
Point2d Loop(Point2d start_pos, Point2d tl, Point2d br, bool &succes)
Definition Physics.hh:277
bool Inside(Point2d p) const
Definition Physics.hh:260
Definition VectorTools.hh:125
float Dist() const
Definition VectorTools.cc:141
float dy
Definition VectorTools.hh:268
float dz
Definition VectorTools.hh:268
float dx
Definition VectorTools.hh:268
Point Loop(Point start_pos, Point tl, Point br, bool &b)
Definition Physics.hh:330
bool Inside(Point p) const
Definition Physics.hh:297
bool InsideBox(Point p, Point tl, Point br)
Definition Physics.hh:320
Point Step(Point p) const
Definition Physics.hh:301
WorldWorldIntersection(Function< Point, float > &f, float t)
Definition Physics.hh:296
float Index(float time) const
Definition Physics.hh:37
XForces(PPoint &pp)
Definition Physics.hh:36
YForces(PPoint &pp)
Definition Physics.hh:57
float Index(float time) const
Definition Physics.hh:58
float Index(float time) const
Definition Physics.hh:79
ZForces(PPoint &pp)
Definition Physics.hh:78
Definition Physics.hh:177
float Index(T t) const
Definition Physics.hh:179
double f(const std::string &, double, bool) noexcept
Definition profile_cpp_calls_2.cpp:4
int f2(char c)
Definition test.cpp:51
Definition Equalizer.hh:952
float y
Definition Equalizer.hh:955
float x
Definition Equalizer.hh:955
Definition Equalizer.hh:978
Point p
Definition Equalizer.hh:1005
Definition Physics.hh:527
Vector v
Definition Physics.hh:529
float mass
Definition Physics.hh:528
virtual Vector Force(Point p) const =0
float time
Definition Physics.hh:28
Point pos
Definition Physics.hh:26
float mass
Definition Physics.hh:29
Vector speed
Definition Physics.hh:27
std::vector< PForce * > vec
Definition Physics.hh:30
Definition VectorTools.hh:910
float x
Definition VectorTools.hh:911
float y
Definition VectorTools.hh:911
float x
Definition Parser.cc:60
float y
Definition Parser.cc:60
float z
Definition Parser.cc:60
Definition VectorTools.hh:972