Data Structures | |
class | Math3D |
Enumerations | |
enum | ECurveType { CatmullRom , NaturalCubic , UniformCubic } |
Functions | |
proto native vector | Vector (float x, float y, float z) |
Vector constructor from components. | |
private void | Math3D () |
private void | ~Math3D () |
static proto vector | ClipLine (vector start, vector end, vector norm, float d) |
static proto float | IntersectRaySphere (vector raybase, vector raycos, vector center, float radius) |
Tests whether ray is intersecting sphere. | |
static proto float | IntersectRayBox (vector start, vector end, vector mins, vector maxs) |
Tests whether ray is intersecting axis aligned box. | |
static proto bool | IntersectSphereBox (vector origin, float radius, vector mins, vector maxs) |
Tests whether sphere is intersecting axis aligned box. | |
static proto bool | IntersectSphereCone (vector origin, float radius, vector conepos, vector axis, float angle) |
Tests whether sphere is intersecting cone. | |
static proto bool | IntersectWholeSphereCone (vector origin, float radius, vector conepos, vector axis, float angle) |
Tests whether sphere is fully inside cone. | |
static proto bool | IntersectCylinderOBB (vector mins, vector maxs, vector obbMat[4], vector cylMat[4], float cylinderRadius, float cylinderHeight) |
Tests whether cylinder is intersecting oriented box. | |
static proto bool | IntersectRayCylinder (vector rayStart, vector rayEnd, vector center, float radius, float height) |
Tests whether ray is intersecting cylinder. | |
static proto int | IntersectRayPlane (vector rayStart, vector rayEnd, vector planeNormal, float planeDist, out vector intersection) |
Tests whether ray is intersecting plane. | |
static proto void | YawPitchRollMatrix (vector ang, out vector mat[3]) |
Creates rotation matrix from angles. | |
static proto void | DirectionAndUpMatrix (vector dir, vector up, out vector mat[4]) |
Creates rotation matrix from direction and up vector. | |
static proto void | MatrixMultiply4 (vector mat0[4], vector mat1[4], out vector res[4]) |
Transforms matrix. | |
static proto void | MatrixMultiply3 (vector mat0[3], vector mat1[3], out vector res[3]) |
Transforms rotation matrix. | |
static proto void | MatrixInvMultiply4 (vector mat0[4], vector mat1[4], out vector res[4]) |
Invert-transforms matrix. | |
static proto void | MatrixInvMultiply3 (vector mat0[3], vector mat1[3], out vector res[3]) |
Invert-transforms rotation matrix. | |
static proto void | MatrixInverse4 (vector mat[4]) |
Inverses a matrix. | |
static proto void | MatrixInverse3 (vector mat[3]) |
Inverses a matrix. | |
static proto void | MatrixOrthogonalize4 (vector mat[4]) |
Orthogonalizes matrix. | |
static proto void | MatrixOrthogonalize3 (vector mat[3]) |
Orthogonalizes matrix. | |
static void | MatrixIdentity4 (out vector mat[4]) |
Creates identity matrix. | |
static void | MatrixIdentity3 (out vector mat[3]) |
Creates identity matrix. | |
static void | ScaleMatrix (float scale, out vector mat[3]) |
Creates scale matrix. | |
static void | QuatIdentity (out float q[4]) |
Creates identity quaternion. | |
static void | QuatCopy (float s[4], out float d[4]) |
Copies quaternion. | |
static proto void | MatrixToQuat (vector mat[3], out float d[4]) |
Converts rotation matrix to quaternion. | |
static proto void | QuatToMatrix (float q[4], out vector mat[3]) |
Converts quaternion to rotation matrix. | |
static proto vector | MatrixToAngles (vector mat[3]) |
Returns angles of rotation matrix. | |
static proto void | QuatLerp (out float qout[4], float q1[4], float q2[4], float frac) |
Linear interpolation between q1 and q2 with weight 'frac' (0...1) | |
static proto void | QuatMultiply (out float qout[4], float q1[4], float q2[4]) |
Multiplies quaternions. | |
static proto vector | QuatToAngles (float q[4]) |
Returns Angles vector from quaternion. | |
static proto int | CheckBoundBox (vector mins1, vector maxs1, vector mins2, vector maxs2) |
Returns 1, when bounding boxes intersects. | |
static vector | GetRandomDir () |
Returns randon normalized direction. | |
static proto native vector | Curve (ECurveType type, float param, notnull array< vector > points) |
Computes curve. | |
static proto vector | NearestPoint (vector beg, vector end, vector pos) |
Point on line beg .. end nearest to pos. | |
static proto float | AngleFromPosition (vector origin, vector originDir, vector target) |
Angle that a target is from the direction of an origin. | |
static proto void | ConePoints (vector origin, float length, float halfAngle, float angleOffset, out vector leftPoint, out vector rightPoint) |
Calculates the points of a right 2D cone in 3D space. | |
static proto void | BlendCartesian (vector samplePosition, notnull array< vector > inPositions, notnull array< float > outWeights) |
enum ECurveType |
|
staticprivate |
Angle that a target is from the direction of an origin.
float
Angle in radians Referenced by EvaluateComponentEx(), EvaluateHit_Player(), DayZInfected::FightLogic(), GetMeleeTargetEx(), and ScriptConsoleSoundsTab::UpdateMousePos().
|
staticprivate |
Output 2D blend space weights for inPositions
when sampled at samplePosition
samplePosition | [X, Y, unused] coordinate to sample the 2d space |
inPositions | [X, Y, unused] positions in the 2d space |
outWeights | Output weights for individual nodes 1:1 to inPositions |
Referenced by Blend2D< Class T >::Blend().
|
staticprivate |
Returns 1, when bounding boxes intersects.
mins1 | vector minimum point of first bounding box |
maxs1 | vector maximum point of first bounding box |
mins2 | vector minimum point of second bounding box |
maxs2 | vector maximum point of second bounding box |
int
1 if boundig boxes intersects, otherwise 0
|
staticprivate |
Calculates the points of a right 2D cone in 3D space.
origin | vector Origin of cone | |
length | float Length of the cone | |
halfAngle | float Half of the angle of the cone in radians | |
angleOffset | float Angle offset of the cone in radians (handy for rotating it along with something in the world) | |
[out] | leftPoint | vector Left point of the cone |
[out] | rightPoint | vector Right point of the cone |
Referenced by Debug::DrawCone(), and MeleeTargetSettings().
|
staticprivate |
Computes curve.
vector
Referenced by RecoilBase::GetPositionOnCurve(), and KuruShake::Update().
Creates rotation matrix from direction and up vector.
dir | vector direction vector | |
up | vector up vector | |
[out] | mat | vector [4] created rotation matrix vector mat[4];
vector dir = "1 0 1";
vector up = "0 1 0";
DirectionAndUpMatrix( dir, up, mat );
Print( mat );
>> <0.707107,0,-0.707107>,<0,1,0>,<0.707107,0,0.707107>,<0,0,0>
static proto void DirectionAndUpMatrix(vector dir, vector up, out vector mat[4]) Creates rotation matrix from direction and up vector. |
Referenced by PluginBase::CalculatePos(), DayZIntroScene::DayZIntroScene(), and FloatingCrossHair().
|
inlinestaticprivate |
Returns randon normalized direction.
vector
References vector::Normalized(), Math::RandomFloatInclusive(), Vector(), x, and y.
|
staticprivate |
Tests whether cylinder is intersecting oriented box.
mins | vector Minimums of bound box |
maxs | vector Maximums of bound box |
obbMat | vector Transform of box |
cylMat | vector Transform of cylinder |
cylinderRadius | float Radius of cylinder |
cylinderHeight | float Height of cylinder |
bool
True when cylinder is intersecting oriented box Referenced by CfgPlayerRestrictedAreaHandler::IsCylinderInAreaBox().
|
staticprivate |
Tests whether ray is intersecting axis aligned box.
start | vector Start of ray |
end | vector End of ray |
mins | vector Minimums of bound box |
maxs | vector Maximums of bound box |
float
-1 when not intersecting, else the fraction of ray
|
staticprivate |
Tests whether ray is intersecting cylinder.
rayStart | vector Start of ray |
rayEnd | vector End of ray |
center | vector Center of cylinder |
radius | float Radius of cylinder |
height | float Height of cylinder |
bool
True when ray is intersecting cylinder
|
staticprivate |
Tests whether ray is intersecting plane.
rayStart | vector Start of ray |
rayEnd | vector End of ray |
planeNormal | vector Normal of the plane |
planeDist | float Length of the plane |
intersection | vector Intersection point of the plane, only valid when return is 3 |
int
1 when behind, 2 when in front and 3 when intersecting the plane
|
staticprivate |
Tests whether ray is intersecting sphere.
raybase | vector Start of ray |
raycos | vector End of ray |
center | vector Center of sphere |
radius | float Radius of sphere |
float
-1 when not intersecting, else the fraction of ray
|
staticprivate |
Tests whether sphere is intersecting axis aligned box.
origin | vector Origin of sphere |
radius | float Radius of sphere |
mins | vector Minimums of bound box |
maxs | vector Maximums of bound box |
bool
True when intersects
|
staticprivate |
Tests whether sphere is intersecting cone.
origin | vector Origin of sphere |
radius | float Radius of sphere |
conepos | vector Position of top of cone |
axis | vector Orientation of cone in direction from top to bottom |
angle | float Angle of cone in radians |
bool
True when sphere is intersecting cone
|
staticprivate |
Tests whether sphere is fully inside cone.
origin | vector Origin of sphere |
radius | float Radius of sphere |
conepos | vector Position of top of cone |
axis | vector Orientation of cone in direction from top to bottom |
angle | float Angle of cone in radians |
bool
True when sphere is fully inside cone
|
inlineprivate |
|
inlinestaticprivate |
Creates identity matrix.
[out] | mat | created identity matrix vector mat[3];
Math3D.MatrixIdentity3( mat );
Print( mat );
>> <1,0,0>,<0,1,0>,<0,0,1>
static void MatrixIdentity3(out vector mat[3]) Creates identity matrix. Definition EnMath3D.c:275 |
|
inlinestaticprivate |
Creates identity matrix.
[out] | mat | created identity matrix vector mat[4];
Math3D.MatrixIdentity4( mat );
Print( mat );
>> <1,0,0>,<0,1,0>,<0,0,1>,<0,0,0>
static void MatrixIdentity4(out vector mat[4]) Creates identity matrix. Definition EnMath3D.c:256 |
References vector::Zero.
Referenced by PluginBase::CalculatePos(), DropEquipAndDestroyRootLambda::CopyOldPropertiesToNew(), DayZIntroScene::DayZIntroScene(), ArrowManagerBase::DropArrow(), FireplaceToIndoorOvenLambda(), FireplaceToIndoorsLambda(), HandleDropMagazine(), CfgPlayerRestrictedAreaHandler::IsCylinderInAreaBox(), ManBase::PredictiveDropEntity(), ReplaceItemWithNewLambdaBase::PrepareLocations(), RemoveAllAttachedChildrenByTypename(), GameInventory::SetGroundPosByOwner(), Entity::SpawnEntityOnGroundPos(), ManBase::SpawnEntityOnGroundPos(), and SpawnItems().
|
staticprivate |
Inverses a matrix.
[it] | mat matrix which should be inversed |
|
staticprivate |
Inverses a matrix.
[it] | mat matrix which should be inversed |
|
staticprivate |
Invert-transforms rotation matrix.
mat0 | vector [3] first matrix | |
mat1 | vector [3] second matrix | |
[out] | res | vector [3] result of first and second matrix multiplication vector res[3];
Math3D.MatrixInvMultiply3(mat0, mat1, res)
Print( res );
>> <2.5,0.62,0>,<2.5,1.3,0>,<3.25,1.69,2.7>
static proto void MatrixInvMultiply3(vector mat0[3], vector mat1[3], out vector res[3]) Invert-transforms rotation matrix. |
Referenced by OnUpdate().
|
staticprivate |
Invert-transforms matrix.
mat0 | vector [4] first matrix | |
mat1 | vector [4] second matrix | |
[out] | res | vector [4] inverse result of first and second matrix multiplication vector res[4];
Math3D.MatrixInvMultiply4(mat0, mat1, res)
Print( res );
>> <2,0,0>,<0,3,1>,<0,3,1>,<4,12,4>
static proto void MatrixInvMultiply4(vector mat0[4], vector mat1[4], out vector res[4]) Invert-transforms matrix. |
Referenced by AddArrow(), IEntity::AddArrow(), DayZInfected::AddArrow(), and ManBase::AddArrow().
|
staticprivate |
Transforms rotation matrix.
mat0 | vector [3] first matrix | |
mat1 | vector [3] second matrix | |
[out] | res | vector [3] result of first and second matrix multiplication vector res[3];
Math3D.MatrixMultiply3(mat0, mat1, res)
Print( res );
>> <1.54,3.02,0>,<0.1,1.3,0>,<0.13,1.69,2.7>
static proto void MatrixMultiply3(vector mat0[3], vector mat1[3], out vector res[3]) Transforms rotation matrix. |
Referenced by Hologram::AlignProjectionOnTerrain(), and Weapon::ApproximateWeaponLiftTransform().
|
staticprivate |
Transforms matrix.
mat0 | vector [4] first matrix | |
mat1 | vector [4] second matrix | |
[out] | res | vector [4] result of first and second matrix multiplication vector res[4];
Math3D.MatrixMultiply4(mat0, mat1, res)
Print( res );
>> <2,0,0>,<0,3,0>,<0,3,0>,<4,13,0>
static proto void MatrixMultiply4(vector mat0[4], vector mat1[4], out vector res[4]) Transforms matrix. |
Referenced by EntityAI::IsAreaAtDoorFree(), and DayZPlayerCameraBase::OnUpdate().
|
staticprivate |
Orthogonalizes matrix.
[it] | mat matrix which should be orthogonalized |
|
staticprivate |
Orthogonalizes matrix.
[it] | mat matrix which should be orthogonalized |
Referenced by AddArrow(), IEntity::AddArrow(), DayZInfected::AddArrow(), and ManBase::AddArrow().
Returns angles of rotation matrix.
mat | vector [3] rotation matrix |
vector
roll, pitch, yaw angles Referenced by Hologram::AlignProjectionOnTerrain(), FloatingCrossHair(), EntityAI::IsAreaAtDoorFree(), and OnUpdate().
Converts rotation matrix to quaternion.
mat | vector [3] rotation matrix | |
[out] | d | float [4] created quaternion copy vector mat[3];
vector rot = "70 15 45";
rot.RotationMatrixFromAngles( mat );
float d[4];
Math3D.MatrixToQuat( mat, d );
Print( d );
>> {0.241626,0.566299,-0.118838,0.778973}
proto void RotationMatrixFromAngles(out vector mat[3]) Creates rotation matrix from angles. static proto void MatrixToQuat(vector mat[3], out float d[4]) Converts rotation matrix to quaternion. |
Referenced by ActionRepackTentCB::DropDuringRepacking(), FloatingCrossHair(), ActionDeployBase::MoveEntityToFinalPosition(), ItemBase::OnPlacementComplete(), and ThrowAllItemsInInventory().
Point on line beg .. end nearest to pos.
vector
Referenced by EvaluateComponentEx(), and GetMeleeTargetEx().
Copies quaternion.
s | float [4] quaternion to copy | |
[out] | d | float [4] created quaternion copy float s[4] = { 2, 3, 4, 1 };
float d[4];
Print( d );
>> {2,3,4,1}
static void QuatCopy(float s[4], out float d[4]) Copies quaternion. Definition EnMath3D.c:337 |
|
inlinestaticprivate |
Creates identity quaternion.
[out] | q | float [4] created identity quaternion float q[4];
Math3D.QuatIdentity( q );
Print( q );
>> {0,0,0,1}
static void QuatIdentity(out float q[4]) Creates identity quaternion. Definition EnMath3D.c:316 |
|
staticprivate |
Linear interpolation between q1 and q2 with weight 'frac' (0...1)
[out] | qout | float [4] result quaternion |
q1 | float [4] first quaternion | |
q2 | float [4] second quaternion | |
frac | float interpolation weight float q1[4] = { 1, 1, 1, 1 };
float q2[4] = { 2, 2, 2, 1 };
float qout[4];
Print( qout );
>> {1.5,1.5,1.5,1}
static proto void QuatLerp(out float qout[4], float q1[4], float q2[4], float frac) Linear interpolation between q1 and q2 with weight 'frac' (0...1) |
Referenced by FloatingCrossHair().
Multiplies quaternions.
[out] | qout | float [4] result quaternion |
q1 | float [4] first quaternion | |
q2 | float [4] second quaternion float q1[4] = { 1, 2, 3, 1 };
float q2[4] = { 2, 2, 2, 1 };
float qout[4];
Math3D.QuatMultiply( qout, q1, q2 );
Print( qout );
>> {2,4,6,1}
static proto void QuatMultiply(out float qout[4], float q1[4], float q2[4]) Multiplies quaternions. |
Returns Angles vector from quaternion.
Referenced by UIScriptedMenu::SetCameraData(), and UIScriptedMenu::Update().
Converts quaternion to rotation matrix.
Referenced by FloatingCrossHair().
Creates scale matrix.
scale | scale coeficient | |
[out] | mat | created scale matrix vector mat[3];
Math3D.ScaleMatrix( 2.5, mat );
Print( mat );
>> <2.5,0,0>,<0,2.5,0>,<0,0,2.5>
static void ScaleMatrix(float scale, out vector mat[3]) Creates scale matrix. Definition EnMath3D.c:294 |
Vector constructor from components.
x | float x component |
y | float y component |
z | float z component |
vector
resulting vector Referenced by Weapon::ApproximateWeaponLiftTransform(), vector::ArrayToVec(), Blend2D< Class T >::Blend(), Hit_MeatBones::BloodSplatGround(), PluginBase::CalculatePos(), DayZIntroSceneXbox::CameraCreate(), CarLightBase::CarRearLight(), TentBase::CarTent(), Math::CenterOfRectangle(), WeaponParticlesBase::CheckOrientationOverride(), CarLightBase::CivilianSedanFrontLight(), CarRearLightBase::CivilianSedanRearLight(), CGame::CloseCombatEffects(), CreateBridgeArrow(), Car::CreateCarDestroyedEffect(), Particle::CreateOnObject(), SceneData::CreateScenePlayer(), EffectAreaLoader::CreateZones(), DayZIntroScene::DayZIntroScene(), CGame::DelayedMidAirDetonation(), EntityLightSource::DetachFromParent(), PoweredOptic_Base::DoMeasurement(), ItemBase::DoMeasurement(), Debug::DrawCone(), CfgPlayerRestrictedAreaHandler::DrawPolygonLinesDebug(), UniversalTemperatureSourceLambdaBaseImpl::DryItemsInVicinity(), BuildingSuper::EEInit(), Misc_TirePile_Burning_DE::EEInit(), UniversalTemperatureSourceLambdaBaseImpl::Execute(), Explode(), FilterObstructedObjectsByGrouping(), FlareSimulation::FlareParticleUpdate(), FloatingCrossHair(), GatherTemperatureSources(), GameplayEffectsData::GenerateSequenceRandomPosition(), Weapon_Base::GetApproximateMovementOffset(), Weapon::GetApproximateMovementOffset(), GetBoxCenter(), IEntity::GetCenter(), GetCollisionBoxSize(), Hologram::GetCollisionBoxSize(), GetCurrentOrientation(), GetFireEffectPosition(), ScriptedWidgetEventHandler::GetItemSize(), GetMeleeTarget(), GetMeleeTargetEx(), GetMouseDistance(), JsonUndergroundAreaTriggerData::GetOrientation(), JsonUndergroundAreaTriggerData::GetPosition(), SceneObject::GetPosition(), SceneObject::GetPositionAsString(), GetPositionRandomized(), Math3D::GetRandomDir(), GetRandomizedPosition(), GetRandomPos(), DynamicMusicLocationDynamicData::GetRectangularCoordsFromSize(), JsonUndergroundAreaTriggerData::GetSize(), SceneObject::GetSize(), GetSmokeEffectPosition(), FireplaceIndoor::GetSmokeEffectPosition(), FireplaceBase::GetSmokeEffectPosition(), EntityLightSource::HandleDancingShadows(), CarLightBase::Hatchback_02FrontLight(), CarRearLightBase::Hatchback_02RearLight(), BroomBase::Init(), UIScriptedMenu::Init(), Barrel_ColorBase::InitItemVariables(), InitPRAShapeData(), Blend2D< Class T >::Insert(), IsColliding(), IsCollidingEx(), Hologram::IsCollidingZeroPos(), IsEntityBehindEntityInAngle(), IsSpaceFor(), IsSpaceForCircle(), IsSpaceForOven(), IsUnderRoofFromToCalculation(), LargeTent(), MissionBenchmark::LerpCamera(), Weapon::LiftWeaponCheckEx(), LongTorch::LongTorch(), TentBase::MediumTent(), CarLightBase::Offroad_02FrontLight(), CarRearLightBase::Offroad_02RearLight(), CarLightBase::OffroadHatchbackFrontLight(), CarRearLightBase::OffroadHatchbackRearLight(), WeaponParticlesBase::OnActivate(), FlareSimulation::OnActivation(), ItemBase::OnDebugSpawn(), MapHandler::OnDoubleClick(), ScriptConsoleGeneralTab::OnDoubleClick(), OnDraggingEnd(), FireworksLauncherClientEvent::OnFired(), PointLightBase::OnFrameLightSource(), ItemBase::OnInventoryExit(), Roadflare::OnInventoryExit(), Switchable_Base::OnInventoryExit(), MapHandler::OnKeyDown(), UIScriptedMenu::OnShow(), DayZPlayer::OnStepEvent(), OnUpdateClient(), Roadflare::OnWorkStart(), TentBase::PartyTent(), ScriptConsoleGeneralTab::ProcessTeleportText(), vector::RandomDir(), vector::RandomDir2D(), Particle::RandWiggleVector(), DayZIntroScene::ResetIntroCamera(), SeaChest::SeaChest(), CarLightBase::Sedan_02FrontLight(), CarRearLightBase::Sedan_02RearLight(), PluginBase::SelectedObjectDuplicate(), GameInventory::SetGroundPosByOwnerBounds(), UIScriptedMenu::SetItem(), Hologram::SetOnGround(), AreaDamageComponentRaycasted::SetRaycastLength(), SetWaterLevelHeight(), TentBase::ShelterBase(), DayZIntroScene::SnapToGround(), DayZIntroSceneXbox::SnapToGround(), CrashBase::SpawnRandomDeers(), ThrowAllItemsInInventory(), PlayerRestrictedAreaInstance::TranslateSafePositions(), CarLightBase::Truck_01FrontLight(), CarRearLightBase::Truck_01RearLight(), TruncateVec(), FlammableBase::TryTransformIntoStick(), ScriptedWidgetEventHandler::UpdateItems(), InventoryGridController::UpdateItems(), FlammableBase::UpdateLight(), CGame::UpdatePathgraphRegionByObject(), UIScriptedMenu::UpdateQuickbarItemCard(), ScriptedWidgetEventHandler::UpdateQuickbarItems(), PlayerRestrictedAreaInstance::ValidatePlayerRestrictedAreaPositions(), WeaponParticlesBase::WeaponParticlesBase(), WoodenCrate::WoodenCrate(), CrashBase::Wreck_Mi8_Crashed(), and CrashBase::Wreck_UH1Y().
Creates rotation matrix from angles.
ang | vector which contains angles | |
[out] | mat | vector created rotation matrix vector mat[3];
YawPitchRollMatrix( "70 15 45", mat );
Print( mat );
>> <0.330366,0.0885213,-0.939693>,<0.458809,0.854988,0.241845>,<0.824835,-0.511037,0.241845>
static proto void YawPitchRollMatrix(vector ang, out vector mat[3]) Creates rotation matrix from angles. |
Referenced by AddArrow(), DayZInfected::AddArrow(), ManBase::AddArrow(), Hologram::AlignProjectionOnTerrain(), Weapon::ApproximateWeaponLiftTransform(), ActionRepackTentCB::DropDuringRepacking(), InitPRAShapeData(), ActionDeployBase::MoveEntityToFinalPosition(), ItemBase::OnPlacementComplete(), DayZPlayerCameraBase::OnUpdate(), OnUpdate(), and ThrowAllItemsInInventory().
|
inlineprivate |