/// <summary> /// Distance to another. /// </summary> public double Distance(C3DPoint Other) { double dx = x - Other.x; double dy = y - Other.y; double dz = z - Other.z; return Math.Sqrt( dx*dx + dy * dy + dz * dz); }
/// <summary> /// Distance to another. /// </summary> public double Distance(C3DPoint Other) { double dx = x - Other.x; double dy = y - Other.y; double dz = z - Other.z; return(Math.Sqrt(dx * dx + dy * dy + dz * dz)); }
/// <summary> /// Slant Range. /// </summary> public double SlantRange(CGeoLatLong Other) { C3DPoint ptThis = new C3DPoint(); Geocentric(ptThis); C3DPoint ptOther = new C3DPoint(); Other.Geocentric(ptOther); return(ptThis.Distance(ptOther)); }
/// <summary> /// Conversion to geocentric. /// </summary> public void Geocentric(C3DPoint xyzPoint) { if (!IsValid()) { return; } double Sin_Lat = Math.Sin(m_dLat); // Math.Sin(Latitude) double Cos_Lat = Math.Cos(m_dLat); // Math.Cos(Latitude) xyzPoint.x = (Constants.conEARTH_RADIUS_METRES) * Cos_Lat * Math.Cos(m_dLong); xyzPoint.y = (Constants.conEARTH_RADIUS_METRES) * Cos_Lat * Math.Sin(m_dLong); xyzPoint.z = (Constants.conEARTH_RADIUS_METRES) * Sin_Lat; return; }
/// <summary> /// Conversion to geocentric. /// </summary> public void GeocentricWSG84(C3DPoint xyzPoint) { if (!IsValid()) { return; } double Sin_Lat = Math.Sin(m_dLat); // Math.Sin(Latitude) double Cos_Lat = Math.Cos(m_dLat); // Math.Cos(Latitude) double Sin2_Lat = Sin_Lat * Sin_Lat; // Square of Math.Sin(Latitude) double Rn = Constants.conGeocent_Major / (Math.Sqrt(1.0e0 - Constants.conGeocent_e2 * Sin2_Lat)); // Earth radius at location xyzPoint.x = Rn * Cos_Lat * Math.Cos(m_dLong); xyzPoint.y = Rn * Cos_Lat * Math.Sin(m_dLong); xyzPoint.z = (Rn * (1 - Constants.conGeocent_e2)) * Sin_Lat; return; }
/// <summary> /// Slant Range. /// </summary> public double SlantRangeWSG84(CGeoLatLong Other) { C3DPoint ptThis = new C3DPoint(); GeocentricWSG84(ptThis); C3DPoint ptOther = new C3DPoint(); Other.GeocentricWSG84(ptOther); return ptThis.Distance(ptOther); }
/// <summary> /// Conversion to geocentric. /// </summary> public void GeocentricWSG84(C3DPoint xyzPoint) { if(!IsValid()) return; double Sin_Lat = Math.Sin(m_dLat); // Math.Sin(Latitude) double Cos_Lat = Math.Cos(m_dLat); // Math.Cos(Latitude) double Sin2_Lat = Sin_Lat * Sin_Lat; // Square of Math.Sin(Latitude) double Rn = Constants.conGeocent_Major / (Math.Sqrt(1.0e0 - Constants.conGeocent_e2 * Sin2_Lat)); // Earth radius at location xyzPoint.x = Rn * Cos_Lat * Math.Cos(m_dLong); xyzPoint.y = Rn * Cos_Lat * Math.Sin(m_dLong); xyzPoint.z = (Rn * (1 - Constants.conGeocent_e2)) * Sin_Lat; return; }
/// <summary> /// Conversion to geocentric. /// </summary> public void Geocentric(C3DPoint xyzPoint) { if(!IsValid()) return; double Sin_Lat = Math.Sin(m_dLat); // Math.Sin(Latitude) double Cos_Lat = Math.Cos(m_dLat); // Math.Cos(Latitude) xyzPoint.x = (Constants.conEARTH_RADIUS_METRES) * Cos_Lat * Math.Cos(m_dLong); xyzPoint.y = (Constants.conEARTH_RADIUS_METRES) * Cos_Lat * Math.Sin(m_dLong); xyzPoint.z = (Constants.conEARTH_RADIUS_METRES) * Sin_Lat; return; }