public static List <StarMoved> GetAngledStars(IPointObject obj, double angle) { var stars = new List <StarMoved>(); double sin = Math.Sin(angle); double cos = Math.Cos(angle); foreach (Star origStar in RendererHelper.GetStars(obj)) { var star = new StarMoved( radius: origStar.radius, exitance: origStar.exitance, x: origStar.center.x, y: origStar.center.y * cos - origStar.center.z * sin, z: -origStar.center.y * sin - origStar.center.z * cos ); stars.Add(star); } return(stars); }
private Bitmap MakeRenderBitmap() { Color[] palette = new Color[256]; for (int i = 0; i < palette.Length; i++) { palette[i] = Color.FromArgb(i, i, i); } double max = double.NegativeInfinity; foreach (var star in RendererHelper.GetStars(root)) { if (star.exitance > max) { max = star.exitance; } } DistPoint[,] tmpDists = LockDists(); max /= 9; Bitmap bmp = new Bitmap(pictureBox2.Width, pictureBox2.Height); for (int yy = 0; yy < pictureBox2.Height; yy++) { for (int xx = 0; xx < pictureBox2.Width; xx++) { double br = tmpDists[xx, yy].brightness / max; int color = (int)(Math.Log10(1 + br) * 250); if (color > 255) { color = 255; } bmp.SetPixel(xx, yy, palette[color]); } } return(bmp); }