Beispiel #1
0
    /// <summary>
    /// Draw a single RelativisticObject to the screen.
    /// </summary>
    /// <param name="ro">The RelativisticObject to draw.</param>
    /// <param name="issilver">Whether that object should be silver I guess</param>
    /// <remarks>
    /// What? You want to choose a color? Get off my lawn!
    /// </remarks>
    private void DrawRelativisticObject(CoordinateEngine.RelativisticObject ro, bool issilver = true)
    {
        double x;
        double y;
        double z;

        if (SHOULD_LORENTZ_TRANSFORM_IMAGE)
        {
            double[] apparent_position = CoordinateEngine.ApparentPosition(ro.x, universe.bro.x, universe.bro.v);
            x = apparent_position[_x];
            y = apparent_position[_y];
            z = apparent_position[_z];
        }
        else
        {
            x = ro.x[_x];
            y = ro.x[_y];
            z = ro.x[_z];
        }

        //double size = .01*Math.Sqrt (CoordinateEngine.RMS(universe.bro.x));
        double size = 0.042; //Diameter of the Earth if t=seconds

        size /= 2;           //Turns size into the side length of the cube

        GL.Begin(BeginMode.Quads);
        if (issilver)
        {
            GL.Color3(ArbitraryRedshiftBasedColor(ro, universe.bro));
        }
        else
        {
            GL.Color3(Color.Blue);
        }

        // front
        GL.Vertex3(x - size, y - size, z + size);
        GL.Vertex3(x - size, y + size, z + size);
        GL.Vertex3(x + size, y + size, z + size);
        GL.Vertex3(x + size, y - size, z + size);

        // right
        GL.Vertex3(x + size, y - size, z + size);
        GL.Vertex3(x + size, y + size, z + size);
        GL.Vertex3(x + size, y + size, z - size);
        GL.Vertex3(x + size, y - size, z - size);

        // bottom
        GL.Vertex3(x + size, y - size, z - size);
        GL.Vertex3(x + size, y - size, z + size);
        GL.Vertex3(x - size, y - size, z + size);
        GL.Vertex3(x - size, y - size, z - size);

        // left
        GL.Vertex3(x - size, y - size, z - size);
        GL.Vertex3(x - size, y - size, z + size);
        GL.Vertex3(x - size, y + size, z + size);
        GL.Vertex3(x - size, y + size, z - size);

        // top
        GL.Vertex3(x - size, y + size, z - size);
        GL.Vertex3(x - size, y + size, z + size);
        GL.Vertex3(x + size, y + size, z + size);
        GL.Vertex3(x + size, y + size, z - size);

        // back
        GL.Vertex3(x + size, y + size, z - size);
        GL.Vertex3(x + size, y - size, z - size);
        GL.Vertex3(x - size, y - size, z - size);
        GL.Vertex3(x - size, y + size, z - size);

        GL.End();
    }