Click or drag to resize
Ab4d.SharpEngine logo

MathUtils Class

Inheritance Hierarchy
SystemObject
  Ab4d.SharpEngine.UtilitiesMathUtils

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 1.0.8740+deb2991acfe86a95cca780cd4f82bcae2805c1a5
Syntax
C#
public static class MathUtils

The MathUtils type exposes the following members.

Methods
 NameDescription
Public methodStatic memberAlign(Int32, Int32) 
Public methodStatic memberAlign(Int64, Int32) 
Public methodStatic memberAlign(UInt32, Int32) 
Public methodStatic memberAlign(UInt64, Int32) 
Public methodStatic memberBoolToInt 
Public methodStatic memberChangeHandedness Change matrix from right handed to left handed and vice-versa.
Public methodStatic memberClamp Clamps the specified value.
Public methodStatic memberCross Calculates the cross product between two Vector2 values.
Public methodStatic memberDegreesToRadians Converts degrees to radians.
Public methodStatic memberFastAbs 
Public methodStatic memberGauss(Double, Double, Double, Double, Double, Double, Double) Gauss function. http://en.wikipedia.org/wiki/Gaussian_function#Two-dimensional_Gaussian_function
Public methodStatic memberGauss(Single, Single, Single, Single, Single, Single, Single) Gauss function. http://en.wikipedia.org/wiki/Gaussian_function#Two-dimensional_Gaussian_function
Public methodStatic memberGetAngleDiff Returned the smallest difference between two angles in degrees (result is in range between 0 and 180).
Public methodStatic memberGetCenterPosition(Vector3, PositionTypes, Vector3, Vector3, Vector2) Calculates center position from the specified position, position type, directions and 2D size.
Public methodStatic memberGetCenterPosition(Vector3, PositionTypes, Vector3, Vector3, Vector3) Calculates center position from the specified position, position type, directions and 3D size.
Public methodStatic memberGetClosestPointOnPlane Returns a Vector3 that lies on this plane is the closest to the specified position.
Public methodStatic memberGetDirectionalLightShadowMatrix Creates a matrix that flattens a 3D mesh into a shadow mesh that lies on this plane and has zero height.
Public methodStatic memberGetDistanceToPlane Returns signed distance of the specified position from this Plane. If distance is positive, then position is in front of the plane (determined by the direction of the plane's normal). If distance is negative, then position is behind the plane. If distance is zero, then position lies on the plane.
Public methodStatic memberGetPerpendicularVectors(Vector3) Returns two vectors that are perpendicular (orthogonal) to the given inputVector and to each other. Both returned vectors are normalized.
Public methodStatic memberGetPerpendicularVectors(Vector3, Vector3, Vector3) Find two vectors that are perpendicular (orthogonal) to the given inputVector and to each other. Both returned vectors are normalized.
Public methodStatic memberGetPlaneIntersection(Plane, BoundingBox) Returns a MathUtilsPlaneIntersectionType that describes where the specified bounds (as Rect3D) lie in relation to this Plane.
Public methodStatic memberGetPlaneIntersection(Plane, Vector3, Double) Returns a MathUtilsPlaneIntersectionType that describes where the Sphere (specified by sphereCenter and sphereRadius) lies in relation to this Plane.
Public methodStatic memberGetPlaneIntersection(Plane, Vector3, Single) Returns a MathUtilsPlaneIntersectionType that describes where the specified position lie in relation to this Plane.
Public methodStatic memberGetPlaneIntersection(Plane, Vector3, Single) Returns a MathUtilsPlaneIntersectionType that describes where the specified positions lie in relation to this Plane.
Public methodStatic memberGetPointLightShadowMatrix Creates a matrix that flattens a 3D mesh into a shadow mesh that lies on this plane and has zero height.
Public methodStatic memberGetSetBitsCount(Int32) Returns the number of bits set to 1. Can be used to count how many flags in an enum value are set.
Public methodStatic memberGetSetBitsCount(UInt32) Returns the number of bits set to 1. Can be used to count how many flags in an enum value are set.
Public methodStatic memberGetSignedAngleDiff Returned the smallest difference between two angles in degrees (difference is positive if angle1 is bigger then angle2)
Public methodStatic memberIsEmptySize(Vector2) Used to check is size that is represented by Vector2 is Empty. Returns true if X and Y are zero or if X or Y are NaN.
Public methodStatic memberIsEmptySize(Vector3) Used to check is size that is represented by Vector3 is Empty. Returns true if X, Y and Z are zero or if X, Y or Z are NaN.
Public methodStatic memberIsFinite(Vector2) Returns true when the X and Y values in the vector2 struct are finite, e.g. are not NaN and not Infinity.
Public methodStatic memberIsFinite(Vector3) Returns true when the X, Y and Z values in the vector3 struct are finite, e.g. are not NaN and not Infinity.
Public methodStatic memberIsNonZeroPositive(Single) Returns true when the number positive and not zero, negative, NaN or Infinity.
Public methodStatic memberIsNonZeroPositive(Vector2) Returns true when the X and Y values in the vector2 struct are positive and not zero, negative, NaN or Infinity.
Public methodStatic memberIsNonZeroPositive(Vector3) Returns true when the X, Y and Z values in the vector3 struct are positive and not zero, negative, NaN or Infinity.
Public methodStatic memberIsNotZero Determines whether the specified value is not close to zero (0.0f).
Public methodStatic memberIsOne Determines whether the specified value is close to one (1.0f).
Public methodStatic memberIsPositiveOrZero(Single) Returns true when the number is zero or bigger (and not negative, NaN or Infinity)
Public methodStatic memberIsPositiveOrZero(Vector2) Returns true when size is valid: the X and Y values in the vector2 struct are zero or bigger (and not negative, NaN or Infinity)
Public methodStatic memberIsPositiveOrZero(Vector3) Returns true when size is valid: the X, Y and Z values in the vector3 struct are zero or bigger (and not negative, NaN or Infinity)
Public methodStatic memberIsPower2(Int32) Returns true is the specified value is exact power of 2 (1, 2, 4, 8, 16, ...)
Public methodStatic memberIsPower2(UInt32) Returns true is the specified value is exact power of 2 (1, 2, 4, 8, 16, ...). Returns false for 0.
Public methodStatic memberIsSame(BoundingBox, BoundingBox) Returns true if the specified BoundingBox values are same (taking float precision errors into account).
Public methodStatic memberIsSame(Color3, Color3) Returns true if byte values (each color is in range from 0 to 255) of this color are the same as byte values of the other colors.
Public methodStatic memberIsSame(Color4, Color4) Returns true if byte values (each color is in range from 0 to 255) of this color are the same as byte values of the other colors.
Public methodStatic memberIsSame(Single, Single) Checks if a and b are almost equals, taking into account the magnitude of floating point numbers (unlike WithinEpsilon(Single, Single, Single) method). See Remarks. See remarks.
Public methodStatic memberIsSame(Vector2, Vector2) Returns true if the specified Vector2 values are same (taking float precision errors into account).
Public methodStatic memberIsSame(Vector3, Vector3) Returns true if the specified Vector3 values are same (taking float precision errors into account).
Public methodStatic memberIsSame(BoundingBox, BoundingBox, Single) Returns true if the difference between the components in two BoundingBoxes are smaller than the specified tolerance.
Public methodStatic memberIsSame(Single, Single, Single) Check is the difference between a and b is smaller than the specified tolerance.
Public methodStatic memberIsSame(Vector2, Vector2, Single) Returns true if the difference between the components in Vector2 are smaller than the specified tolerance.
Public methodStatic memberIsSame(Vector3, Vector3, Single) Returns true if the difference between the components in Vector3 are smaller than the specified tolerance.
Public methodStatic memberIsZero Determines whether the specified value is close to zero (0.0f).
Public methodStatic memberIsZeroOrBigger Determines whether the specified value is bigger then zero (or close to the zero).
Public methodStatic memberLerp Interpolates between two values using a linear function by a given amount.
Public methodStatic memberLog2(Int32) 
Public methodStatic memberLog2(UInt32) 
Public methodStatic memberNormalizeAngleTo180 Returns an angle that is normalized so that it is always in range from -180 to 180 degrees. For example 270 is converted into -90; -200 is converted into 160. To get an angle in range from 0 to 360, use the NormalizeAngleTo360(Single) method.
Public methodStatic memberNormalizeAngleTo360 Returns an angle that is normalized so that it is always in range from 0 to 360 degrees. For example -90 is converted into 270; 400 is converted into 40. To get an angle in range from -180 to 180, use the NormalizeAngleTo180(Single) method.
Public methodStatic memberOrthogonalizeOrthogonalizes a list of vectors.
Public methodStatic memberOrthonormalizeOrthonormalizes a list of vectors.
Public methodStatic memberPower2 
Public methodStatic memberProject Projects a 3D vector from object space into screen space.
Public methodStatic memberRadiansToDegrees Converts radians to degrees.
Public methodStatic memberRayPlaneIntersection RayPlaneIntersection calculates a position where a ray intersects a plane. Returns false if there is no intersection.
Public methodStatic memberSmootherStep Performs a smooth(er) interpolation between 0 and 1 with 1st and 2nd order derivatives of zero at endpoints.
Public methodStatic memberSmoothStep Performs smooth (cubic Hermite) interpolation between 0 and 1.
Public methodStatic memberTernary(Boolean, Int32, Int32) 
Public methodStatic memberTernary(Int32, Int32, Int32) 
Public methodStatic memberUnproject Projects a 3D vector from screen space into object space.
Public methodStatic memberWithinEpsilon Checks if a - b are almost equals within a float epsilon.
Public methodStatic memberWrap Wraps the specified value into a range [min, max]
Top
Fields
 NameDescription
Public fieldStatic member_128KB 
Public fieldStatic member_16KB 
Public fieldStatic member_1KB 
Public fieldStatic member_1MB 
Public fieldStatic member_256KB 
Public fieldStatic member_512KB 
Public fieldStatic memberZeroMatrix4x4 
Public fieldStatic memberZeroTolerance The value for which all absolute numbers smaller than are considered equal to zero.
Top
See Also