public static AgcTuple rodrigues(AgcTuple inVector, AgcTuple axis, double angle) { axis = AgcMath.normalize(axis); var outVector = inVector * Math.Cos(angle); outVector += AgcMath.cross(axis, inVector) * Math.Sin(angle); outVector += axis * AgcMath.dot(axis, inVector) * (1 - Math.Cos(angle)); return(outVector); }
public static double orbitInterceptTime(string direction) { var targetInc = Globals.MissionData.Inclination; var targetLan = Globals.MissionData.Lan; if (direction == "nearest") { var timeToNortherly = orbitInterceptTime("north"); var timeToSoutherly = orbitInterceptTime("south"); double time; if (timeToSoutherly < timeToNortherly) { Globals.MissionData.Direction = "south"; time = timeToSoutherly; } else { Globals.MissionData.Direction = "north"; time = timeToNortherly; } return(time); } Globals.CurrentNode = nodeVector(targetInc, direction); AgcTuple targetNode = rodrigues(Globals.VehicleData.getSolarPrimeVector(), new AgcTuple(0, 1, 0), -targetLan); var nodeDelta = AgcMath.angle(Globals.CurrentNode, targetNode); var deltaDir = AgcMath.dot(new AgcTuple(0, 1, 0), AgcMath.cross(targetNode, Globals.CurrentNode)); if (deltaDir < 0) { nodeDelta = 360 - nodeDelta; } var deltatime = Globals.KrpConnection.SpaceCenter().ActiveVessel.Orbit.Body.RotationalPeriod * nodeDelta / 360; return(deltatime); }
public static AgcTuple operator *(AgcTuple left, AgcTuple right) { return(AgcMath.cross(left, right)); }