diff --git a/PoC/PoC/mainobserver.cpp b/PoC/PoC/mainobserver.cpp index 448042a9abe7b054d07e63eb13b319fec4139333..0913a568fc05889cb3378ccc00c966e245f6d4a0 100644 --- a/PoC/PoC/mainobserver.cpp +++ b/PoC/PoC/mainobserver.cpp @@ -56,6 +56,7 @@ namespace flatland { double propertime; double currentvelocity; int currentproperacceleration; + char name; auto changestate(double maintime) -> void @@ -88,10 +89,46 @@ namespace flatland { if (std::get<0>(objectstate) == INERTIAL) { - auto lightconeeq = std::vector<double>{ 1.0, mainobserver->currenttime - std::get<1>(mainobserver->objectlist[0]) }; + auto lightconeeq1 = std::vector<double>{ LIGHTSPEED, mainobserver->currenttime - std::get<1>(mainobserver->objectlist[0]) }; + auto lightconeeq2 = std::vector<double>{ -LIGHTSPEED, mainobserver->currenttime - std::get<1>(mainobserver->objectlist[0]) }; + auto worldlineeq = std::vector<double>{ mainrelativevelocity, mainclocktimeatstatechange - maincoordinatelocationatstatechange}; + + auto intersection1 = std::vector<double>{ + (lightconeeq1[0] * worldlineeq[1] - worldlineeq[0] * lightconeeq1[1]) / (lightconeeq1[0] - worldlineeq[0]), + (worldlineeq[1] - lightconeeq1[1])/(lightconeeq1[0]-worldlineeq[0]), + }; + auto intersection2 = std::vector<double>{ + (lightconeeq2[0] * worldlineeq[1] - worldlineeq[0] * lightconeeq2[1]) / (lightconeeq2[0] - worldlineeq[0]), + (worldlineeq[1] - lightconeeq2[1]) / (lightconeeq2[0] - worldlineeq[0]), + }; + + if (mainclocktimeatstatechange < intersection1[0] && intersection1[0] < mainobserver->currenttime) + { + intersection1 = std::vector<double>{intersection1[0] - mainobserver->currenttime, intersection1[1] - std::get<1>(mainobserver->objectlist[0]) }; + intersection1 = LORENTZ_BOOST(-currentvelocity)*intersection1; + + if (-40.0 < intersection1[1] && intersection1[1] < 40.0) + { + pastlightcone[(int)round(intersection1[1])] = name; + } + } + if (mainclocktimeatstatechange < intersection2[0] && intersection2[0] < mainobserver->currenttime) + { + intersection2 = std::vector<double>{ intersection2[0] - mainobserver->currenttime, intersection2[1] - std::get<1>(mainobserver->objectlist[0]) }; + intersection2 = LORENTZ_BOOST(-currentvelocity)*intersection2; + + if (-40.0 < intersection2[1] && intersection2[1] < 40.0) + { + pastlightcone[(int)round(intersection2[1])] = name; + } + } } else { + auto lightconeeq1 = std::vector<double>{ LIGHTSPEED, mainobserver->currenttime - std::get<1>(mainobserver->objectlist[0]) }; + auto lightconeeq2 = std::vector<double>{ -LIGHTSPEED, mainobserver->currenttime - std::get<1>(mainobserver->objectlist[0]) }; + + } }