Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

MATHLIB.H File Reference

#include <math.h>

Include dependency graph for MATHLIB.H:

Include dependency graph

Go to the source code of this file.

Defines

#define DEG2RAD(a)   ( ( (a) * Q_PI ) / 180.0f )
#define DotProduct(x, y)   (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
#define EQUAL_EPSILON   0.001
#define Q_PI   3.14159265358979323846
#define RAD2DEG(a)   ( ( (a) * 180.0f ) / Q_PI )
#define SIDE_BACK   1
#define SIDE_CROSS   -2
#define SIDE_FRONT   0
#define SIDE_ON   2
#define VectorAdd(a, b, c)   {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
#define VectorClear(x)   {x[0] = x[1] = x[2] = 0;}
#define VectorCopy(a, b)   {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
#define VectorSet(v, a, b, c)   {v[0]=a;v[1]=b;v[2]=c;}
#define VectorSubtract(a, b, c)   {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}
#define ZERO_EPSILON   1.0E-6

Typedefs

typedef vec_t vec3_t [3]
typedef vec_t vec5_t [5]
typedef float vec_t

Functions

vec_t _DotProduct (vec3_t v1, vec3_t v2)
void _Vector53Copy (vec5_t in, vec3_t out)
void _Vector5Add (vec5_t va, vec5_t vb, vec5_t out)
void _Vector5Scale (vec5_t v, vec_t scale, vec5_t out)
void _VectorAdd (vec3_t va, vec3_t vb, vec3_t out)
void _VectorCopy (vec3_t in, vec3_t out)
void _VectorSubtract (vec3_t va, vec3_t vb, vec3_t out)
void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs)
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
void ClearBounds (vec3_t mins, vec3_t maxs)
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross)
vec_t Q_rint (vec_t in)
qboolean VectorCompare (vec3_t v1, vec3_t v2)
void VectorInverse (vec3_t v)
float VectorLength (vec3_t v)
void VectorMA (vec3_t va, float scale, vec3_t vb, vec3_t vc)
vec_t VectorNormalize (vec3_t v)
void VectorPolar (vec3_t v, float radius, float theta, float phi)
void VectorScale (vec3_t v, vec_t scale, vec3_t out)
void VectorSnap (vec3_t v)
void VectorToAngles (vec3_t vec, vec3_t angles)

Variables

vec3_t vec3_origin


Define Documentation

#define DEG2RAD  )     ( ( (a) * Q_PI ) / 180.0f )
 

Definition at line 83 of file MATHLIB.H.

#define DotProduct x,
y   )     (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
 

Definition at line 46 of file MATHLIB.H.

#define EQUAL_EPSILON   0.001
 

Definition at line 42 of file MATHLIB.H.

#define Q_PI   3.14159265358979323846
 

Definition at line 38 of file MATHLIB.H.

#define RAD2DEG  )     ( ( (a) * 180.0f ) / Q_PI )
 

Definition at line 82 of file MATHLIB.H.

#define SIDE_BACK   1
 

Definition at line 35 of file MATHLIB.H.

#define SIDE_CROSS   -2
 

Definition at line 36 of file MATHLIB.H.

#define SIDE_FRONT   0
 

Definition at line 33 of file MATHLIB.H.

#define SIDE_ON   2
 

Definition at line 34 of file MATHLIB.H.

#define VectorAdd a,
b,
 )     {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
 

Definition at line 48 of file MATHLIB.H.

#define VectorClear  )     {x[0] = x[1] = x[2] = 0;}
 

Definition at line 79 of file MATHLIB.H.

#define VectorCopy a,
 )     {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
 

Definition at line 49 of file MATHLIB.H.

#define VectorSet v,
a,
b,
 )     {v[0]=a;v[1]=b;v[2]=c;}
 

Definition at line 50 of file MATHLIB.H.

#define VectorSubtract a,
b,
 )     {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}
 

Definition at line 47 of file MATHLIB.H.

#define ZERO_EPSILON   1.0E-6
 

Definition at line 81 of file MATHLIB.H.

Referenced by TexMatToFakeTexCoords().


Typedef Documentation

typedef vec_t vec3_t[3]
 

Definition at line 30 of file MATHLIB.H.

typedef vec_t vec5_t[5]
 

Definition at line 31 of file MATHLIB.H.

typedef float vec_t
 

Definition at line 29 of file MATHLIB.H.


Function Documentation

vec_t _DotProduct vec3_t  v1,
vec3_t  v2
 

Definition at line 170 of file l_math.c.

References v1, v2, and vec_t.

Referenced by CapSpecial().

00171 {
00172     return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
00173 }

void _Vector53Copy vec5_t  in,
vec3_t  out
 

Definition at line 203 of file MATHLIB.CPP.

References in.

Referenced by Patch_FromTriangle().

00204 {
00205     out[0] = in[0];
00206     out[1] = in[1];
00207     out[2] = in[2];
00208 }

void _Vector5Add vec5_t  va,
vec5_t  vb,
vec5_t  out
 

Definition at line 185 of file MATHLIB.CPP.

References va().

Referenced by Patch_FromTriangle().

00186 {
00187     out[0] = va[0]+vb[0];
00188     out[1] = va[1]+vb[1];
00189     out[2] = va[2]+vb[2];
00190     out[3] = va[3]+vb[3];
00191     out[4] = va[4]+vb[4];
00192 }

Here is the call graph for this function:

void _Vector5Scale vec5_t  v,
vec_t  scale,
vec5_t  out
 

Definition at line 194 of file MATHLIB.CPP.

References v.

Referenced by Patch_FromTriangle().

00195 {
00196     out[0] = v[0] * scale;
00197     out[1] = v[1] * scale;
00198     out[2] = v[2] * scale;
00199     out[3] = v[3] * scale;
00200     out[4] = v[4] * scale;
00201 }

void _VectorAdd vec3_t  va,
vec3_t  vb,
vec3_t  out
 

Definition at line 182 of file l_math.c.

References va().

00183 {
00184     out[0] = va[0]+vb[0];
00185     out[1] = va[1]+vb[1];
00186     out[2] = va[2]+vb[2];
00187 }

Here is the call graph for this function:

void _VectorCopy vec3_t  in,
vec3_t  out
 

Definition at line 189 of file l_math.c.

References in.

Referenced by CXYWnd::AddPointPoint().

00190 {
00191     out[0] = in[0];
00192     out[1] = in[1];
00193     out[2] = in[2];
00194 }

void _VectorSubtract vec3_t  va,
vec3_t  vb,
vec3_t  out
 

Definition at line 175 of file l_math.c.

References va().

00176 {
00177     out[0] = va[0]-vb[0];
00178     out[1] = va[1]-vb[1];
00179     out[2] = va[2]-vb[2];
00180 }

Here is the call graph for this function:

void AddPointToBounds vec3_t  v,
vec3_t  mins,
vec3_t  maxs
 

Definition at line 276 of file l_math.c.

References i, v, and vec_t.

Referenced by AAS_FixMapBrush(), AAS_MakeBrushWindings(), AAS_StoreArea(), AllocateLightmapForSurface(), BeginModel(), BoundBrush(), BrushBSP(), CalcNodeBounds(), CalcTerrainSize(), CEpairsWrapper::CalculateRotatedBounds(), CM_GeneratePatchCollide(), Face_FitTexture(), FaceBSP(), FogDrawSurfs(), HL_CreateBrushesFromBSP(), InitSurfacesForTesting(), LoadMapFile(), MakeBrushWindings(), ParseTriSurf(), PatchMapDrawSurfs(), Q1_CreateBrushesFromBSP(), Q2_LoadMapFile(), Q2_LoadMapFromBSP(), Q3_LoadMapFromBSP(), R_CreateSurfaceGridMesh(), R_MarkFragments(), RE_AddPolyToScene(), Sin_LoadMapFromBSP(), SubdivideDrawSurf(), TH_CreateTriangle(), Think_SpawnNewDoorTrigger(), VL_InitSurfacesForTesting(), VL_LightmapMatrixFromPoints(), VS_InitSurfacesForTesting(), and VS_LightmapMatrixFromPoints().

00277 {
00278     int     i;
00279     vec_t   val;
00280 
00281     for (i=0 ; i<3 ; i++)
00282     {
00283         val = v[i];
00284         if (val < mins[i])
00285             mins[i] = val;
00286         if (val > maxs[i])
00287             maxs[i] = val;
00288     }
00289 }

void AngleVectors vec3_t  angles,
vec3_t  forward,
vec3_t  right,
vec3_t  up
 

Definition at line 29 of file l_math.c.

References cos(), cp, M_PI, right, sin(), and up.

Referenced by AAS_Reachability_Teleport(), AAS_SetMovedir(), AAS_WeaponJumpZVelocity(), AnglesToAxis(), BotAIBlocked(), BotCheckAttack(), BotExportTest(), BotGetLongTermGoal(), BotInputToUserCommand(), BotRandomMove(), BotSetMovedir(), CG_AddParticles(), CG_AddParticleToScene(), CG_CalcMuzzlePoint(), CG_DamageFeedback(), CG_GrappleTrail(), CG_LightningBolt(), CG_OffsetFirstPersonView(), CG_OffsetThirdPersonView(), CG_ParticleBloodCloud(), CG_ParticleDust(), CheckGauntletAttack(), CM_TransformedPointContents(), CreateRotationMatrix(), Drop_Item(), FacingVectors(), FireWeapon(), G_CreateRotationMatrix(), G_SetMovedir(), G_TryPushingProxMine(), Pickup_Powerup(), PmoveSingle(), PodiumPlacementThink(), SpawnModelOnVictoryPad(), SpawnPodium(), SV_GameSystemCalls(), TeleportPlayer(), UI_MovedirAdjustment(), and ValidBloodPool().

00030 {
00031     float       angle;
00032     static float        sr, sp, sy, cr, cp, cy;
00033     // static to help MS compiler fp bugs
00034 
00035     angle = angles[YAW] * (M_PI*2 / 360);
00036     sy = sin(angle);
00037     cy = cos(angle);
00038     angle = angles[PITCH] * (M_PI*2 / 360);
00039     sp = sin(angle);
00040     cp = cos(angle);
00041     angle = angles[ROLL] * (M_PI*2 / 360);
00042     sr = sin(angle);
00043     cr = cos(angle);
00044 
00045     if (forward)
00046     {
00047         forward[0] = cp*cy;
00048         forward[1] = cp*sy;
00049         forward[2] = -sp;
00050     }
00051     if (right)
00052     {
00053         right[0] = (-1*sr*sp*cy+-1*cr*-sy);
00054         right[1] = (-1*sr*sp*sy+-1*cr*cy);
00055         right[2] = -1*sr*cp;
00056     }
00057     if (up)
00058     {
00059         up[0] = (cr*sp*cy+-sr*-sy);
00060         up[1] = (cr*sp*sy+-sr*cy);
00061         up[2] = cr*cp;
00062     }
00063 }

Here is the call graph for this function:

void ClearBounds vec3_t  mins,
vec3_t  maxs
 

Definition at line 270 of file l_math.c.

Referenced by AAS_FixMapBrush(), AAS_MakeBrushWindings(), AAS_StoreArea(), AllocateLightmapForSurface(), AllocTree(), BeginModel(), BoundBrush(), CalcNodeBounds(), CalcTerrainSize(), CEpairsWrapper::CalculateRotatedBounds(), CM_GeneratePatchCollide(), Face_FitTexture(), FogDrawSurfs(), HL_LoadMapFromBSP(), InitSurfacesForTesting(), LoadMapFile(), MakeBrushWindings(), ParseTriSurf(), PatchMapDrawSurfs(), Q1_LoadMapFromBSP(), Q2_LoadMapFile(), Q2_LoadMapFromBSP(), Q3_LoadMapFromBSP(), R_AddWorldSurfaces(), R_CreateSurfaceGridMesh(), R_MarkFragments(), Sin_LoadMapFromBSP(), SubdivideDrawSurf(), TH_CreateTriangle(), Tree_Alloc(), VL_InitSurfacesForTesting(), VL_LightmapMatrixFromPoints(), VS_InitSurfacesForTesting(), and VS_LightmapMatrixFromPoints().

00271 {
00272     mins[0] = mins[1] = mins[2] = 99999;
00273     maxs[0] = maxs[1] = maxs[2] = -99999;
00274 }

void CrossProduct vec3_t  v1,
vec3_t  v2,
vec3_t  cross
 

Definition at line 156 of file l_math.c.

References v1, and v2.

Referenced by AAS_DrawArrow(), AAS_FaceArea(), AAS_PointInsideFace(), AAS_Reachability_EqualFloorHeight(), AAS_Reachability_Jump(), AAS_Reachability_Ladder(), AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(), AAS_Reachability_WalkOffLedge(), AbsoluteToLocal(), AddBrushBevels(), AddWindingToConvexHull(), Autosprite2Deform(), BaseWindingForPlane(), BotAIBlocked(), BotAttackMove(), BotImport_DebugLineShow(), CalcTriNormal(), CG_AddScorePlum(), CG_ImpactMark(), CG_Player(), CG_Portal(), CG_ShotgunPattern(), CheckWinding(), CM_AddFacetBevels(), CM_GenerateBoundaryForPoints(), CM_PlaneFromPoints(), ComputeAbsolute(), CreateFilters(), DebugLine(), DeformText(), Face_MakePlane(), FindPlaneSeperatingWindings(), GenerateBoundaryForPoints(), HL_FaceOnWinding(), HL_SplitBrushWithFace(), InsideFace(), InsideWinding(), IsTriangleDegenerate(), MakeMeshNormals(), MakeNormalVectors(), MapPlaneFromPoints(), MergeWindings(), Patch_MeshNormals(), Plane_FromPoints(), PlaneFromPoints(), PlaneFromWinding(), PM_SlideMove(), PointOnWinding(), PointToPolygonFormFactor(), Q1_FaceArea(), Q1_FaceOnWinding(), Q1_FacePlane(), Q1_SplitBrushWithFace(), Q2_FaceOnWinding(), Q3_FaceOnWinding(), Q3_PlaneFromPoints(), Q3_SurfacePlane(), R_GetPortalOrientations(), R_MarkFragments(), RayTriangleIntersect(), RB_DrawSun(), RB_ShadowTessEnd(), RB_SurfaceLightningBolt(), RB_SurfaceRailCore(), RotateAroundDirection(), RotatePointAroundVector(), ShotgunPattern(), Sin_FaceOnWinding(), TH_Colinear(), TH_CreateTrianglePlanes(), TH_PlaneFromPoints(), TH_TryTriangle(), TryMergeWinding(), Use_Shooter(), VL_FloodDirectedLight(), VL_FloodLight(), VL_GenerateBoundaryForPoints(), VL_PlaneFromPoints(), VL_PlaneFromWinding(), VL_R_FloodLight(), VL_SmoothenLightmapEdges(), VS_FloodDirectedLight(), VS_FloodLight(), VS_GenerateBoundaryForPoints(), VS_PlaneFromPoints(), VS_PlaneFromWinding(), VS_R_FloodLight(), VS_SmoothenLightmapEdges(), Winding_Area(), Winding_BaseForPlane(), Winding_Plane(), Winding_PointInside(), Winding_TryMerge(), WindingArea(), WindingError(), and WindingPlane().

00157 {
00158     cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
00159     cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
00160     cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
00161 }

vec_t Q_rint vec_t  in  ) 
 

Definition at line 151 of file l_math.c.

References floor(), g_PrefsDlg, in, CPrefsDlg::m_bNoClamp, and vec_t.

Referenced by AAS_GetVertex(), Brush_CreatePyramid(), GetVertexnum(), SnapPlane(), TH_FindVertex(), TH_SnapPlane(), WriteFloat(), and WriteFloat2().

00152 {
00153     return floor(in + 0.5);
00154 }

Here is the call graph for this function:

qboolean VectorCompare vec3_t  v1,
vec3_t  v2
 

Definition at line 140 of file l_math.c.

References fabs(), i, qboolean, v1, and v2.

Referenced by AAS_SetMovedir(), AAS_UpdateEntity(), AddPatchMovePoint(), AddPoint(), AINode_Seek_ActivateEntity(), BotGetActivateGoal(), BotSetMovedir(), Brush_SideSelect(), CG_PredictPlayerState(), Face_MakePlane(), FloodEntities(), G_SetMovedir(), InitTrigger(), Patch_CapCurrent(), Patch_DragScale(), PointValueInMoveList(), and Terrain_DragScale().

00141 {
00142     int     i;
00143     
00144     for (i=0 ; i<3 ; i++)
00145         if (fabs(v1[i]-v2[i]) > EQUAL_EPSILON)
00146             return false;
00147             
00148     return true;
00149 }

Here is the call graph for this function:

void VectorInverse vec3_t  v  ) 
 

Definition at line 263 of file l_math.c.

References v.

Referenced by AAS_BoxOriginDistanceFromPlane(), AAS_CheckFaceWindingPlane(), AAS_FindBestAreaSplitPlane(), AAS_GapFace(), AAS_GroundFace(), AAS_PositionFuncRotatingBrush(), AAS_Reachability_EqualFloorHeight(), BoxOriginDistanceFromPlane(), CG_Player(), CreateRotationMatrix(), G_CreateRotationMatrix(), R_MarkFragments(), VL_ChopWindingWithBrush(), VL_CreateSkyLights(), VL_FloodDirectedLight(), VL_FloodLight(), VL_R_FloodLight(), VL_SplitLightVolume(), VL_WindingForBrushSide(), VS_ChopWindingWithBrush(), VS_CreateSkyLights(), VS_FloodDirectedLight(), VS_FloodLight(), VS_R_FloodLight(), VS_SplitLightVolume(), and VS_WindingForBrushSide().

00264 {
00265     v[0] = -v[0];
00266     v[1] = -v[1];
00267     v[2] = -v[2];
00268 }

float VectorLength vec3_t  v  ) 
 

Definition at line 127 of file l_math.c.

References i, length(), sqrt(), and v.

Referenced by AAS_AlternativeRouteGoals(), AAS_AreaTravelTime(), AAS_FaceArea(), AAS_FindFaceReachabilities(), AAS_NearestEntity(), AAS_NearestHideArea(), AAS_Reachability_EqualFloorHeight(), AAS_Reachability_Grapple(), AAS_Reachability_Jump(), AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(), AAS_TraceClientBBox(), AAS_WeaponJumpZVelocity(), AutospriteDeform(), BotAimAtEnemy(), BotClearPath(), BotCTFSeekGoals(), BotFindEntityForLevelItem(), BotFinishTravel_FuncBobbing(), BotFuzzyPointReachabilityArea(), BotNearestVisibleItem(), BotTravel_Elevator(), BotTravel_FuncBobbing(), BotTravel_Grapple(), BotTravel_WalkOffLedge(), BotUpdateBattleInventory(), BotUpdateEntityItems(), BotWalkInDirection(), CG_AddFallScaleFade(), CG_AddMoveScaleFade(), CG_AddScaleFade(), CG_AddScorePlum(), CG_DamageFeedback(), CG_ParticleBloodCloud(), CG_ParticleDust(), CG_PredictPlayerState(), CheckAlmostCapture(), CheckAlmostScored(), CheckWinding(), CM_NeedsSubdivision(), CM_TraceThroughSphere(), CM_TraceThroughVerticalCylinder(), ColinearEdge(), ComputeColors(), CreateNewFloatPlane(), Distance(), DistancePointToLine(), FilterTrace(), FindPlaneSeperatingWindings(), G_BounceMissile(), G_MissileImpact(), G_RadiusDamage(), HL_TextureBrushes(), InitMover(), IsTriangleDegenerate(), LightContributionToPoint(), LightingAtSample(), LoadCfgFile(), MakeMeshNormals(), MergeWindings(), ParseMesh(), Patch_Height(), Patch_HeightDistanceTo(), Patch_MeshNormals(), Patch_Width(), Patch_WidthDistanceTo(), PM_DeadMove(), PM_Friction(), PM_GrappleMove(), PM_NoclipMove(), PM_WalkMove(), PM_WaterMove(), Q1_FaceArea(), Q1_TextureBrushes(), Q3_SurfacePlane(), R_CreateSurfaceGridMesh(), R_RotateForEntity(), R_SetupEntityLighting(), RadiusFromBounds(), Reached_Train(), RemoveEqualPoints(), RemoveLinearMeshColumnsRows(), SelectCurvePointByRay(), SelectEdgeByRay(), SelectNearestDeathmatchSpawnPoint(), SelectRandomFurthestSpawnPoint(), SelectVertexByRay(), SetPortalSphere(), SphereCull(), SphereFromBounds(), SubdivideMesh(), SubdivideMeshQuads(), Team_FragBonuses(), TestEdge(), TH_Colinear(), TH_CreateFloatPlane(), TraceGrid(), VectorDistance(), VL_GenerateFacetFor3Points(), VL_GenerateFacetFor4Points(), VL_LightSurfaceWithVolume(), VL_SetPortalSphere(), VL_SphereFromBounds(), VL_SurfaceRadiosity(), VS_GenerateFacetFor3Points(), VS_GenerateFacetFor4Points(), VS_LightSurfaceWithVolume(), VS_SetPortalSphere(), VS_SphereFromBounds(), VS_SurfaceRadiosity(), Winding_Area(), Winding_IsTiny(), Winding_Plane(), WindingArea(), WindingError(), WindingIsTiny(), and WindingPlane().

00128 {
00129     int     i;
00130     double  length;
00131     
00132     length = 0;
00133     for (i=0 ; i< 3 ; i++)
00134         length += v[i]*v[i];
00135     length = sqrt (length);     // FIXME
00136 
00137     return length;
00138 }

Here is the call graph for this function:

void VectorMA vec3_t  va,
float  scale,
vec3_t  vb,
vec3_t  vc
 

Definition at line 63 of file MATHLIB.CPP.

References va().

00064 {
00065     vc[0] = va[0] + scale*vb[0];
00066     vc[1] = va[1] + scale*vb[1];
00067     vc[2] = va[2] + scale*vb[2];
00068 }

Here is the call graph for this function:

vec_t VectorNormalize vec3_t  v  ) 
 

Definition at line 203 of file l_math.c.

References i, length(), sqrt(), v, vec_t, and VectorClear.

Referenced by AAS_ClientMovementPrediction(), AAS_DrawArrow(), AAS_GetJumpPadInfo(), AAS_JumpReachRunStart(), AAS_NearbySolidOrGap(), AAS_ProjectPointOntoVector(), AAS_Reachability_Elevator(), AAS_Reachability_EqualFloorHeight(), AAS_Reachability_FuncBobbing(), AAS_Reachability_Grapple(), AAS_Reachability_Jump(), AAS_Reachability_JumpPad(), AAS_Reachability_Ladder(), AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(), AAS_Reachability_WalkOffLedge(), AAS_Reachability_WeaponJump(), AAS_ShowReachability(), AAS_TestMovementPrediction(), AAS_TraceClientBBox(), AAS_WeaponJumpZVelocity(), AddBrushBevels(), AddEdge(), AddWindingToConvexHull(), AimAtTarget(), AllocateLightmapForSurface(), Autosprite2Deform(), BaseWindingForPlane(), BotAddToTarget(), BotAIBlocked(), BotAimAtEnemy(), BotAirControl(), BotAttackMove(), BotCheckBarrierJump(), BotFinishTravel_BarrierJump(), BotFinishTravel_Elevator(), BotFinishTravel_FuncBobbing(), BotFinishTravel_Jump(), BotFinishTravel_JumpPad(), BotFinishTravel_Walk(), BotFinishTravel_WalkOffLedge(), BotFinishTravel_WaterJump(), BotFinishTravel_WeaponJump(), BotGetLongTermGoal(), BotImport_DebugLineShow(), BotMoveInGoalArea(), BotRoamGoal(), BotSwimInDirection(), BotTravel_BarrierJump(), BotTravel_BFGJump(), BotTravel_Crouch(), BotTravel_Elevator(), BotTravel_FuncBobbing(), BotTravel_Grapple(), BotTravel_Jump(), BotTravel_JumpPad(), BotTravel_Ladder(), BotTravel_RocketJump(), BotTravel_Swim(), BotTravel_Teleport(), BotTravel_Walk(), BotTravel_WalkOffLedge(), BotTravel_WaterJump(), BotWalkInDirection(), CalcTriNormal(), CCamWnd::Cam_BuildMatrix(), CCamWnd::Cam_MouseDown(), CCamWnd::Cam_MouseMoved(), CapSpecial(), CG_AddScorePlum(), CG_BubbleTrail(), CG_LightningBolt(), CG_Player(), CG_PlayerAngles(), CG_PlayerFlag(), CG_RailTrail(), CG_ShotgunFire(), CG_Tracer(), CheckWinding(), CM_AddFacetBevels(), CM_GenerateBoundaryForPoints(), CM_PlaneFromPoints(), CM_TraceThroughSphere(), CM_TraceThroughVerticalCylinder(), ColinearEdge(), CreateEntityLights(), CreateFilters(), CreateTerrainSurface(), DebugLine(), DrawPathLines(), Face_MakePlane(), FindPlaneSeperatingWindings(), FindSkyBrushes(), fire_bfg(), fire_grapple(), fire_grenade(), fire_plasma(), fire_rocket(), FixFaceEdges(), G_BounceProjectile(), G_Damage(), G_MissileImpact(), GenerateBoundaryForPoints(), HL_FaceOnWinding(), HL_SplitBrushWithFace(), InsideFace(), InsideWinding(), LerpDrawVertAmount(), LightContributionToPoint(), LightingAtSample(), LinearSubdivideMesh(), locateCamera(), MakeMeshNormals(), MakeNormalVectors(), MapPlaneFromPoints(), MergeWindings(), ParseShader(), ParseShaderFile(), PerpendicularVector(), Pickup_Powerup(), Plane_FromPoints(), PlaneFromPoints(), PlaneFromWinding(), PM_Accelerate(), PM_AirMove(), PM_CheckWaterJump(), PM_DeadMove(), PM_FlyMove(), PM_GrappleMove(), PM_NoclipMove(), PM_SlideMove(), PM_WalkMove(), PM_WaterMove(), Pointfile_Next(), Pointfile_Prev(), PointOnWinding(), PointToPolygonFormFactor(), ProjectPointOntoVector(), Q1_FaceOnWinding(), Q1_FacePlane(), Q1_SplitBrushWithFace(), Q2_FaceOnWinding(), Q3_FaceOnWinding(), Q3_PlaneFromPoints(), Q3_SurfacePlane(), R_InitSkyTexCoords(), R_LerpTag(), R_SetupEntityLighting(), R_SubdividePatchToGrid(), RaySphereIntersections(), RB_SurfaceBeam(), RB_SurfaceLightningBolt(), RB_SurfaceRailCore(), RB_SurfaceRailRings(), RE_LoadWorldMap(), RemoveColinearPoints(), S_SpatializeOrigin(), SetFaceTexdef(), Sin_FaceOnWinding(), SphereCull(), SubdivideFace(), target_laser_think(), Terrain_CalcNormals(), TH_CreateTrianglePlanes(), TH_PlaneFromPoints(), TH_TryTriangle(), TraceGrid(), TryMergeWinding(), Use_Shooter(), VL_CreateEntityLights(), VL_CreateSkyLights(), VL_FloodDirectedLight(), VL_GenerateBoundaryForPoints(), VL_LightSurfaceWithVolume(), VL_PlaneFromPoints(), VL_PlaneFromWinding(), VL_R_FloodLight(), VL_SmoothenLightmapEdges(), VS_CreateEntitySpeakers(), VS_CreateSkyLights(), VS_FloodDirectedLight(), VS_GenerateBoundaryForPoints(), VS_LightSurfaceWithVolume(), VS_PlaneFromPoints(), VS_PlaneFromWinding(), VS_R_FloodLight(), VS_SmoothenLightmapEdges(), weapon_grenadelauncher_fire(), Weapon_LightningFire(), Winding_BaseForPlane(), Winding_Plane(), Winding_TryMerge(), WindingError(), and WindingPlane().

00204 {
00205     vec_t   length, ilength;
00206 
00207     length = sqrt (inout[0]*inout[0] + inout[1]*inout[1] + inout[2]*inout[2]);
00208     if (length == 0)
00209     {
00210         VectorClear (inout);
00211         return 0;
00212     }
00213 
00214     ilength = 1.0/length;
00215     inout[0] = inout[0]*ilength;
00216     inout[1] = inout[1]*ilength;
00217     inout[2] = inout[2]*ilength;
00218 
00219     return length;
00220 }

Here is the call graph for this function:

void VectorPolar vec3_t  v,
float  radius,
float  theta,
float  phi
 

Definition at line 169 of file MATHLIB.CPP.

References cos(), sin(), and v.

Referenced by Brush_MakeSidedSphere().

00170 {
00171     v[0]=float(radius * cos(theta) * cos(phi));
00172     v[1]=float(radius * sin(theta) * cos(phi));
00173     v[2]=float(radius * sin(phi));
00174 }

Here is the call graph for this function:

void VectorScale vec3_t  v,
vec_t  scale,
vec3_t  out
 

Definition at line 128 of file MATHLIB.CPP.

References v.

00129 {
00130     out[0] = v[0] * scale;
00131     out[1] = v[1] * scale;
00132     out[2] = v[2] * scale;
00133 }

void VectorSnap vec3_t  v  ) 
 

Definition at line 176 of file MATHLIB.CPP.

References floor(), i, and v.

Referenced by Eclass_hasModel().

00177 {
00178   for (int i = 0; i < 3; i++)
00179   {
00180     v[i] = floor (v[i] + 0.5);
00181   }
00182 }

Here is the call graph for this function:

void VectorToAngles vec3_t  vec,
vec3_t  angles
 

Definition at line 275 of file MATHLIB.CPP.

References atan2(), and sqrt().

00276 {
00277     float forward;
00278     float yaw, pitch;
00279     
00280     if ( ( vec[ 0 ] == 0 ) && ( vec[ 1 ] == 0 ) )
00281     {
00282         yaw = 0;
00283         if ( vec[ 2 ] > 0 )
00284         {
00285             pitch = 90;
00286         }
00287         else
00288         {
00289             pitch = 270;
00290         }
00291     }
00292     else
00293     {
00294         yaw = atan2( vec[ 1 ], vec[ 0 ] ) * 180 / M_PI;
00295         if ( yaw < 0 )
00296         {
00297             yaw += 360;
00298         }
00299         
00300         forward = ( float )sqrt( vec[ 0 ] * vec[ 0 ] + vec[ 1 ] * vec[ 1 ] );
00301         pitch = atan2( vec[ 2 ], forward ) * 180 / M_PI;
00302         if ( pitch < 0 )
00303         {
00304             pitch += 360;
00305         }
00306     }
00307     
00308     angles[ 0 ] = pitch;
00309     angles[ 1 ] = yaw;
00310     angles[ 2 ] = 0;
00311 }

Here is the call graph for this function:


Variable Documentation

vec3_t vec3_origin
 

Definition at line 27 of file l_math.c.


Generated on Thu Aug 25 17:48:23 2005 for Quake III Arena by  doxygen 1.3.9.1