MathHelper Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Contains commonly used precalculated values.

Inheritance Hierarchy

System.Object
  Microsoft.Xna.Framework.MathHelper

Namespace:  Microsoft.Xna.Framework
Assembly:  Microsoft.Xna.Framework.Math (in Microsoft.Xna.Framework.Math.dll)

Syntax

'Declaration
Public NotInheritable Class MathHelper
public static class MathHelper

The MathHelper type exposes the following members.

Methods

  Name Description
Public methodStatic member Barycentric Returns the Cartesian coordinate for one axis of a point that is defined by a given triangle and two normalized barycentric (areal) coordinates.
Public methodStatic member CatmullRom Performs a Catmull-Rom interpolation using the specified positions.
Public methodStatic member Clamp Restricts a value to be within a specified range.
Public methodStatic member Distance Calculates the absolute value of the difference of two values.
Public methodStatic member Hermite Performs a Hermite spline interpolation.
Public methodStatic member Lerp Linearly interpolates between two values.
Public methodStatic member Max Returns the greater of two values.
Public methodStatic member Min Returns the lesser of two values.
Public methodStatic member SmoothStep Interpolates between two values using a cubic equation.
Public methodStatic member ToDegrees Converts radians to degrees.
Public methodStatic member ToRadians Converts degrees to radians.
Public methodStatic member WrapAngle Reduces a given angle to a value between pi and -pi.

Top

Fields

  Name Description
Public fieldStatic member E Represents the mathematical constant e.
Public fieldStatic member Log10E Represents the log base ten of e.
Public fieldStatic member Log2E Represents the log base two of e.
Public fieldStatic member Pi Represents the value of pi.
Public fieldStatic member PiOver2 Represents the value of pi divided by two.
Public fieldStatic member PiOver4 Represents the value of pi divided by four.
Public fieldStatic member TwoPi Represents the value of pi times two.

Top

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.