/** * @brief Returns a {@link FP} between a min value [inclusive] and a max value [inclusive]. **/ public FP Next(float minValue, float maxValue) { int minValueInt = (int)(minValue * 1000), maxValueInt = (int)(maxValue * 1000); if (minValueInt > maxValueInt) { int tmp = maxValueInt; maxValueInt = minValueInt; minValueInt = tmp; } return((FP.Floor((maxValueInt - minValueInt + 1) * NextFP() + minValueInt)) / 1000); }
public FP Next(float minValue, float maxValue) { int num = (int)(minValue * 1000f); int num2 = (int)(maxValue * 1000f); bool flag = num > num2; if (flag) { int num3 = num2; num2 = num; num = num3; } return(FP.Floor((num2 - num + 1) * this.NextFP() + num) / 1000); }
public override int Prepare(ref TSBBox box) { bool flag = box.min.x < this.boundings.min.x; if (flag) { this.minX = 0; } else { this.minX = (int)((long)FP.Floor((box.min.x - this.sphericalExpansion) / this.scaleX)); this.minX = (int)((long)TSMath.Max(this.minX, 0)); } bool flag2 = box.max.x > this.boundings.max.x; if (flag2) { this.maxX = this.heightsLength0 - 1; } else { this.maxX = (int)((long)FP.Ceiling((box.max.x + this.sphericalExpansion) / this.scaleX)); this.maxX = (int)((long)TSMath.Min(this.maxX, this.heightsLength0 - 1)); } bool flag3 = box.min.z < this.boundings.min.z; if (flag3) { this.minZ = 0; } else { this.minZ = (int)((long)FP.Floor((box.min.z - this.sphericalExpansion) / this.scaleZ)); this.minZ = (int)((long)TSMath.Max(this.minZ, 0)); } bool flag4 = box.max.z > this.boundings.max.z; if (flag4) { this.maxZ = this.heightsLength1 - 1; } else { this.maxZ = (int)((long)FP.Ceiling((box.max.z + this.sphericalExpansion) / this.scaleZ)); this.maxZ = (int)((long)TSMath.Min(this.maxZ, this.heightsLength1 - 1)); } this.numX = this.maxX - this.minX; this.numZ = this.maxZ - this.minZ; return(this.numX * this.numZ * 2); }
/// <summary> /// Returns the largest integer less than or equal to the specified number. /// </summary> public static FP Floor(FP value) { return(FP.Floor(value)); }
public static FP Floor(FP i_Value) { return(FP.Floor(i_Value)); }