My favorites
▼
|
Sign in
dogfight2008
A casual head-to-head airplane action game for two human players.
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
src
/
Dogfight2008.Common
/
0
/
Calc.cs
r6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Math;
namespace Dogfight2008.Common
{
public static class Calc
{
public const float Epsilon = 0.001f; // Unit meters; millimeter precision OK
public static bool AlmostEqual(float a, float b)
{
return Math.Abs(a - b) < Epsilon;
}
public static bool AlmostEqual(Vector3 v1, Vector3 v2)
{
return AlmostEqual(v1.X, v2.X) && AlmostEqual(v1.Y, v2.Y) && AlmostEqual(v1.Z, v2.Z);
}
public static bool AlmostZero(float a)
{
return AlmostEqual(a, 0);
}
public static bool Equal(Vector3 v1, Vector3 v2)
{
return v1.X == v2.X && v1.Y == v2.Y && v1.Z == v2.Z;
}
public static float DegreesToRadians(float degrees)
{
return 0.0174532925f * degrees;
}
public static float RadiansToDegrees(float radians)
{
return radians / 0.0174532925f;
}
public static Vector2 v(double x, double y)
{
return new Vector2((float)x, (float)y);
}
public static Vector3 v(double x, double y, double z)
{
return new Vector3((float)x, (float)y, (float)z);
}
public static Vector2 Polar(double angle, double distance)
{
return v(Math.Cos(angle) * distance, Math.Sin(angle) * distance);
}
}
}
Show details
Hide details
Change log
r2
by olof.bjarnason on Jun 11, 2008
Diff
[No log message]
Go to:
/trunk/etc/RedPlane.skp
/trunk/etc/Screenshots
...k/etc/Screenshots/2008-03-31.png
...k/etc/SemiFinishedGreenPlane.skp
...nk/etc/UnpaintedHalfAirplane.skp
/trunk/etc/YellowPlane.cpl
/trunk/etc/YellowPlane.skp
/trunk/etc/airplane.cpl
/trunk/etc/airplane.skp
/trunk/etc/backdrop.cpl
/trunk/etc/backdrop.skp
/trunk/etc/one.PNG
/trunk/etc/readme.txt
/trunk/etc/shot.skp
/trunk/etc/tower.cpl
/trunk/etc/tower.ply
/trunk/etc/yellow_xy_rectangle.cpl
/trunk/etc/yellow_xy_rectangle.skp
/trunk/setup
/trunk/setup/Dogfight2008.iss
/trunk/setup/make_install.bat
/trunk/setup/readme.txt
/trunk/src
/trunk/src/AllProjects.sln
/trunk/src/Dogfight2008
/trunk/src/Dogfight2008.Common
/trunk/src/Dogfight2008.Common/0
...rc/Dogfight2008.Common/0/Calc.cs
...gfight2008.Common/0/FixedList.cs
...8.Common/0/IntersectionResult.cs
...k/src/Dogfight2008.Common/0/Q.cs
...src/Dogfight2008.Common/0/Ray.cs
/trunk/src/Dogfight2008.Common/1
...ogfight2008.Common/1/Triangle.cs
/trunk/src/Dogfight2008.Common/2
...2008.Common/2/ColoredTriangle.cs
...gfight2008.Common/2/CplLoader.cs
/trunk/src/Dogfight2008.Common/3
/trunk/src/Dogfight2008.Common/4
...ight2008.Common/4/CubeCreator.cs
.../Dogfight2008.Common/4/GLUtil.cs
...gfight2008.Common/4/PlyLoader.cs
/trunk/src/Dogfight2008.Common/5
...ht2008.Common/5/GLControlUtil.cs
...ommon/Dogfight2008.Common.csproj
...8.Common/Dogfight2008.Common.sln
...ommon/Properties/AssemblyInfo.cs
...ogfight2008.CplViewer.Master.sln
...t2008.CplViewer/CplViewerForm.cs
...Viewer/CplViewerForm.designer.cs
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1373 bytes, 57 lines
View raw file
Powered by
Google Project Hosting