UnityEngine.Mathf.Ceil C# (CSharp) Method

Ceil() public static method

public static Ceil ( float f ) : float
f float
return float
        public static float Ceil(float f)
        {
            return (float)Math.Ceiling(f);
        }

Usage Example

コード例 #1
0
ファイル: NoiseAlgos.cs プロジェクト: heyx3/TreeGen
    /// <summary>
    /// Works like GridNoise(), but allows for interpolation instead of hard jumps between values.
    /// </summary>
    public static float InterpolateNoise(Vector3 seed, Func <Vector3, Vector3> tModifier)
    {
        //Get the integer values behind and in front of the seed values.
        float minX = Mathf.Floor(seed.x),
              maxX = Mathf.Ceil(seed.x),
              minY = Mathf.Floor(seed.y),
              maxY = Mathf.Ceil(seed.y),
              minZ = Mathf.Floor(seed.z),
              maxZ = Mathf.Ceil(seed.z);

        //Get the interpolant (will be linear if nothing is done to modify it).
        Vector3 lerp = tModifier(seed - new Vector3(minX, minY, minZ));

        return(Mathf.Lerp(Mathf.Lerp(Mathf.Lerp(WhiteNoise(new Vector3(minX, minY, minZ)),
                                                WhiteNoise(new Vector3(maxX, minY, minZ)),
                                                lerp.x),
                                     Mathf.Lerp(WhiteNoise(new Vector3(minX, maxY, minZ)),
                                                WhiteNoise(new Vector3(maxX, maxY, minZ)),
                                                lerp.x),
                                     lerp.y),
                          Mathf.Lerp(Mathf.Lerp(WhiteNoise(new Vector3(minX, minY, maxZ)),
                                                WhiteNoise(new Vector3(maxX, minY, maxZ)),
                                                lerp.x),
                                     Mathf.Lerp(WhiteNoise(new Vector3(minX, maxY, maxZ)),
                                                WhiteNoise(new Vector3(maxX, maxY, maxZ)),
                                                lerp.x),
                                     lerp.y),
                          lerp.z));
    }
All Usage Examples Of UnityEngine.Mathf::Ceil