Skip to content

Commit 38684d7

Browse files
authored
Merge pull request opentk#1675 from MV10/use_MathF_methods
Use MathF methods instead of Math (float vs double)
2 parents 19f4e04 + 4ef779a commit 38684d7

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/OpenTK.Mathematics/Geometry/BezierCurve.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,16 @@ public static Vector2 CalculatePoint(IList<Vector2> points, float t)
203203
[Pure]
204204
public static Vector2 CalculatePoint(IList<Vector2> points, float t, float parallel)
205205
{
206-
var r = default(Vector2);
207-
var c = 1.0d - t;
206+
Vector2 r = default(Vector2);
207+
float c = 1 - t;
208208
float temp;
209-
var i = 0;
209+
int i = 0;
210210

211211
foreach (var pt in points)
212212
{
213213
temp = MathHelper.BinomialCoefficient
214214
(
215-
points.Count - 1, i) * (float)(Math.Pow(t, i) * Math.Pow(c, points.Count - 1 - i)
215+
points.Count - 1, i) * (MathF.Pow(t, i) * MathF.Pow(c, points.Count - 1 - i)
216216
);
217217

218218
r.X += temp * pt.X;
@@ -248,16 +248,16 @@ public static Vector2 CalculatePoint(IList<Vector2> points, float t, float paral
248248
[Pure]
249249
private static Vector2 CalculatePointOfDerivative(IList<Vector2> points, float t)
250250
{
251-
var r = default(Vector2);
252-
var c = 1.0d - t;
251+
Vector2 r = default(Vector2);
252+
float c = 1 - t;
253253
float temp;
254-
var i = 0;
254+
int i = 0;
255255

256256
foreach (var pt in points)
257257
{
258258
temp = MathHelper.BinomialCoefficient
259259
(
260-
points.Count - 2, i) * (float)(Math.Pow(t, i) * Math.Pow(c, points.Count - 2 - i)
260+
points.Count - 2, i) * (MathF.Pow(t, i) * MathF.Pow(c, points.Count - 2 - i)
261261
);
262262

263263
r.X += temp * pt.X;

src/OpenTK.Mathematics/Matrix/Matrix4.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ public static void CreatePerspectiveFieldOfView
11171117
out Matrix4 result
11181118
)
11191119
{
1120-
if (fovy <= 0 || fovy > Math.PI)
1120+
if (fovy <= 0 || fovy > MathF.PI)
11211121
{
11221122
throw new ArgumentOutOfRangeException(nameof(fovy));
11231123
}
@@ -1137,10 +1137,10 @@ out Matrix4 result
11371137
throw new ArgumentOutOfRangeException(nameof(depthFar));
11381138
}
11391139

1140-
var maxY = depthNear * MathF.Tan(0.5f * fovy);
1141-
var minY = -maxY;
1142-
var minX = minY * aspect;
1143-
var maxX = maxY * aspect;
1140+
float maxY = depthNear * MathF.Tan(0.5f * fovy);
1141+
float minY = -maxY;
1142+
float minX = minY * aspect;
1143+
float maxX = maxY * aspect;
11441144

11451145
CreatePerspectiveOffCenter(minX, maxX, minY, maxY, depthNear, depthFar, out result);
11461146
}

0 commit comments

Comments
 (0)