C# Class Box2D.Common.MathUtils

A few math methods that don't fit very well anywhere else.
Afficher le fichier Open project: gerich-home/box2dnet

Méthodes publiques

Свойство Type Description
DEG2_RAD float
HALF_PI float
INV_PI float
PI float
QUATER_PI float
RAD2_DEG float
THREE_HALVES_PI float
TWO_PI float

Méthodes publiques

Méthode Description
Abs ( float x ) : float
Abs ( int x ) : int
Atan2 ( float y, float x ) : float
Ceil ( float x ) : int
CeilPowerOf2 ( int x ) : int

Rounds up the value to the nearest higher power^2 value.

Clamp ( Vec2 a, Vec2 low, Vec2 high ) : Vec2
Clamp ( float a, float low, float high ) : float

Returns the closest value to 'a' that is in between 'low' and 'high'

ClampToOut ( Vec2 a, Vec2 low, Vec2 high, Vec2 dest ) : void
Cos ( float x ) : float
Distance ( Vec2 v1, Vec2 v2 ) : float
DistanceSquared ( Vec2 v1, Vec2 v2 ) : float
FastAtan2 ( float y, float x ) : float
FastPow ( float a, float b ) : float
Floor ( float x ) : int
IsPowerOfTwo ( int x ) : bool
Map ( float val, float fromMin, float fromMax, float toMin, float toMax ) : float
Max ( float a, float b ) : float
Max ( int a, int b ) : int
Min ( float a, float b ) : float
Min ( int a, int b ) : int
NextPowerOfTwo ( int x ) : int

Next Largest Power of 2: Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next largest power of 2.

Pow ( float a, float b ) : float

Computes a fast approximation to Math.pow(a, b). Adapted from http://www.dctsystems.co.uk/Software/power.html.

RandomFloat ( Random r, float argLow, float argHigh ) : float
RandomFloat ( float argLow, float argHigh ) : float
ReduceAngle ( float theta ) : float
Round ( float x ) : int
Sin ( float x ) : float
SinLut ( float x ) : float
Sqrt ( float x ) : float

Private Methods

Méthode Description
FloatToIntBits ( float number ) : int
MathUtils ( ) : System

Method Details

Abs() public static méthode

public static Abs ( float x ) : float
x float
Résultat float

Abs() public static méthode

public static Abs ( int x ) : int
x int
Résultat int

Atan2() public static méthode

public static Atan2 ( float y, float x ) : float
y float
x float
Résultat float

Ceil() public static méthode

public static Ceil ( float x ) : int
x float
Résultat int

CeilPowerOf2() public static méthode

Rounds up the value to the nearest higher power^2 value.
public static CeilPowerOf2 ( int x ) : int
x int
Résultat int

Clamp() public static méthode

public static Clamp ( Vec2 a, Vec2 low, Vec2 high ) : Vec2
a Vec2
low Vec2
high Vec2
Résultat Vec2

Clamp() public static méthode

Returns the closest value to 'a' that is in between 'low' and 'high'
public static Clamp ( float a, float low, float high ) : float
a float
low float
high float
Résultat float

ClampToOut() public static méthode

public static ClampToOut ( Vec2 a, Vec2 low, Vec2 high, Vec2 dest ) : void
a Vec2
low Vec2
high Vec2
dest Vec2
Résultat void

Cos() public static méthode

public static Cos ( float x ) : float
x float
Résultat float

Distance() public static méthode

public static Distance ( Vec2 v1, Vec2 v2 ) : float
v1 Vec2
v2 Vec2
Résultat float

DistanceSquared() public static méthode

public static DistanceSquared ( Vec2 v1, Vec2 v2 ) : float
v1 Vec2
v2 Vec2
Résultat float

FastAtan2() public static méthode

public static FastAtan2 ( float y, float x ) : float
y float
x float
Résultat float

FastPow() public static méthode

public static FastPow ( float a, float b ) : float
a float
b float
Résultat float

Floor() public static méthode

public static Floor ( float x ) : int
x float
Résultat int

IsPowerOfTwo() public static méthode

public static IsPowerOfTwo ( int x ) : bool
x int
Résultat bool

Map() public static méthode

public static Map ( float val, float fromMin, float fromMax, float toMin, float toMax ) : float
val float
fromMin float
fromMax float
toMin float
toMax float
Résultat float

Max() public static méthode

public static Max ( float a, float b ) : float
a float
b float
Résultat float

Max() public static méthode

public static Max ( int a, int b ) : int
a int
b int
Résultat int

Min() public static méthode

public static Min ( float a, float b ) : float
a float
b float
Résultat float

Min() public static méthode

public static Min ( int a, int b ) : int
a int
b int
Résultat int

NextPowerOfTwo() public static méthode

Next Largest Power of 2: Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next largest power of 2.
public static NextPowerOfTwo ( int x ) : int
x int
Résultat int

Pow() public static méthode

Computes a fast approximation to Math.pow(a, b). Adapted from http://www.dctsystems.co.uk/Software/power.html.
public static Pow ( float a, float b ) : float
a float a positive number
b float a number
Résultat float

RandomFloat() public static méthode

public static RandomFloat ( Random r, float argLow, float argHigh ) : float
r System.Random
argLow float
argHigh float
Résultat float

RandomFloat() public static méthode

public static RandomFloat ( float argLow, float argHigh ) : float
argLow float
argHigh float
Résultat float

ReduceAngle() public static méthode

public static ReduceAngle ( float theta ) : float
theta float
Résultat float

Round() public static méthode

public static Round ( float x ) : int
x float
Résultat int

Sin() public static méthode

public static Sin ( float x ) : float
x float
Résultat float

SinLut() public static méthode

public static SinLut ( float x ) : float
x float
Résultat float

Sqrt() public static méthode

public static Sqrt ( float x ) : float
x float
Résultat float

Property Details

DEG2_RAD public_oe static_oe property

Degrees to radians conversion factor
public static float DEG2_RAD
Résultat float

HALF_PI public_oe static_oe property

public static float HALF_PI
Résultat float

INV_PI public_oe static_oe property

public static float INV_PI
Résultat float

PI public_oe static_oe property

public static float PI
Résultat float

QUATER_PI public_oe static_oe property

public static float QUATER_PI
Résultat float

RAD2_DEG public_oe static_oe property

Radians to degrees conversion factor
public static float RAD2_DEG
Résultat float

THREE_HALVES_PI public_oe static_oe property

public static float THREE_HALVES_PI
Résultat float

TWO_PI public_oe static_oe property

public static float TWO_PI
Résultat float