Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Math library

Структуры данных

class  Math
 

Функции

void Math ()
 
void ~Math ()
 
static proto int GetNumberOfSetBits (int i)
 returns the number of bits set in a bitmask i
 
static proto int GetNthBitSet (int value, int n)
 returns the the index of n-th bit set in a bit mask counting from the right, for instance, in a mask ..0110 1000 , the 0th set bit(right-most bit set to 1) is at 3th position(starting at 0), 1st bit is at 5th position, 2nd bit is at 6th position etc..
 
static proto int RandomInt (int min, int max)
 Returns a random int number between and min [inclusive] and max [exclusive].
 
static int RandomIntInclusive (int min, int max)
 Returns a random int number between and min [inclusive] and max [inclusive].
 
static bool RandomBool ()
 Returns a random bool .
 
static proto float RandomFloat (float min, float max)
 Returns a random float number between and min[inclusive] and max[exclusive].
 
static float RandomFloatInclusive (float min, float max)
 Returns a random float number between and min [inclusive] and max [inclusive].
 
static float RandomFloat01 ()
 Returns a random float number between and min [inclusive] and max [inclusive].
 
static proto int Randomize (int seed)
 Sets the seed for the random number generator.
 
static proto float NormalizeAngle (float ang)
 Normalizes the angle (0...360)
 
static proto float DiffAngle (float angle1, float angle2)
 Return relative difference between angles.
 
static proto float Pow (float v, float power)
 Return power of v ^ power.
 
static proto float ModFloat (float x, float y)
 Returns the floating-point remainder of x/y rounded towards zero.
 
static proto float RemainderFloat (float x, float y)
 Returns the floating-point remainder of x/y rounded to nearest.
 
static proto float AbsFloat (float f)
 Returns absolute value.
 
static proto int AbsInt (int i)
 Returns absolute value.
 
static proto float SignFloat (float f)
 Returns sign of given value.
 
static proto int SignInt (int i)
 Returns sign of given value.
 
static proto float SqrFloat (float f)
 Returns squared value.
 
static proto int SqrInt (int i)
 Returns squared value.
 
static proto float Sqrt (float val)
 Returns square root.
 
static proto float Log2 (float x)
 Returns the binary (base-2) logarithm of x.
 
static proto float Sin (float angle)
 Returns sinus of angle in radians.
 
static proto float Cos (float angle)
 Returns cosinus of angle in radians.
 
static proto float Tan (float angle)
 Returns tangent of angle in radians.
 
static proto float Asin (float s)
 Returns angle in radians from sinus.
 
static proto float Acos (float c)
 Returns angle in radians from cosinus.
 
static proto float Atan (float x)
 Returns angle in radians from tangent.
 
static proto float Atan2 (float y, float x)
 Returns angle in radians from tangent.
 
static proto float Round (float f)
 Returns mathematical round of value.
 
static proto float Floor (float f)
 Returns floor of value.
 
static proto float Ceil (float f)
 Returns ceil of value.
 
static proto float WrapFloat (float f, float min, float max)
 Returns wrap number to specified interval [min, max[.
 
static proto float WrapFloatInclusive (float f, float min, float max)
 Returns wrap number to specified interval [min, max].
 
static proto float WrapFloat0X (float f, float max)
 Returns wrap number to specified interval [0, max[.
 
static proto float WrapFloat0XInclusive (float f, float max)
 Returns wrap number to specified interval [0, max].
 
static proto int WrapInt (int i, int min, int max)
 Returns wrap number to specified interval [min, max[.
 
static proto int WrapInt0X (int i, int max)
 Returns wrap number to specified interval [0, max[.
 
static proto float Clamp (float value, float min, float max)
 Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
 
static proto float Min (float x, float y)
 Returns smaller of two given values.
 
static proto float Max (float x, float y)
 Returns bigger of two given values.
 
static proto bool IsInRange (float v, float min, float max)
 Returns if value is between min and max (inclusive)
 
static proto bool IsInRangeInt (int v, int min, int max)
 Returns if value is between min and max (inclusive)
 
static proto float Lerp (float a, float b, float time)
 Linearly interpolates between 'a' and 'b' given 'time'.
 
static proto float InverseLerp (float a, float b, float value)
 Calculates the linear value that produces the interpolant value within the range [a, b], it's an inverse of Lerp.
 
static proto float AreaOfRightTriangle (float s, float a)
 Returns area of a right triangle.
 
static proto float HypotenuseOfRightTriangle (float s, float a)
 Returns hypotenus of a right triangle.
 
static proto bool IsPointInCircle (vector c, float r, vector p)
 Returns if point is inside circle.
 
static proto bool IsPointInRectangle (vector mi, vector ma, vector p)
 Returns if point is inside rectangle.
 
static proto float SmoothCD (float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)
 Does the CD smoothing function - easy in | easy out / S shaped smoothing.
 
static float Poisson (float mean, int occurences)
 occurences values above '12' will cause Factorial to overflow int.
 
static int Factorial (int val)
 values above '12' will cause int overflow
 
static vector CenterOfRectangle (vector min, vector max)
 

Переменные

static const float EULER = 2.7182818284590452353
 
static const float PI = 3.14159265358979
 
static const float PI2 = 6.28318530717958
 
static const float PI_HALF = 1.570796326794
 
static const float RAD2DEG = 57.2957795130823208768
 
static const float DEG2RAD = 0.01745329251994329577
 

Подробное описание

Функции

◆ AbsFloat()

static proto float AbsFloat ( float f)
staticprivate

Returns absolute value.

Аргументы
ffloat Value
Возвращает
float - Absolute value
Print( Math.AbsFloat(-12.5) );
>> 12.5
Definition EnMath.c:7
proto void Print(void var)
Prints content of variable to console/log.
static proto float AbsFloat(float f)
Returns absolute value.

Используется в ActionPushCar::ActionCondition(), ActionFillBrakes::ActionCondition(), ActionEnterLadder::ActionCondition(), SoftSkillsManager::AddSpecialty(), DayZPlayerImplementAiming::ApplyHorizontalNoise(), WorldData::CalcBaseEnvironmentTemperature(), CalculateEyeAcco(), CCTWaterSurface::Can(), DebugMonitorValues::CheckBlood(), Managed::CheckBlood(), DebugMonitorValues::CheckHealth(), Managed::CheckHealth(), BaseBuildingBase::CheckMemoryPointVerticalDistance(), Cooling(), DayZIntroScenePC::DayZIntroScenePC(), StaminaHandler::DepleteStamina(), EvaluateComponentEx(), EvaluateHit_Player(), EntityLightSource::FadeBrightnessTo(), EntityLightSource::FadeRadiusTo(), DayZInfected::FightLogic(), FilterObstructedObjectsByGrouping(), DayZInfected::GetAttackPitch(), GetCollisionBoxSize(), Environment::GetEnvironmentTemperature(), GetMeleeTargetEx(), ActionTargetsCursor::GetOnScreenPosition(), SoftSkillsManager::GetPreciseRoughLevels(), GetRadius(), Transport::GetSpeedometerAbsolute(), DayZInfected::HandleMove(), DayZPlayer::HandleView(), AttachmentsOutOfReach::IsAttachmentReachable(), Hologram::IsBaseFlat(), Hologram::IsCollidingAngle(), BaseBuildingBase::IsFacingPlayer(), ManBase::IsFacingTarget(), IsPlayerOrientedTowardPos(), PointLightBase::OnFrameLightSource(), InventoryActionHandler::OnUpdate(), DayZPlayerImplementAiming::ProcessAimFilters(), Weapon_Base::SetCylinderRotationAnimationPhase(), EntityLightSource::SetDancingShadowsAmplitude(), EntityLightSource::SetDancingShadowsMovementSpeed(), EntityLightSource::SetFlickerAmplitude(), Hologram::SmoothProjectionMovement(), EnProfilerTests::TestClassTimeData(), EnProfilerTests::TestFuncTimeData(), AnimationTimer::Tick(), AnimatorTimer::Tick(), ScriptedWidgetEventHandler::Update(), WeaponManager::Update(), UIScriptedMenu::Update(), UpdateLRAngleUnlocked(), UpdateUDAngle() и UpdateUDAngleUnlocked().

◆ AbsInt()

◆ Acos()

◆ AreaOfRightTriangle()

static proto float AreaOfRightTriangle ( float s,
float a )
staticprivate

Returns area of a right triangle.

Аргументы
sfloat Length of adjacent leg
afloat Angle of corner bordering adjacent which is not the right corner (in radians)
Возвращает
float - Area

◆ Asin()

static proto float Asin ( float s)
staticprivate

Returns angle in radians from sinus.

Аргументы
sfloat Sinus
Возвращает
float - Angle in radians
Print( Math.Asin(0.707107) ); // (sinus 45)
>> 0.785398
static proto float Asin(float s)
Returns angle in radians from sinus.

Используется в Easing::EaseInElastic(), Easing::EaseInOutElastic(), Easing::EaseOutElastic() и Weapon::LiftWeaponCheck().

◆ Atan()

static proto float Atan ( float x)
staticprivate

Returns angle in radians from tangent.

Аргументы
xfloat Tangent
Возвращает
float - Angle in radians

◆ Atan2()

static proto float Atan2 ( float y,
float x )
staticprivate

Returns angle in radians from tangent.

Аргументы
yfloat Tangent
xfloat Tangent
Возвращает
float - Angle in radians
Print ( Math.Atan2(1, 1) );
>> 0.785398
static proto float Atan2(float y, float x)
Returns angle in radians from tangent.

Используется в DayZIntroScene::DayZIntroScene(), GetMousePointerAngle(), DayZInfected::HandleOrientation(), MeleeTargetSettings() и PluginBase::OnUpdate().

◆ Ceil()

◆ CenterOfRectangle()

static vector CenterOfRectangle ( vector min,
vector max )
inlinestaticprivate
704 {
705 float x = (min[0] + max[0]) * 0.5;
706 float z = (min[2] + max[2]) * 0.5;
707
708 return Vector(x, 0.0, z);
709 }
Icon x
Definition EntityAI.c:95
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

Перекрестные ссылки Vector() и x.

Используется в DynamicMusicPlayer::RefreshTracksCache().

◆ Clamp()

static proto float Clamp ( float value,
float min,
float max )
staticprivate

Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

Аргументы
valuefloat Value
minfloat Minimum value
maxfloat Maximum value
Возвращает
float - Clamped value
Print( Math.Clamp(-0.1, 0, 1) );
Print( Math.Clamp(2, 0, 1) );
Print( Math.Clamp(0.5, 0, 1) );
>> 0
>> 1
>> 0.5
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

Используется в Chat::Add(), ComponentEnergyManager::AddEnergy(), SoftSkillsManager::AddExponentialPrecise(), SoftSkillsManager::AddExponentialRough(), IEntity::AddHealthLevel(), SoftSkillsManager::AddLinearPrecise(), SoftSkillsManager::AddLinearRough(), BaseBuildingBase::AddRefresherTime01(), AddTemperatureToItem(), AddTemperatureToItemByFire(), AddWetnessToFireplace(), AddWetnessToItem(), AdjustCameraParameters(), Hologram::AlignProjectionOnTerrain(), BaseBuildingBase::AnimateFlagEx(), RecoilBase::ApplyCamOffset(), RecoilBase::ApplyHandsOffset(), RecoilBase::ApplyMouseOffset(), HitDirectionEffectBase::CalculateArrowPosition(), GameplayEffectWidgets_base::CalculateBreathEffect(), PluginBase::CalculateHealth(), DayZPlayerImplementAiming::CalculateSwayMultiplier(), Managed::CheckBlood(), Barrel_ColorBase::ColourClothes(), CookOnDirectSlot(), DamageCrew(), DecreaseCookedItemQuantity(), UIScriptedMenu::DeleteKeyframe(), StaminaHandler::DepleteStamina(), WrittenNoteData::DepleteWritingImplement(), InjurySoundHandlerBase::DetermineInjuryZone(), Hud::DisplayNotifier(), Hud::DisplayTendencyNormal(), RecipeBase::Do(), WeaponDebug::DrawLineOfFireCameraHybrid(), UniversalTemperatureSourceLambdaBaseImpl::DryItemsInVicinity(), EOnPostSimulate(), ItemBase::Fertilize(), PPEffects::FlashbangEffect(), ManBase::FreezeCheck(), ConstructionActionData::GetActualAttachmentToDetach(), GetAirResistanceForSmokeParticles(), ManBase::GetHealthRegenSpeed(), ManBase::GetImmunity(), CAContinuousQuantityEdible::GetProgress(), Hologram::GetProjectionEntityPosition(), SoundHandlerBase::GetStaminaState(), GetTemperatureColor(), UIScriptedMenu::GetTotalTime(), GetZone(), PlayerAgentPool::GrowAgents(), HandleFallDamage(), GameplayEffectWidgets_base::HandleWidgetRoot(), Heating(), PPEffects::HitEffect(), HitDirectionEffectBase::Init(), Weapon::LiftWeaponCheck(), ScriptedWidgetEventHandler::LoadEntries(), DayZCreature::ModCommandHandlerBefore(), RightArea::MoveUpDownIcons(), BaseBuildingBase::OnCEUpdate(), OnEndServer(), ActionRefuelTorch::OnExecuteServer(), Grenade_Base::OnExplosionEffects(), ActionRepairCarChassis::OnFinishProgressServer(), OnFinishProgressServer(), CarScript::OnSound(), BleedingSourcesManagerBase::OnTick(), OnTick(), ModifierBase::OnTick(), HeatComfortMdfr::OnTick(), ShockDamageMdfr::OnTick(), TimerBase::OnUpdate(), DayZPlayerCamera3rdPersonErc::OnUpdate(), GameplayEffectWidgets_base::OnVoiceEvent(), ItemBase::OnWork(), FlashbangEffect::PlaySound(), DayZPlayerImplementAiming::ProcessAimFilters(), RainProcurementHandler::ProcessBatch(), BleedingSourcesManagerBase::ProcessHit(), Environment::ProcessItemsHeat(), ProcessNoiseComponents(), MissionBase::RandomArtillery(), ScriptedWidgetEventHandler::RandomizePageIndex(), PPERequesterBase::RelativizeValue(), SanitizeString(), PluginBase::SelectedObjectSetDamage(), Managed::SendInitValues(), InventoryItem::SetCleanness(), UniversalTemperatureSourceLambdaFireplace::SetCurrentTemperature(), PPEffects::SetDeathDarkening(), PPERequester_GameplayBase::SetFlashbangIntensity(), InventoryItem::SetQuantity(), InventoryItem::SetQuantityNormalized(), BaseBuildingBase::SetRefreshTimer01(), StaminaHandler::SetStamina(), PluginBase::SetStamina(), InventoryItem::SetTemperature(), InventoryItem::SetWet(), ShockDealtEffect::ShockDealtEffect(), Hud::ShowPlayerTag(), ManBase::SimplifyShock(), SnapOnObject(), Liquid::Transfer(), TruncateVec(), DamageDealtEffect::Update(), FlashbangEffect::Update(), ShockDealtEffect::Update(), NotificationUI::Update(), HitDirectionEffectBase::Update(), PPEMatClassParameterCommandData::Update(), RecoilBase::Update(), UpdateCookingState(), CorpseData::UpdateCorpseState(), LeftArea::UpdateSelectionIcons(), BleedingIndicatorDropData::UpdateTransform() и ValueToBar().

◆ Cos()

◆ DiffAngle()

static proto float DiffAngle ( float angle1,
float angle2 )
staticprivate

Return relative difference between angles.

Аргументы
angle1float
angle2float
Возвращает
float Difference between angles (angle1 - angle2)
Print( Math.DiffAngle(-45, 45) );
Print( Math.DiffAngle(90, 80) );
>> -90
>> 10
static proto float DiffAngle(float angle1, float angle2)
Return relative difference between angles.

◆ Factorial()

static int Factorial ( int val)
inlinestaticprivate

values above '12' will cause int overflow

688 {
689 if (val > 12)
690 {
691 ErrorEx("Values above '12' cause int overflow! Returning '1'");
692 return 1;
693 }
694
695 int res = 1;
696 while (val > 1)
697 {
698 res *= val--;
699 }
700 return res;
701 }
enum ShapeType ErrorEx

Перекрестные ссылки ErrorEx.

Используется в Poisson().

◆ Floor()

◆ GetNthBitSet()

static proto int GetNthBitSet ( int value,
int n )
staticprivate

returns the the index of n-th bit set in a bit mask counting from the right, for instance, in a mask ..0110 1000 , the 0th set bit(right-most bit set to 1) is at 3th position(starting at 0), 1st bit is at 5th position, 2nd bit is at 6th position etc..

Используется в AreaExposureMdfr::BleedingSourceCreateCheck(), PluginBase::InjectAgentsWithPlayer() и PluginBase::InjectAgentsWithPlayerCount().

◆ GetNumberOfSetBits()

static proto int GetNumberOfSetBits ( int i)
staticprivate

◆ HypotenuseOfRightTriangle()

static proto float HypotenuseOfRightTriangle ( float s,
float a )
staticprivate

Returns hypotenus of a right triangle.

Аргументы
sfloat Length of adjacent leg
afloat Angle of corner bordering adjacent which is not the right corner (in radians)
Возвращает
float - hypotenus

◆ InverseLerp()

static proto float InverseLerp ( float a,
float b,
float value )
staticprivate

Calculates the linear value that produces the interpolant value within the range [a, b], it's an inverse of Lerp.

Аргументы
afloat Start
bfloat End
valuefloat value
Возвращает
float - the time given the position between 'a' and 'b' given 'value', there is no clamp on 'value', to stay between [0..1] use 'value' between 'a' and 'b'
Print( Math.InverseLerp(3, 7, 5) );
>> 0.5
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...

Используется в RecoilBase::ApplyCamOffset(), BleedChanceData::CalculateBleedChance(), GameplayEffectWidgets_base::CalculateBreathEffect(), Managed::CheckBlood(), ConvertMins12hToAlarmHand01(), DamageCrew(), BroomBase::DebugSetHealthAndEnergy(), WeaponDebug::DrawLineOfFireCameraHybrid(), CGame::ExplosionEffects(), ManBase::FreezeCheck(), HeatComfortAnimHandler::GetEventTime(), Mask_Base::GetFilterQuantity01(), ManBase::GetHealthRegenSpeed(), PlayerStatBase::GetNormalized(), InventoryItem::GetQuantityNormalized(), ManBase::GetStatLevelBorders(), GetZone(), HandleFallDamage(), MaskMdfr::HandleSounds(), Weapon::LiftWeaponCheck(), OnEndServer(), ManBase::OnReceivedHit(), CGame::OnRPC(), BleedingSourcesManagerBase::OnTick(), ModifierBase::OnTick(), PoisoningMdfr::OnTick(), HeatComfortMdfr::OnTick(), ShockDamageMdfr::OnTick(), ScriptConsoleGeneralTab::RefreshDateWidgets(), PPERequesterBase::RelativizeValue(), KitchenTimer::SecondsTo01(), Managed::SendInitValues(), KuruShake::Update(), DamageDealtEffect::Update(), Update(), FlashbangEffect::Update(), ShockDealtEffect::Update(), HitDirectionEffectBase::Update(), RecoilBase::Update(), ScriptConsoleWeatherTab::UpdateSliderValues() и BleedingIndicatorDropData::UpdateTransform().

◆ IsInRange()

static proto bool IsInRange ( float v,
float min,
float max )
staticprivate

Returns if value is between min and max (inclusive)

Аргументы
vfloat Value
minfloat Minimum value
maxfloat Maximum value
Возвращает
bool - if value is within range [min,max]
Print( Math.IsInRange(6.9, 3.6, 9.3) );
>> true
static proto bool IsInRange(float v, float min, float max)
Returns if value is between min and max (inclusive)

◆ IsInRangeInt()

static proto bool IsInRangeInt ( int v,
int min,
int max )
staticprivate

Returns if value is between min and max (inclusive)

Аргументы
vint Value
minint Minimum value
maxint Maximum value
Возвращает
bool - if value is within range [min,max]
Print( Math.IsInRangeInt(6, 3, 9) );
>> true
static proto bool IsInRangeInt(int v, int min, int max)
Returns if value is between min and max (inclusive)

◆ IsPointInCircle()

static proto bool IsPointInCircle ( vector c,
float r,
vector p )
staticprivate

Returns if point is inside circle.

Аргументы
cvector Center of circle ([0] and [2] will be used, as a circle is 2D)
rfloat Radius of circle
pvector Point ([0] and [2] will be used, as a circle is 2D)
Возвращает
bool - True when point is in circle

◆ IsPointInRectangle()

static proto bool IsPointInRectangle ( vector mi,
vector ma,
vector p )
staticprivate

Returns if point is inside rectangle.

Аргументы
mivector Minimums of rectangle ([0] and [2] will be used, as a rectangle is 2D)
mavector Maximums of rectangle ([0] and [2] will be used, as a rectangle is 2D)
pvector Point ([0] and [2] will be used, as a rectangle is 2D)
Возвращает
bool - True when point is in rectangle

Используется в DynamicMusicPlayer::PlayerInsideOfLocationFilter() и DynamicMusicPlayer::PlayerInsideOfLocationFilter().

◆ Lerp()

static proto float Lerp ( float a,
float b,
float time )
staticprivate

Linearly interpolates between 'a' and 'b' given 'time'.

Аргументы
afloat Start
bfloat End
timefloat Time [value needs to be between 0..1 for correct results, no auto clamp applied]
Возвращает
float - The interpolated result between the two float values.
Print( Math.Lerp(3, 7, 0.5) );
>> 5
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.

Используется в BleedingIndicatorDropData::AdjustColorSaturation(), PlayerSpawnHandler::ApplyAttributes(), DayZPlayerImplementAiming::ApplyBreathingPattern(), RecoilBase::ApplyCamOffset(), DayZPlayerImplementAiming::ApplyHorizontalNoise(), WorldData::CalcBaseEnvironmentTemperature(), BleedChanceData::CalculateBleedChance(), GameplayEffectWidgets_base::CalculateBreathEffect(), DayZPlayerImplementAiming::CalculateSwayMultiplier(), ConvertAlarmHand01ToMins(), ConvertAlarmHand01ToMins12h(), DamageCrew(), StaminaHandler::DepleteStamina(), DetermineSpecificFinisherType(), WeaponDebug::DrawLineOfFireCameraHybrid(), EOnPostSimulate(), CGame::ExplosionEffects(), PPERequester_GameplayBase::FadeColourMult(), PPEffects::FlashbangEffect(), ManBase::FreezeCheck(), HeatComfortAnimHandler::GetEventTime(), ManBase::GetHealthRegenSpeed(), GetMeleeTargetEx(), MaskMdfr::HandleSounds(), PPEffects::HitEffect(), KuruShake::KuruShake(), ShockHandler::LerpVignette(), PPEMatClassParameterColor::ModifyResultValues(), PlayerSoundEventBase::OnPlay(), PPERequester_GameplayBase::OnStart(), ModifierBase::OnTick(), PoisoningMdfr::OnTick(), HeatComfortMdfr::OnTick(), ShockDamageMdfr::OnTick(), ManBase::OnUnconsciousUpdate(), TimerBase::OnUpdate(), PPERequester_GameplayBase::OnUpdate(), GameplayEffectWidgets_base::OnVoiceEvent(), ComponentEnergyManager::SetEnergy0To1(), InventoryItem::SetQuantityNormalized(), ManBase::SimplifyShock(), Hologram::SmoothProjectionMovement(), ManBase::SpawnDrowningBubbles(), KitchenTimer::Time01ToSeconds(), DamageDealtEffect::Update(), ShockDealtEffect::Update(), HitDirectionEffectBase::Update(), PPEMatClassParameterCommandData::Update(), BleedingIndicatorDropData::UpdateAlpha(), ScriptConsoleGeneralTab::UpdateTime(), BleedingIndicatorDropData::UpdateTransform() и ValueToBar().

◆ Log2()

static proto float Log2 ( float x)
staticprivate

Returns the binary (base-2) logarithm of x.

Аргументы
xfloat Value whose logarithm is calculated.
Возвращает
float The binary logarithm of x: log2x.
If x is negative, it causes a domain error:
If x is zero, it may cause a pole error (depending on the library implementation).
Print( Math.Log2(1.0) );
>> 0.0
static proto float Log2(float x)
Returns the binary (base-2) logarithm of x.

Используется в DigestAgents() и PluginRecipesManagerBase::SortIngredientsInRecipe().

◆ Math()

void Math ( )
inlineprivate
8{}

◆ Max()

static proto float Max ( float x,
float y )
staticprivate

Returns bigger of two given values.

Аргументы
xfloat Value
yfloat Value
Возвращает
float - max value
Print( Math.Max(5.3, 2.8) );
>> 5.3
static proto float Max(float x, float y)
Returns bigger of two given values.

Используется в BleedingIndicatorDropData::BleedingIndicatorDropData(), Environment::CalcTemperatureFromTemperatureSource(), PluginBase::CalcTemperatureFromTemperatureSource(), BleedChanceData::CalculateBleedChance(), ReplaceItemWithNewLambda::CopyOldPropertiesToNew(), StaminaHandler::DepleteStamina(), UniversalTemperatureSourceLambdaBaseImpl::DryItemsInVicinity(), Weapon::GetEffectiveAttachmentLength(), CfgGameplayHandler::GetMovementRotationSpeedJog(), CfgGameplayHandler::GetMovementRotationSpeedSprint(), CfgGameplayHandler::GetMovementTimeToSprint(), CfgGameplayHandler::GetMovementTimeToStrafeJog(), CfgGameplayHandler::GetMovementTimeToStrafeSprint(), Environment::GetPlayerHeat(), Environment::GetTemperatureHeightCorrection(), Environment::GetWetDelta(), HasMaterials(), ManBase::Init(), ItemOptics::InitCameraOverrideProperties(), InventoryItem::ItemBase(), PPEMatClassParameterColor::ModifyResultValues(), ScriptConsoleGeneralTab::OnDoubleClick(), CholeraMdfr::OnTick(), Environment::ProcessItemsDryness(), Ammunition_Base::SetFromProjectile(), Hologram::SetOnGround(), StaticConstructionMethods::SpawnConstructionMaterialPiles(), TakeMaterialsServer(), PluginBase::TransmitAgentsEx(), StaminaHandler::Update(), PPEMatClassParameterCommandData::Update(), Update(), BroomBase::UpdateParticle(), Container::UpdateRowVisibility() и FlammableBase::Upgrade().

◆ Min()

◆ ModFloat()

static proto float ModFloat ( float x,
float y )
staticprivate

Returns the floating-point remainder of x/y rounded towards zero.

Аргументы
xfloat Value of the quotient numerator
yfloat Value of the quotient denominator
Возвращает
float - The remainder of dividing the arguments
Print( Math.ModFloat(5.3, 2) );
Print( Math.ModFloat(18.5, 4.2) );
>> 1.3
>> 1.7
static proto float ModFloat(float x, float y)
Returns the floating-point remainder of x/y rounded towards zero.

Используется в HitDirectionEffectBase::CalculateArrowPosition() и FModulus().

◆ NormalizeAngle()

static proto float NormalizeAngle ( float ang)
staticprivate

Normalizes the angle (0...360)

Аргументы
angfloat Angle for normalizing
Возвращает
float - Normalized angle
>> 30
>> 270
static proto float NormalizeAngle(float ang)
Normalizes the angle (0...360)

Используется в HitDirectionEffectBase::CalculateArrowPosition() и DayZInfected::HandleOrientation().

◆ Poisson()

static float Poisson ( float mean,
int occurences )
inlinestaticprivate

occurences values above '12' will cause Factorial to overflow int.

682 {
684 }
static int Factorial(int val)
values above '12' will cause int overflow
Definition EnMath.c:687
static proto float Pow(float v, float power)
Return power of v ^ power.
static const float EULER
Definition EnMath.c:11

Перекрестные ссылки EULER, Factorial() и Pow().

Используется в GameplayEffectsData::BuildProbabilityData().

◆ Pow()

◆ RandomBool()

static bool RandomBool ( )
inlinestaticprivate

Returns a random bool .

Возвращает
bool - Random bool either 0 or 1
>> true
>> true
>> false
static bool RandomBool()
Returns a random bool .
Definition EnMath.c:73
74 {
75 return RandomIntInclusive(0,1);
76 }
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54

Перекрестные ссылки RandomIntInclusive().

◆ RandomFloat()

◆ RandomFloat01()

static float RandomFloat01 ( )
inlinestaticprivate

Returns a random float number between and min [inclusive] and max [inclusive].

Возвращает
float - Random number in range 0.0 .. 1.0
Print( Math.RandomFloat01() ); // 0.0 .. 1.0
>> 0.3
>> 1.0
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
127 {
128 return RandomFloatInclusive(0, 1);
129 }
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106

Перекрестные ссылки RandomFloatInclusive().

Используется в MessageReceiverBase::AutoinfectCheck(), AreaExposureMdfr::BleedingSourceCreateCheck(), ItemBase::CheckRainTick(), ChooseAttack(), CreateParticle(), PluginBase::DetermineChanceToTransmit(), GetRandomPos(), PluginBase::GiveWormsToPlayer(), ItemBase::InfestationTimerTick(), AreaExposureMdfr::OnTick(), PoisoningMdfr::OnTick(), BrainDiseaseMdfr::OnTick(), CommonColdMdfr::OnTick(), InfluenzaMdfr::OnTick(), Edible_Base::ProcessDecay(), ManBase::ProcessFeetDamageServer(), ManBase::ProcessHandDamage(), BleedingSourcesManagerBase::ProcessHit(), ScriptedWidgetEventHandler::RandomizePageIndex(), BleedingSourcesManagerBase::RemoveBleedingSource(), ManBase::SpreadAgentsEx() и Managed::Update().

◆ RandomFloatInclusive()

static float RandomFloatInclusive ( float min,
float max )
inlinestaticprivate

Returns a random float number between and min [inclusive] and max [inclusive].

Аргументы
minfloat Range starts [inclusive]
maxfloat Range ends [inclusive]
Возвращает
float - Random number in range
Print( Math.RandomFloatInclusive(0, 1) ); // 0.0 .. 1.0
Print( Math.RandomFloatInclusive(1, 2) ); // 1.0 .. 2.0
>> 0.3
>> 2.0
107 {
108 int max_range = Math.Pow(2, 30); //max range
110 float rand_float = (float)random_int / (float)max_range;
111 float range = max - min;
112
113 return min + (rand_float * range); //rand float
114 }
Definition EnConvert.c:97
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

Перекрестные ссылки Pow() и RandomInt().

Используется в PlayerSpawnHandler::ApplyAttributes(), AttachBleedingToZonesByHeight(), ItemBase::CatchSetQuant(), RecipeBase::Do(), GameplayEffectsData::GenerateSequenceRandomPosition(), FireworksLauncher::GetEventDelay(), HeatComfortAnimHandler::GetEventTime(), FireworksLauncherClientEvent::GetExplosionDelay(), FireworksLauncherClientEvent::GetExplosionDistance(), GetExplosionDistance(), Math3D::GetRandomDir(), FireworksLauncherClientEvent::GetShotDispersionAngle(), SpookyEventBase::GetSoundPos(), ItemBase::GetTemperatureValue(), DynamicMusicPlayer::GetWaitTimeForCategory(), HandleFishingResultFailure(), HandleFishingResultSuccess(), HitDirectionEffectBase::Init(), Init(), BleedingIndicatorDropData::InitImageScale(), AreaExposureMdfr::OnActivate(), ContaminationStage1Mdfr::OnActivate(), ContaminationStage2Mdfr::OnActivate(), WoundInfectStage1Mdfr::OnActivate(), WoundInfectStage2Mdfr::OnActivate(), ActionRepairCarChassis::OnFinishProgressServer(), OnFinishProgressServer(), FireworksLauncherClientEvent::OnFired(), AreaExposureMdfr::OnTick(), FeverMdfr::OnTick(), ContaminationStage2Mdfr::OnTick(), SalmonellaMdfr::OnTick(), WoundInfectStage1Mdfr::OnTick(), WoundInfectStage2Mdfr::OnTick(), SymptomBase::OnUpdateClient(), PlateCarrierVest::OnWasAttached(), ProcessSound(), InjurySoundHandlerBase::ProcessSound(), vector::RandomDir(), vector::RandomDir2D(), RandomFloat01(), Randomize(), Particle::RandWiggleFloat(), BleedingIndicatorDropData::ScatterPosition(), InventoryItem::SetCEBasedQuantity(), ContaminatedArea_Dynamic::SpawnItems(), BleedingIndicatorDropData::StartDrop() и WorldData::WeatherOnBeforeChange().

◆ RandomInt()

static proto int RandomInt ( int min,
int max )
staticprivate

Returns a random int number between and min [inclusive] and max [exclusive].

Аргументы
minint Range starts [inclusive]
maxint Range ends [exclusive]
Возвращает
int - Random number in range
Print( Math.RandomInt(0, 1) ); // only 0
Print( Math.RandomInt(0, 2) ); // 0 or 1
>> 0
>> 1

Используется в ApplyJumpOutDmg(), AttachBleedingToZonesByHeight(), Catching(), Managed::CreateNewCharacterRandom(), DayZIntroSceneXbox::CreateRandomCharacter(), CreditsLoader::CreateTestJson(), SymptomManager::CreateUniqueID(), InventoryItem::DamageItemAttachments(), InventoryItem::DamageItemInCargo(), DayZIntroScene::DayZIntroScene(), InventoryItem::DoAmmoExplosion(), InventoryItem::EEHitBy(), Apple::EEOnCECreate(), Bottle_Base::EEOnCECreate(), GreenBellPepper::EEOnCECreate(), Pear::EEOnCECreate(), Plum::EEOnCECreate(), Potato::EEOnCECreate(), Tomato::EEOnCECreate(), Zucchini::EEOnCECreate(), MushroomBase::EEOnCECreate(), DayZInfected::EOnInit(), FireworksLauncher::FireworksLauncher(), FishPull(), BloodTypes::GenerateBloodType(), RemotelyActivatedItemBehaviour::GeneratePersistentID(), GameplayEffectsData::GenerateSequenceRandomPosition(), AreaDamageBase::GetRandomHitZone(), array< Class T >::GetRandomIndex(), GetRandomLoadingBackground(), SoundLookupTable::GetSoundBuilder(), ItemBase::GrowthTimerTick(), HandleFishingResultSuccess(), HandleSoundEffectsPipeCreaking(), Init(), ItemBase::Init(), WeaponParticlesBase::OnActivate(), MapHandler::OnDoubleClick(), ActionUnrestrainSelf::OnFinishProgressServer(), OnSteppedOn(), CholeraMdfr::OnTick(), CommonColdMdfr::OnTick(), InfluenzaMdfr::OnTick(), SalmonellaMdfr::OnTick(), ItemBase::PlantBase(), PlayActionSound(), PlayPipeCreakingSoundOnLocation(), BleedingSourcesManagerBase::ProcessHit(), RandomFloatInclusive(), RandomIntInclusive(), UIScriptedMenu::RandomizeCharacter(), HFSMBase< WeaponStateBase, WeaponEventBase, WeaponActionBase, WeaponGuardBase >::RandomizeFSMStateEx(), BetaSound::SaySound(), DayZAIHitComponentHelpers::SelectMostProbableHitComponent(), DynamicMusicPlayer::SelectRandomTrackIndexFromCategory(), SendEmoteRequestSync(), OptionSelector::SetRandomValue(), ShuffleLock(), ItemBase::SoundCollision(), BarbedWireTrigger::SoundCollision(), ItemBase::SoundCut(), ItemBase::SoundElectricShock(), BarbedWireTrigger::SoundElectricShock(), ItemBase::SoundSpark(), TrapSpawnBase::SpawnCatch(), TrapSpawnBase::Trap_RabbitSnare() и WorldData::WeatherOnBeforeChange().

◆ RandomIntInclusive()

static int RandomIntInclusive ( int min,
int max )
inlinestaticprivate

Returns a random int number between and min [inclusive] and max [inclusive].

Аргументы
minint Range starts [inclusive]
maxint Range ends [inclusive]
Возвращает
int - Random number in range
Print( Math.RandomIntInclusive(0, 1) ); // 0 or 1
Print( Math.RandomIntInclusive(0, 2) ); // 0, 1, 2
>> 1
>> 2
55 {
56 return Math.RandomInt(min, max+1);
57 }

Перекрестные ссылки RandomInt().

Используется в ApplyJumpOutDmg(), AreaExposureMdfr::BleedingSourceCreateCheck(), DamageHands(), CAContinuousMineWood::DamagePlayersHands(), RecipeBase::Do(), Weapon::FillChamber(), Weapon::FillInnerMagazine(), FireworksLauncher::FireworksLauncher(), AreaDamageComponentRaycasted::GetFallbackHitZone(), AreaDamageBase::GetRaycastedHitZone(), FireworksLauncherClientEvent::GetSecondaryExplosionDelay(), DayZInfected::HandleDamageHit(), HitDirectionEffectBase::Init(), OnFinishProgressServer(), ActionPackGift::OnFinishProgressServer(), TrapBase::OnServerSteppedOn(), OnSteppedOn(), CholeraMdfr::OnTick(), ToxicityMdfr::OnTick(), OpenItem::OpenAndSwitch(), Edible_Base::ProcessDecay(), MissionBase::RandomArtillery(), RandomBool(), Randomize(), RandomizedDeviation(), HitDirectionImagesBase::RandomizeImageIdx(), ScriptedWidgetEventHandler::RandomizePageIndex(), CrashBase::RandomizePosition(), SelectEvent(), HitDirectionEffectBase::SetIndicatorRotation(), Weapon::SpawnAttachedMagazine(), TrapSpawnBase::SpawnCatch(), CrashBase::SpawnRandomDeers() и WorldData::WeatherOnBeforeChange().

◆ Randomize()

static proto int Randomize ( int seed)
staticprivate

Sets the seed for the random number generator.

Аргументы
seedint New seed for the random number generator, -1 will use time
Возвращает
int - Returns new seed
>> 5
static proto int Randomize(int seed)
Sets the seed for the random number generator.

Используется в AttachBleedingToZonesByHeight(), CGame::CGame(), ChooseAttack(), AreaDamageBase::GetRandomHitZone(), GetRandomLoadingBackground(), KuruShake::KuruShake(), CGame::OnAfterCreate(), FireworksLauncher::OnVariablesSynchronized(), Randomize(), RandomizedDeviation() и ScriptedWidgetEventHandler::RandomizePageIndex().

◆ RemainderFloat()

static proto float RemainderFloat ( float x,
float y )
staticprivate

Returns the floating-point remainder of x/y rounded to nearest.

Аргументы
xfloat Value of the quotient numerator
yfloat Value of the quotient denominator
Возвращает
float - The remainder of dividing the arguments
Print( Math.RemainderFloat(18.5, 4.2) );
>> -0.7
>> 1.7
static proto float RemainderFloat(float x, float y)
Returns the floating-point remainder of x/y rounded to nearest.

◆ Round()

static proto float Round ( float f)
staticprivate

Returns mathematical round of value.

Аргументы
ffloat Value
Возвращает
float - closest whole number to 'f'
Print( Math.Round(5.3) );
Print( Math.Round(5.8) );
>> 5
>> 6
static proto float Round(float f)
Returns mathematical round of value.

Используется в ScriptedWidgetEventHandler::AddItem(), BaseBuildingBase::AddRefresherTime01(), BaseBuildingBase::AnimateFlagEx(), PlayerSpawnHandler::ApplyAttributes(), DayZPlayerImplementAiming::ApplyShakes(), ItemBase::CatchSetQuant(), InventoryItem::CombineItems(), CreateOrgan(), InventoryItem::DeSerializeNumericalVars(), DetermineSpecificFinisherType(), RecipeBase::Do(), PoweredOptic_Base::DoMeasurement(), Inventory_Base::EmptySeedPack(), ScriptedWidgetEventHandler::GetDistanceString(), ComponentEnergyManager::GetEnergy0To100(), VicinitySlotsContainer::GetItemQuantityText(), FlammableBase::GetRagQuantity(), ItemBase::GetTemperatureValue(), EntityLightSource::HandleBlinking(), HandleFishingResultSuccess(), DayZInfected::HandleOrientation(), UIScriptedMenu::NextPrevPage(), BaseBuildingBase::OnCEUpdate(), Battery9V::OnEnergyAdded(), VehicleBattery::OnEnergyAdded(), Battery9V::OnEnergyConsumed(), Chemlight_ColorBase::OnEnergyConsumed(), VehicleBattery::OnEnergyConsumed(), ModifierBase::OnTick(), OnUpdate(), OrderedAltitudeNumbersPosition(), UIScriptedMenu::ProcessDistanceAndUnits(), ProcessNoiseComponents(), ScriptedWidgetEventHandler::RefreshItemVariables(), ScriptedWidgetEventHandler::RefreshQuickbarItemVariables(), ScriptedWidgetEventHandler::RemoveItem(), ScriptedWidgetEventHandler::ResetItem(), ScriptedWidgetEventHandler::SetItem(), ScriptedWidgetEventHandler::SetItemColor(), ActionTargetsCursor::SetItemQuantity(), ScriptedWidgetEventHandler::SetItemQuantity(), Icon::SetQuantity(), SlotsIcon::SetQuantity(), InventoryItem::SetQuantityNormalized(), BaseBuildingBase::SetRefreshTimer01(), UIScriptedMenu::Update(), UIScriptedMenu::UpdateItemInfoQuantity(), UIScriptedMenu::UpdateItemInfoWeight(), ServerBrowserTab::UpdatePageButtons(), ScriptedWidgetEventHandler::UpdateQuantityItems(), UIScriptedMenu::UpdateQuickbarItemCard(), ScriptedWidgetEventHandler::UpdateTemperatureItems(), HudDebugWinBase::UpdateValues(), UpdateZones() и ValueToBar().

◆ SignFloat()

static proto float SignFloat ( float f)
staticprivate

Returns sign of given value.

Аргументы
ffloat Value
Возвращает
float - Sign of given value
Print( Math.SignFloat(-12.0) );
Print( Math.SignFloat(12.0) );
>> -1.0
>> 0
>> 1.0
static proto float SignFloat(float f)
Returns sign of given value.

◆ SignInt()

static proto int SignInt ( int i)
staticprivate

Returns sign of given value.

Аргументы
iint Value
Возвращает
int - Sign of given value
>> -1
>> 0
>> 1

◆ Sin()

◆ SmoothCD()

static proto float SmoothCD ( float val,
float target,
inout float velocity[],
float smoothTime,
float maxVelocity,
float dt )
staticprivate

Does the CD smoothing function - easy in | easy out / S shaped smoothing.

Аргументы
valactual value
targetvalue we are reaching for -> Target
velocityfloat[1] - array of ONE member - some kind of memory and actual accel/decel rate, need to be zeroed when filter is about to be reset
smoothTimesmoothing parameter, 0.1 .. 0.4 are resonable values, 0.1 is sharp, 0.4 is very smooth
maxVelocitymaximal value change when multiplied by dt
dtdelta time
Возвращает
float smoothed/filtered value
val = EnfMath.SmoothCD(val, varTarget, valVelocity, 0.3, 1000, dt);

Используется в DayZPlayerImplementAiming::ApplyHorizontalNoise(), HitDirectionEffectBase::CalculateArrowPosition(), DayZPlayerCameraBase::HoldBreathFOVEffect(), HoldBreathFOVEffect(), DayZPlayerCameraBase::OnUpdate(), OnUpdate(), DayZPlayerImplementAiming::ProcessStealthFilters(), StdFovUpdate(), NotificationUI::Update(), UpdateLRAngle(), UpdateLRAngleLookAt(), UpdateLRAngleUnlocked(), UpdateUDAngle() и UpdateUDAngleUnlocked().

◆ SqrFloat()

◆ SqrInt()

static proto int SqrInt ( int i)
staticprivate

Returns squared value.

Аргументы
iint Value
Возвращает
int - Squared value
Print( Math.SqrInt(12) );
>> 144
static proto int SqrInt(int i)
Returns squared value.

Используется в EffectArea::PlaceParticles().

◆ Sqrt()

static proto float Sqrt ( float val)
staticprivate

Returns square root.

Аргументы
valfloat Value
Возвращает
float - Square of value
Print( Math.Sqrt(25));
>> 5
static proto float Sqrt(float val)
Returns square root.

Используется в SoftSkillsManager::AddExponentialPrecise(), SoftSkillsManager::AddExponentialRough(), DayZIntroScenePC::DayZIntroScenePC(), Easing::EaseInCirc(), Easing::EaseInOutCirc(), Easing::EaseOutCirc(), CGame::OnRPC() и UIScriptedMenu::Update().

◆ Tan()

static proto float Tan ( float angle)
staticprivate

Returns tangent of angle in radians.

Аргументы
anglefloat Angle in radians
Возвращает
float - Tangens of angle
Print( Math.Tan(0.785398) ); // (45)
>> 1
static proto float Tan(float angle)
Returns tangent of angle in radians.

Используется в GetMeleeTarget(), GetMeleeTargetEx() и PointLightBase::OnFrameLightSource().

◆ WrapFloat()

static proto float WrapFloat ( float f,
float min,
float max )
staticprivate

Returns wrap number to specified interval [min, max[.

Аргументы
ffloat Value
minfloat Minimum
maxfloat Maximum
Возвращает
float - number in specified interval [min, max[
Print( Math.WrapFloat(9.0, 1.0, 9.0) );
>> 1.0
static proto float WrapFloat(float f, float min, float max)
Returns wrap number to specified interval [min, max[.

◆ WrapFloat0X()

static proto float WrapFloat0X ( float f,
float max )
staticprivate

Returns wrap number to specified interval [0, max[.

Аргументы
ffloat Value
maxfloat Maximum
Возвращает
float - number in specified interval [0, max[
Print( Math.WrapFloat0X(9.0, 9.0) );
>> 0.0
static proto float WrapFloat0X(float f, float max)
Returns wrap number to specified interval [0, max[.

◆ WrapFloat0XInclusive()

static proto float WrapFloat0XInclusive ( float f,
float max )
staticprivate

Returns wrap number to specified interval [0, max].

Аргументы
ffloat Value
maxfloat Maximum
Возвращает
float - number in specified interval [0, max]
Print( Math.WrapFloat0X(9.0, 9.0) );
>> 9.0

◆ WrapFloatInclusive()

static proto float WrapFloatInclusive ( float f,
float min,
float max )
staticprivate

Returns wrap number to specified interval [min, max].

Аргументы
ffloat Value
minfloat Minimum
maxfloat Maximum
Возвращает
float - number in specified interval [min, max]
Print( Math.WrapFloatInclusive(9.0, 1.0, 9.0) );
>> 9.0
static proto float WrapFloatInclusive(float f, float min, float max)
Returns wrap number to specified interval [min, max].

◆ WrapInt()

static proto int WrapInt ( int i,
int min,
int max )
staticprivate

Returns wrap number to specified interval [min, max[.

Аргументы
iint Value
minfloat Minimum
maxint Maximum
Возвращает
int - number in specified interval [min, max[
Print( Math.WrapInt(9, 1, 9) );
>> 1
static proto int WrapInt(int i, int min, int max)
Returns wrap number to specified interval [min, max[.

Используется в WeaponStateBase::FindNextFreeMuzzle().

◆ WrapInt0X()

static proto int WrapInt0X ( int i,
int max )
staticprivate

Returns wrap number to specified interval [0, max[.

Аргументы
iint Value
maxint Maximum
Возвращает
int - number in specified interval [0, max[
Print( Math.WrapInt0X(9, 9) );
>> 0
static proto int WrapInt0X(int i, int max)
Returns wrap number to specified interval [0, max[.

◆ ~Math()

void ~Math ( )
inlineprivate
9{}

Переменные

◆ DEG2RAD

◆ EULER

const float EULER = 2.7182818284590452353
staticprivate

Используется в Poisson().

◆ PI

◆ PI2

◆ PI_HALF

◆ RAD2DEG