Ejemplo n.º 1
0
        public Bounds3(Vector3f p1, Vector3f p2)
        {
            pMin = new Vector3f(Math.Min(p1.X, p2.X), Math.Min(p1.Y, p2.Y), Math.Min(p1.Z, p2.Z));
            pMax = new Vector3f(Math.Max(p1.X, p2.X), Math.Max(p1.Y, p2.Y), Math.Max(p1.Z, p2.Z));

            ExpandMargin();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 交运算
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Bounds3 Intersect(Bounds3 a, Bounds3 b)
 {
     return(new Bounds3(
                new Vector3f(Math.Max(a.pMin.X, b.pMin.X), Math.Max(a.pMin.Y, b.pMin.Y), Math.Max(a.pMin.Z, b.pMin.Z)),
                new Vector3f(Math.Min(a.pMax.X, b.pMax.X), Math.Min(a.pMax.Y, b.pMax.Y), Math.Min(a.pMax.Z, b.pMax.Z))
                ));
 }
Ejemplo n.º 3
0
        internal static void FixMinMaxHeight()
        {
            float minTemp = float.MaxValue;
            float maxTemp = float.MinValue;
            float minRain = float.MaxValue;
            float maxRain = float.MinValue;

            for (int i = 0; i < Biomes.Length; i++)
            {
                var biome = Biomes[i];
                var min   = MathF.Min(biome.MinHeight, biome.MaxHeight);
                var max   = MathF.Max(biome.MinHeight, biome.MaxHeight);

                biome.MinHeight = min;
                biome.MaxHeight = max;

                if (biome.Temperature < minTemp)
                {
                    minTemp = biome.Temperature;
                }
                if (biome.Temperature > maxTemp)
                {
                    maxTemp = biome.Temperature;
                }
                if (biome.Downfall < minRain)
                {
                    minRain = biome.Downfall;
                }
                if (biome.Downfall > maxRain)
                {
                    maxRain = biome.Downfall;
                }

                Biomes[i] = biome;
            }
            Debug.WriteLine($"Temperature (min: {minTemp} max: {maxTemp}) Downfall (min:{minRain} max: {maxRain})");
        }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 public static Half Min(Half x,
                        Half y) =>
 (Half)M.Min(x, y);