Пример #1
0
        public void Recreate(TerrainInfo info, float [,] altInMetres)
        {
            this.Info = info;
            CheckGridSize(altInMetres);
            Vector3 refr = new Vector3(info.CentreLatLong);
            Vector3 refe = EarthConverter.LatLongAltToECEF(refr);

            CreateVerticesFromFloats(altInMetres, refr, refe);
            Normals = NormalModel.CalculateNormals(this);
        }
Пример #2
0
        public void Recreate(Vector3[,] lla, Vector2 CentrePoint)
        {
            double dxSum = 0;
            double dzSum = 0;

            for (int i = 1; i < lla.GetLength(0); i++)
            {
                dxSum = dxSum + lla[i, 0].X - lla[i - 1, 0].X;
            }
            for (int i = 1; i < lla.GetLength(1); i++)
            {
                dzSum = dzSum + lla[0, i].Y - lla[0, i - 1].Y;
            }
            double dLat  = dxSum / (lla.GetLength(0) - 1);
            double dLong = dzSum / (lla.GetLength(1) - 1);

            this.Info = new TerrainInfo()
            {
                DegreesLatitudePerPixel  = dLat,
                DegreesLongitudePerPixel = dLong,
                SouthWestLatLong         = lla[0, 0].Xy,
                NorthEastLatLong         = lla[lla.GetLength(0) - 1, lla.GetLength(1) - 1].Xy + new Vector2((float)dLat, (float)dLong)
            };
            CheckGridSize(lla);
            Vector3 refr = new Vector3(CentrePoint);

            if (CentrePoint.X < -90)
            {
                refr = new Vector3(Info.CentreLatLong);
            }

            Vector3 refe = EarthConverter.LatLongAltToECEF(refr);

            CreateVerticesFromVectors(lla, refr, refe);
            Normals = NormalModel.CalculateNormals(this);
        }