/// <summary> /// Set the sun's position. /// </summary> private void SetSun() { SunCalculation.GetSunCalculation(-9, 48, out double azimut, out double h); Vector3D v = SphericalCoordinatesToCartesic(1, 9, 48); Vector3D sun_vec = v + SphericalCoordinatesToCartesic(23481.4, -azimut, h); MainModel3Dgroup.Children.Add(new GeometryModel3D(AddSmoothSphere(new Point3D(sun_vec.X, sun_vec.Y, sun_vec.Z), 109.16, 180, 360), new DiffuseMaterial(Brushes.Yellow))); PointLight pointLight = new PointLight(Colors.LightYellow, new Point3D(sun_vec.X, sun_vec.Y, sun_vec.Z)) { Range = 50000 }; MainModel3Dgroup.Children.Add(pointLight); SpotLight spotLight = new SpotLight(Colors.LightYellow, new Point3D(v.X, v.Y, v.Z), SphericalCoordinatesToCartesic(23481.4, -azimut, h), 50, 50); MainModel3Dgroup.Children.Add(spotLight); }
/// <summary> /// Set the sun's position. /// </summary> /// <param name="longitude"></param> /// <param name="latitude"></param> private void SetSun(double longitude, double latitude) { SunCalculation.GetSunCalculation(longitude, latitude, out double azimut, out double h); Vector3D v = SphericalCoordinatesToCartesic(r_e, -longitude, latitude); Vector3D sun_vec = v + SphericalCoordinatesToCartesic(23481.4 * r_e, -azimut, h); MainModel3Dgroup.Children.Add(new GeometryModel3D(AddSmoothSphere(new Point3D(sun_vec.X, sun_vec.Y, sun_vec.Z), 109.16 * r_e, 180, 360), new EmissiveMaterial(Brushes.LightYellow))); PointLight pointLight = new PointLight(Colors.LightYellow, new Point3D(sun_vec.X, sun_vec.Y, sun_vec.Z)) { Range = 50000 * r_e }; MainModel3Dgroup.Children.Add(pointLight); SpotLight spotLight = new SpotLight(Colors.LightYellow, new Point3D(v.X, v.Y, v.Z), SphericalCoordinatesToCartesic(23481.4, -azimut, h), 50, 50) { Range = r_e * 50000 }; MainModel3Dgroup.Children.Add(spotLight); }