本文整理汇总了C#中Vector3D.ort方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3D.ort方法的具体用法?C# Vector3D.ort怎么用?C# Vector3D.ort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3D
的用法示例。
在下文中一共展示了Vector3D.ort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: get_transfer_orientation
private static void get_transfer_orientation(Vector3D x1, Vector3D x2,
ref double i,
ref double Omega,
ref double u)
{
// Radius-vectors orts
DVector3D ex1 = new DVector3D(Convert.ToDecimal(x1.ort().x), Convert.ToDecimal(x1.ort().y), Convert.ToDecimal(x1.ort().z));
DVector3D ex2 = new DVector3D(Convert.ToDecimal(x2.ort().x), Convert.ToDecimal(x2.ort().y), Convert.ToDecimal(x2.ort().z));
// Orbit plane normal
DVector3D en = (ex1 & ex2).ort();
// Orbit inclination
decimal inc = DMath.acos(en.z);
i = Convert.ToDouble(inc) / math.RAD;
// Accenting node longtitude
decimal sin_Omega = en.x / DMath.sin(inc);
decimal cos_Omega = -en.y / DMath.sin(inc);
decimal Omg = DMath.arg(sin_Omega, cos_Omega);
Omega = Convert.ToDouble(Omg) / math.RAD;
// Argument of latitude
decimal sin_u = ex1.z / DMath.sin(inc);
decimal cos_u = (ex1.x + sin_Omega * en.z * sin_u) / cos_Omega;
u = Convert.ToDouble(DMath.arg(Decimal.Round(sin_u, 4), Decimal.Round(cos_u, 4)));
}
示例2: get_orbit
//---------------------------------------------------------------------
// Get orbit by two positions x1 = r(t1), x2 = r(t2)
// r = r(t) - body radius-vector
//---------------------------------------------------------------------
public static bool get_orbit(Vector3D x1,
Vector3D x2,
double t1,
double t2,
double mu,
ref Orbit orbit)
{
// Radius-vectors lenght calculation
r1 = x1.lenght();
r2 = x2.lenght();
// Thue anomalies difference calculation
double dV = x1.angle(x2);
// Distance calculation
Vector3D dx = x1 - x2;
s = dx.lenght();
// Lambert theorem parameter
tau = Math.Sqrt(mu) * (t2 - t1);
// Newton solver input data
double [] x = new double [3]{dV, dV, r1};
double eps = 1e-3;
double [] err = new double [3] { eps, eps, eps };
// Solve Lambert equations
if (!EQs.newton_solver(f, Jacoby, err, ref x))
return false;
orbit.a = x[2];
// Eccentricity calculation
double L = (x[0] - x[1])/2;
double R = (r1 + r2) / 4 / orbit.a;
double P = (r2 - r1) / 2 / orbit.a / Math.Sin(L);
double Q = (1 - 2 * R) / Math.Cos(L);
orbit.e = Math.Sqrt(P * P + Q * Q);
// Eccentric anomalies calculation
double sin_K = P / orbit.e;
double cos_K = Q / orbit.e;
double K = math.arg(sin_K, cos_K);
double E1 = K - L;
double E2 = K + L;
// Mean anomalies calculation
double M1 = E1 - orbit.e * Math.Sin(E1);
double M2 = E2 - orbit.e * Math.Sin(E2);
// Mean anomaly at epoch calculation
double n = (M2 - M1) / (t2 - t1);
double n_test = Math.Sqrt(mu / orbit.a) / orbit.a;
orbit.M0 = math.Trunc2PiN(M1 - n * t1);
if (orbit.M0 < 0)
orbit.M0 = 2 * Math.PI + orbit.M0;
// True anomalies calculation
double sin_V1 = Math.Sqrt(1 - orbit.e * orbit.e) * Math.Sin(E1) / (1 - orbit.e * Math.Cos(E1));
double cos_V1 = (Math.Cos(E1) - orbit.e) / (1 - orbit.e * Math.Cos(E1));
double V1 = math.arg(sin_V1, cos_V1);
double V1_deg = V1 / math.RAD;
double sin_V2 = Math.Sqrt(1 - orbit.e * orbit.e) * Math.Sin(E2) / (1 - orbit.e * Math.Cos(E2));
double cos_V2 = (Math.Cos(E2) - orbit.e) / (1 - orbit.e * Math.Cos(E2));
double V2 = math.arg(sin_V2, cos_V2);
double V2_deg = V2 / math.RAD;
// Orbit orientation calculation (high accuracity!!!)
// Radius-vectors orts
DVector3D ex1 = new DVector3D(Convert.ToDecimal(x1.ort().x), Convert.ToDecimal(x1.ort().y), Convert.ToDecimal(x1.ort().z));
DVector3D ex2 = new DVector3D(Convert.ToDecimal(x2.ort().x), Convert.ToDecimal(x2.ort().y), Convert.ToDecimal(x2.ort().z));
// Orbit plane normal
DVector3D en = (ex1 & ex2).ort();
// Orbit inclination
decimal i = DMath.acos(en.z);
orbit.i = Convert.ToDouble(i) / math.RAD;
// Accenting node longtitude
decimal sin_Omega = en.x / DMath.sin(i);
decimal cos_Omega = -en.y / DMath.sin(i);
decimal Omega = DMath.arg(sin_Omega, cos_Omega);
orbit.Omega = Convert.ToDouble(Omega) / math.RAD;
//.........这里部分代码省略.........