UnityEngine.Mathf.Floor C# (CSharp) 메소드

Floor() 공개 정적인 메소드

public static Floor ( float f ) : float
f float
리턴 float
        public static float Floor(float f)
        {
            return (float)Math.Floor(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::Floor