#include "bigfloat.h" #include "ringforce.h" struct BigPoint { void Init(const BigFloat& x, const BigFloat& y, const BigFloat& z) { _x.Copy(x); _y.Copy(y); _z.Copy(z); } void Copy(BigPoint p) { Init(p._x, p._y, p._z); } void Sub(BigPoint p) { _x.Sub(p._x); _y.Sub(p._y); _z.Sub(p._z); } BigFloat Distance(BigPoint p) { BigFloat d; BigFloat t; d.Add(t.Copy(_x).Sub(p._x).Mult(t)); d.Add(t.Copy(_y).Sub(p._y).Mult(t)); d.Add(t.Copy(_z).Sub(p._z).Mult(t)); return d.Sqrt(); } void Show() { printf("%.18g %.18g %.18g", _x.ToDouble(), _y.ToDouble(), _z.ToDouble()); } BigFloat _x; BigFloat _y; BigFloat _z; }; class BigRing { public: // build a ring passing through p, in the (x,y) plane and z=0, mass 1, with nMoons moons in it BigRing(s8 nMoons, bool odd, BigPoint p) { _nMoons = nMoons; _odd = odd; _ring = new BigPoint[_nMoons]; BigFloat x2(p._x); x2.Mult(p._x); BigFloat y2(p._y); y2.Mult(p._y); BigFloat scale(x2); scale.Add(y2); scale.Sqrt(); // make all the points for a ring of for (s8 i=0; i