예제 #1
0
        // from https://cesiumjs.org/2013/05/09/Computing-the-horizon-occlusion-point/
        public static Vector3 FromPoints(ref Vector3[] points, BBSphere boundingSphere)
        {
            if (points.Length < 1)
            {
                throw new ArgumentException("Your list of points must contain at least 2 points");
            }

            // Bring coordinates to ellipsoid scaled coordinates
            for (int i = 0; i < points.Length; i++)
            {
                points[i].X = points[i].X * rX;
                points[i].Y = points[i].Y * rY;
                points[i].Z = points[i].Z * rZ;
            }

            boundingSphere.Center.X = boundingSphere.Center.X * rX;
            boundingSphere.Center.Y = boundingSphere.Center.Y * rY;
            boundingSphere.Center.Z = boundingSphere.Center.Z * rZ;

            Double maxMagnitude = double.NegativeInfinity;

            for (int i = 0; i < points.Length; i++)
            {
                //magnitudes.Add(ComputeMagnitude(points[i], boundingSphere.Center));
                var magnitude = ComputeMagnitude(points[i], boundingSphere.Center);
                if (magnitude > maxMagnitude)
                {
                    maxMagnitude = magnitude;
                }
            }

            return(Cartesian3D.MultiplyByScalar(boundingSphere.Center, maxMagnitude));
        }
예제 #2
0
 public TileInfo()
 {
     BoundingSphere = new BBSphere();
 }