[FR] math.all + math.any for multi dimensional boolean
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- computer-graphics
Research direction
The issue does not name a file or test; search the Unity.Mathematics sources for the existing math.all and math.any vector overloads and inspect how matrix types expose their columns. Add support matching the listed bool2x2 through bool4x4 cases, then verify the sample multi-dimensional boolean expressions compile and produce the requested per-axis results.
Written by the indexing model from the issue text.
Description
public static bool2 all(bool2x2 m) { return new bool2(all(m.c0),all(m.c1)); }
public static bool2 all(bool3x2 m) { return new bool2(all(m.c0),all(m.c1)); }
public static bool2 all(bool4x2 m) { return new bool2(all(m.c0),all(m.c1)); }
public static bool2 any(bool2x2 m) { return new bool2(any(m.c0),any(m.c1)); }
public static bool2 any(bool3x2 m) { return new bool2(any(m.c0),any(m.c1)); }
public static bool2 any(bool4x2 m) { return new bool2(any(m.c0),any(m.c1)); }
public static bool3 all(bool2x3 m) { return new bool3(all(m.c0),all(m.c1),all(m.c2)); }
public static bool3 all(bool3x3 m) { return new bool3(all(m.c0),all(m.c1),all(m.c2)); }
public static bool3 all(bool4x3 m) { return new bool3(all(m.c0),all(m.c1),all(m.c2)); }
public static bool3 any(bool2x3 m) { return new bool3(any(m.c0),any(m.c1),any(m.c2)); }
public static bool3 any(bool3x3 m) { return new bool3(any(m.c0),any(m.c1),any(m.c2)); }
public static bool3 any(bool4x3 m) { return new bool3(any(m.c0),any(m.c1),any(m.c2)); }
public static bool4 all(bool2x4 m) { return new bool4(all(m.c0),all(m.c1),all(m.c2),all(m.c3)); }
public static bool4 all(bool3x4 m) { return new bool4(all(m.c0),all(m.c1),all(m.c2),all(m.c3)); }
public static bool4 all(bool4x4 m) { return new bool4(all(m.c0),all(m.c1),all(m.c2),all(m.c3)); }
public static bool4 any(bool2x4 m) { return new bool4(any(m.c0),any(m.c1),any(m.c2),any(m.c3)); }
public static bool4 any(bool3x4 m) { return new bool4(any(m.c0),any(m.c1),any(m.c2),any(m.c3)); }
public static bool4 any(bool4x4 m) { return new bool4(any(m.c0),any(m.c1),any(m.c2),any(m.c3)); }
Sample use case
int[] vertexTriangles; // index buffer of mesh
var rightEdge = new int3(0,1,4); // index of vertex on the right of uv rectangle
var topEdge = new int3(1,3,4); // index of vertex on the top of uv rectangle
var rightTop = new int3x2(new int3(0,1,4),new int3(1,3,4));
foreach(int index in vertexTriangles)
{
bool3x2 checkRightTop = index % 6 == rightTop;
bool2 isRightTop = math.any(checkRightTop); // check that vertexIndex is which corner of UV space
// isRightTop.x is left or right
// isRightTop.y is bottom or top
var v = math.select(rightTopValue,leftBottomValue,isRightTop); // select leftTop/rightTop/leftBottom/rightBottom
}
- Dominant language
- C#
- Stars
- 1.4k
- Forks
- 159
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Unity-Technologies/Unity.Mathematics
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Unity-Technologies/Unity.Mathematics#245 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
Unity-Technologies/Unity.Mathematics#243 · 6 reactions ·
All issues in Unity-Technologies/Unity.Mathematics
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nightscout/nocturne#1425 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
RayWangQvQ/BiliBiliToolPro#1137 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100