using System; using System.Collections.Generic; using System.Text; namespace RungeKutta { public struct State { public float position, velocity, acceleration; public float prevPos, prevVel, prevAccel; public static State operator * (State lhs, float num) { State newState = new State(); newState.position = lhs.position * num; newState.velocity = lhs.velocity * num; newState.acceleration = lhs.acceleration * num; newState.prevPos = lhs.prevPos * num; newState.prevVel = lhs.prevVel * num; newState.prevAccel = lhs.prevAccel * num; return newState; } public static State operator + (State lhs, State other) { State newState = new State(); newState.position = (lhs.position + other.position); newState.velocity = (lhs.velocity + other.velocity); newState.acceleration = (lhs.acceleration + other.acceleration); newState.prevPos = (lhs.prevPos + other.prevPos); newState.prevVel = (lhs.prevVel + other.prevVel); newState.prevAccel = (lhs.prevAccel + other.prevAccel); return newState; } } }