Skip to content

Get Sansar

Script API

Mathf

Where: Client
More page actions

For the complete documentation index, see llms.txt. This page is also available as Markdown.

Class Namespace Sansar

Floating point math constants and utilities.

public static class Mathf

Remarks

Provides common floating point constants static methods.

Members at a glance

KindMembers
FieldsDegreesPerRadian · E · PI · PiOverTwo · RadiansPerDegree · RootTwo · RootTwoOverTwo · TwoOverPi · TwoPi
MethodsClamp · IsApproximatelyEqualAbsolute

Fields

DegreesPerRadian

public const float DegreesPerRadian

Conversion factor to convert radians to degrees.

E

public const float E

E

PI

public const float PI

Pi

PiOverTwo

public const float PiOverTwo

Pi divided by two.

RadiansPerDegree

public const float RadiansPerDegree

Conversion factor to convert degrees to radians.

RootTwo

public const float RootTwo

The square root of two.

RootTwoOverTwo

public const float RootTwoOverTwo

The square root of 2 divided by two.

TwoOverPi

public const float TwoOverPi

Two divided by pi.

TwoPi

public const float TwoPi

Two times pi.

Methods

Clamp

public static float Clamp(float x, float min, float max)

Clamps a float to the specified range

ParameterTypeDescription
xfloatThe float to compare.
minfloatThe minimum of the clamp range.
maxfloatThe maximum of the clamp range.

Returns: float — x if x is within [min,max] otherwise min or max, whichever is closer to the value of x.

IsApproximatelyEqualAbsolute

public static bool IsApproximatelyEqualAbsolute(float a, float b)

Compares the two given floats and returns true if they are approximately equal

ParameterTypeDescription
afloatThe first float to compare.
bfloatThe second float to compare.

Returns: bool — true if the float are approximately equal, false otherwise.

Remarks

Checks if the absolute value of the difference of the values is small.

Used in examples

Generated from the Sansar 47.10.0 client ScriptApi snapshot.