Exemplo n.º 1
0
        internal EllipsoidVisual3D(Ellipsoid ellipsoid, double pointRadius, double scaleFactor)
        {
            Requires.NotNull(ellipsoid, "ellipsoid");
            /* Generates ellipsoid using spherical coordinates (r, θ, φ) where 0 ≤ θ ≤ π, 0 ≤ φ ≤ 2π. */
            var points = new Point3D[GraticuleSpacingθ + 1, GraticuleSpacingφ + 1];

            for (var it = 0; it <= GraticuleSpacingθ; ++it)
            {
                for (var ip = 0; ip <= GraticuleSpacingφ; ++ip)
                {
                    points[it, ip]    = ellipsoid.GetSurfacePoint(it * Dθ, ip * Dφ);
                    points[it, ip].X *= scaleFactor;
                    points[it, ip].Y *= scaleFactor;
                    points[it, ip].Z *= scaleFactor;
                }
            }
            BuildLatitudeLines(points, GraticuleSpacingθ + 1, GraticuleSpacingφ + 1);
            BuildLongitudeLines(points, GraticuleSpacingθ + 1, GraticuleSpacingφ + 1);
            BuildPoint(ellipsoid.Center, pointRadius, scaleFactor);
            foreach (var pole in ellipsoid.Poles)
            {
                BuildPoint(pole, pointRadius, scaleFactor);
            }
        }