Ejemplo n.º 1
0
        //Methods//
        public void Build(IModule sourceModule)
        {
            Model.Plane planeModel = new Model.Plane(sourceModule);
            double      xExtent    = UpperXBound - LowerXBound;
            double      zExtent    = UpperZBound - LowerZBound;
            double      xDelta     = xExtent / (double)Map.Width;
            double      zDelta     = zExtent / (double)Map.Height;
            double      xCur       = LowerXBound;
            double      zCur       = LowerZBound;

            for (int z = 0; z < Map.Height; z++)
            {
                xCur = LowerXBound;

                for (int x = 0; x < Map.Width; x++)
                {
                    float finalValue;

                    if (!IsSeamless)
                    {
                        finalValue = (float)planeModel.GetValue(xCur, zCur);
                    }

                    else
                    {
                        double swValue, seValue, nwValue, neValue;
                        swValue = planeModel.GetValue(xCur, zCur);
                        seValue = planeModel.GetValue(xCur + xExtent, zCur);
                        nwValue = planeModel.GetValue(xCur, zCur + zExtent);
                        neValue = planeModel.GetValue(xCur + xExtent, zCur + zExtent);
                        double xBlend = 1.0 - ((xCur - LowerXBound) / xExtent);
                        double zBlend = 1.0 - ((zCur - LowerZBound) / zExtent);
                        double z0     = MathUtils.LinearInterp(swValue, seValue, xBlend);
                        double z1     = MathUtils.LinearInterp(nwValue, neValue, xBlend);
                        finalValue = (float)MathUtils.LinearInterp(z0, z1, zBlend);
                    }

                    Map.SetValue(x, z, finalValue);
                    xCur += xDelta;
                }

                zCur += zDelta;
            }
        }
Ejemplo n.º 2
0
        //Methods//
        public void Build(IModule sourceModule)
        {
            Model.Cylinder cylinderModel = new Model.Cylinder(sourceModule);
            double         angleExtent   = UpperAngleBound - LowerAngleBound;
            double         heightExtent  = UpperHeightBound - LowerHeightBound;
            double         xDelta        = angleExtent / (double)Map.Width;
            double         yDelta        = heightExtent / (double)Map.Height;
            double         curAngle      = LowerAngleBound;
            double         curHeight     = LowerHeightBound;

            for (int y = 0; y < Map.Height; y++)
            {
                curAngle = LowerAngleBound;

                for (int x = 0; x < Map.Width; x++)
                {
                    float curValue = (float)cylinderModel.GetValue(curAngle, curHeight);
                    Map.SetValue(x, y, curValue);
                    curAngle += xDelta;
                }

                curHeight += yDelta;
            }
        }
Ejemplo n.º 3
0
        //Methods//
        public void Build(IModule sourceModule)
        {
            Model.Sphere sphereModel = new Model.Sphere(sourceModule);
            double       lonExtent   = EastLonBound - WestLonBound;
            double       latExtent   = NorthLatBound - SouthLatBound;
            double       xDelta      = lonExtent / (double)Map.Width;
            double       yDelta      = latExtent / (double)Map.Height;
            double       curLon      = WestLonBound;
            double       curLat      = SouthLatBound;

            for (int y = 0; y < Map.Height; y++)
            {
                curLon = WestLonBound;

                for (int x = 0; x < Map.Width; x++)
                {
                    float curValue = (float)sphereModel.GetValue(curLat, curLon);
                    Map.SetValue(x, y, curValue);
                    curLon += xDelta;
                }

                curLat += yDelta;
            }
        }