Stephen Gutekanst
dc5c1f69a6
math: zig fmt
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-10-08 22:48:45 -07:00
Hordur Johannsson
4cd222ac83
Updates to math.collision
...
* Added function to compute contacts between polygons and circles.
* Added documentation for existing functions.
* Fixed a bug in Line.collideLine.
* Added more unit tests.
2024-09-21 09:54:53 -07:00
Joshua Holmes
51bf4f40f2
math: implement Mat.eql() and Mat.eqlApprox() methods ( #1266 )
2024-09-07 16:51:25 -07:00
yzrmn
af7ac96a0e
math: remove usingnamespace in favour of mixins ( #1231 )
2024-08-07 22:05:35 -07:00
Stephen Gutekanst
707e5cc756
update to Zig 2024.05
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-06-02 18:57:45 -07:00
Stephen Gutekanst
1237858359
math: fix projection2D bug with reverse-z
...
This went unnoticed because our test had near=-100 and far=100 which
is pretty uncommonly balanced, added a new test near=0 far=100 to test
for this.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-22 18:12:34 -07:00
Ali Chraghi
182c6a9180
math: collision module
2024-05-14 00:07:47 +02:00
Stephen Gutekanst
6e4105d8e2
math: add lerp
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-05-12 14:26:46 +02:00
Liam Swayne
2b8bfcaa3e
[math] simplify algorithm finding greatest vector
2024-04-21 17:34:15 -07:00
Stephen Gutekanst
2b7b8f5571
math: add pow
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-04-16 19:14:37 -07:00
Stephen Gutekanst
89622810f8
all: use mach.math instead of std.math; fixes hexops/mach#1021
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-01-18 22:34:12 -07:00
Stephen Gutekanst
b5531f84cb
update to Zig 2024.1.0-mach
...
Related to hexops/mach#1145
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-01-14 19:11:20 -07:00
Stephen Gutekanst
0d938ef6be
math: add inf, isInf
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-01-06 13:11:23 -07:00
Stephen Gutekanst
aa2435e10e
math: add well-tested, reverse-z 2D projection matrix
...
Helps hexops/mach#1103
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2024-01-06 13:11:23 -07:00
Joel
59bb156bf9
math: Add vector comparison functions ( #1131 )
2024-01-06 12:37:58 -07:00
Ali Chraghi
e9489ee560
math: add Mat2x2 ( #1130 )
2023-12-30 15:57:43 -07:00
btipling
9cf37cdc39
Early return with null for a ray with no direction ( #1132 )
2023-12-30 15:48:39 -07:00
Caleb Katzenstein
11aed4d16f
math: Add vec3.mulQuat() ( #1067 )
...
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2023-12-16 13:28:47 -07:00
Stephen Gutekanst
9250310c4a
math: remove invalid test
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-11-10 14:30:40 -07:00
Stephen Gutekanst
c87ea394db
math: remove incorrect perspective/ortho projection implementations
...
See https://github.com/hexops/mach/issues/1103
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-11-10 14:29:51 -07:00
Joel D. Schüller
3e025ef7b1
math: Make Mat3x3's underlying type Vec3
2023-10-24 23:32:55 -07:00
Om Prakaash
c1abc7a06f
math: add fromInt constructor helper for vectors ( #1061 )
2023-10-16 19:35:45 -07:00
Joel
fde4f820d7
math: Add Matrix multiplication tests ( #1066 )
...
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2023-10-16 19:32:20 -07:00
Stephen Gutekanst
c03673ff05
math: zig fmt
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-10-13 19:27:29 -07:00
Joel D. Schüller
fc4c3d06a3
math: Improve triangleIntersect doc comment
2023-10-10 20:31:47 -07:00
Joel D. Schüller
efe9d3d5d2
math: Add more precise triangleIntersect tests
2023-10-10 20:31:47 -07:00
Joel D. Schüller
8ddb9ade70
math: Fix Ray and Ray.Hit type adaptations
2023-10-10 20:31:47 -07:00
Joel D. Schüller
1c32ae83a7
math: Move maxDim function inside Ray struct
2023-10-10 20:31:47 -07:00
Joel D. Schüller
e7c95b8ce9
math: Replace floatFallbackPrecision function with switch expression
2023-10-10 20:31:47 -07:00
Om Prakaash
7bd2bc8d24
Add mulVec function for vectors.
...
Add function to allow a matrix to be left multiplied by a vector.
2023-10-06 20:18:17 -07:00
Stephen Gutekanst
1f8962408c
gfx: integrate new font stack into Text module
...
Helps hexops/mach#877
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-10-05 20:35:36 -07:00
Stephen Gutekanst
3b4f811529
minor cleanup
2023-10-03 19:50:52 -07:00
Joel D. Schüller
c03c627780
math: Have Ray return fitting subtype, scale precision automatically
2023-10-03 19:50:52 -07:00
Joel D. Schüller
0273e12902
math: Implement function to determine Ray hit fallback precision
2023-10-03 19:50:52 -07:00
Joel D. Schüller
4d6b3e200f
math: Declare Ray, Rayh, and Rayd types
2023-10-03 19:50:52 -07:00
Joel D. Schüller
24b9a415b3
math: Add Ray type and ray methods to test runner
2023-10-03 19:50:52 -07:00
Joel D. Schüller
9399cda75c
math: Implement ray-triangle intersection
2023-10-03 19:50:52 -07:00
Stephen Gutekanst
e661dcaf0a
cleanup
2023-10-03 10:28:34 -07:00
Stephen Gutekanst
f0bb14524b
cleanup
2023-10-03 10:28:34 -07:00
Om Prakaash
3527937086
Added mulVec function for matrices
...
Added function to multiply a matrix with a vector (Matrix* Vec).
2023-10-03 10:28:34 -07:00
Joel D. Schüller
a3671ab0ef
math: Implement Vec swizzle method
2023-10-01 10:06:42 -07:00
Joel D. Schüller
f6213a4237
math: Add enum for Vector components
2023-10-01 10:06:42 -07:00
Joel D. Schüller
2615afaaed
math: Overhaul old Vec tests
...
Old tests were not in accordance to the testing style guide
2023-09-23 04:19:18 -07:00
Joel D. Schüller
0bd8690ee1
math: Fix Vec cross method calculation arguments
2023-09-23 04:19:18 -07:00
Joel D. Schüller
085974a4b2
math: Fix Vec swizzling method component calls
2023-09-23 04:19:18 -07:00
Joel D. Schüller
8613ba9b17
math: Add tests for basic Vec operations
...
Tests for add, sub, div, mul, addScalar, subScalar, divScalar, mulScalar
2023-09-23 04:19:18 -07:00
Olle Lukowski
45b23264da
math: add perspective camera matrix
2023-09-22 16:40:57 -07:00
Joel D. Schüller
b6e0539c52
math: Add tests for new Vec operations
...
Tests for max, min, inverse, negate, maxScalar, minScalar
2023-09-22 09:51:55 -07:00
Joel D. Schüller
7597f03b71
math: Implement more Vec operations
...
max, min, inverse, negate, maxScalar, minScalar
2023-09-22 09:51:55 -07:00
Olle Lukowski
445265c554
math: add more tests ( #1001 )
2023-09-15 10:57:44 -07:00