TaxosDevloper 2025. 3. 23. 15:16
template <typename C, typename mapC = C::map_t>
union mapible{
	C v;
	mapC mapr;
	template <C x, mapible V = (mapible) x>
	using ing = V;
	template <mapC x, mapible V = (mapible) x>
	using ing = V;
};

template <typename C, typename M = C::map_t>
class GravFrame_c {
	protected:
		union {
			C coordinate;
			M mapible_coordinate;
		};
};

template <typename C, typename R, R G, typename F = GravFrame<C, R>*>
class GravObj;

template <typename C, typename R>
class GravFrame : GravFrame_c<C> {
	protected:
		R GmM;
		
		friend class GravObj;
};

using t3 = std::conditional;

template <typename C, typename R, bool p = false, typename B = t3<p, GravFrame<C, R>, GravFrame_c<C>>, typename M = C::map_t>
class BaseObj {
	protected:
		union {
			C v;
			M mapible_v;
		};
		union {
			C vectorized_E;
			M mapible_E;
		};
		union {
			C vectorized_R;
			M mapible_R;
		};
		R twice_of_m;
		R m;
		final inline void refrash(void) {
			this->refrash_c(this->mapible_E / (this -> twice_of_m * this->mapible_R), this->mapible_v);
		}
		final inline void set_twice_of_m(void) {
			this->twice_of_m = this->m * 2;
		}
	private:
		final inline void refrash_c(M half_a, M v_reg) {
			v_reg += half_a;
			this->mapible_coordinate += v_reg;
			v_reg += half_a;
			this->mapible_v = v_reg;
		}
};

template <typename C, typename R, R G, typename F>
class GravObj : protected BaseObj<C, R, true> {
	private:
		R Gm;
		final inline void setGm(void) {
			this->Gm = this->M * G;
		}
		final inline F F_G_c(R M) {
			this->GmM = this->Gm * M;
			return (F) &this;
		}
		final inline void grav_work_c(R s, C v) {
			this->vecterized_R += v;
			this->mapible_E += s / mapible::ing<v>.mapr
		}
	protected:
		final inline C grav_work(F other) {
			this->grav_work_c(other->GmM, other->coordinate - this->coordinate);
			return this->coordinate;
		} //it's constanly ret.... ummm
		final inline void grav_work(C other_coordinate) {
			this->grav_work_c(this->GmM, other_coordinate - this->coordinate);
		}
};