Files
wg_cpso/CaeGlobals/Octree/Data/MathExtensions.cs

32 lines
979 B
C#
Raw Permalink Normal View History

2026-03-25 18:20:24 +08:00
// <copyright file="MathExtensions.cs">
// Distributed under the BSD Licence (see LICENCE file).
//
// Copyright (c) 2014, Nition, http://www.momentstudio.co.nz/
// Copyright (c) 2017, Máté Cserép, http://codenet.hu
// All rights reserved.
// </copyright>
namespace Octree
{
/// <summary>
/// Auxiliary mathematical functions.
/// </summary>
public static class MathExtensions
{
/// <summary>
/// Clamps a value between a minimum and maximum value.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="min">The minimum.</param>
/// <param name="max">The maximum.</param>
/// <returns>The clamped value.</returns>
public static double Clamp(double value, double min, double max)
{
if (value < min)
return min;
if (value > max)
return max;
return value;
}
}
}