Rvector6 SpaceObject::GetLastState() { Rvector6 result; Real *st = state.GetState(); result.Set(st[0], st[1], st[2], st[3], st[4], st[5]); return result; }
//------------------------------------------------------------------------------ const Rvector6 BodyFixedPoint::GetMJ2000State(const A1Mjd &atTime) { #ifdef DEBUG_BODYFIXED_STATE MessageInterface::ShowMessage("In GetMJ2000State for BodyFixedPoint %s\n", instanceName.c_str()); #endif UpdateBodyFixedLocation(); Real epoch = atTime.Get(); Rvector6 bfState; // For now I'm ignoring velocity; this assumes bfLocation is kept up-to-date bfState.Set(bfLocation[0], bfLocation[1], bfLocation[2], 0.0, 0.0, 0.0); // Convert from the body-fixed location to a J2000 location, // assuming you have pointer to coordinate systems mj2k and bfcs, // where mj2k is a J2000 system and bfcs is BodyFixed #ifdef DEBUG_BODYFIXED_STATE MessageInterface::ShowMessage("... before call to Convert, epoch = %12.10f\n", epoch); MessageInterface::ShowMessage(" ... bfcs (%s) = %s and mj2kcs (%s) = %s\n", bfcsName.c_str(), (bfcs? "NOT NULL" : "NULL"), mj2kcsName.c_str(), (mj2kcs? "NOT NULL" : "NULL")); MessageInterface::ShowMessage("bf state (in bfcs, cartesian) = %s\n", (bfState.ToString()).c_str()); MessageInterface::ShowMessage("SolarSystem is%s NULL\n", (solarSystem? "NOT " : "")); #endif ccvtr.Convert(epoch, bfState, bfcs, j2000PosVel, mj2kcs); #ifdef DEBUG_BODYFIXED_STATE MessageInterface::ShowMessage("bf state (in mj2kcs, cartesian) = %s\n", (j2000PosVel.ToString()).c_str()); #endif lastStateTime = atTime; lastState = j2000PosVel; return j2000PosVel; }