51 questions
0
votes
1
answer
34
views
Rotate a 3D Vector around Axis and degrees
I try to rotate a Vector (0,0,-1) around an axis (Y) (0,1,0) with specific degrees (90°) using the System.Numerics Libary from .NET
My Problem is that i get a wrong output and i dont get the Problem.
...
0
votes
0
answers
129
views
Matrix4x4 from translation rotation scale
How do I create a System.Numerics.Matrix4x4 from a translation, rotation and scale?
I have 2 methods that I am toying around with:
public static class Matrix4x4Extensions
{
// Uses multiplication ...
0
votes
0
answers
71
views
Why does IBitwiseOperators not allow short-circuiting operators in a generic function?
In the process of investigating a .NET API proposal, to add the new System.Numerics interfaces to System.Boolean, it transpired that && and || short-circuiting operators need the operators ...
-1
votes
1
answer
47
views
How to construct C# generic classes while using external library types?
I've recently stumbled upon an issue: I've been using the System.Numerics library for the Vector3 object, which is only of float precision. I later found out in some cases I needed double precision ...
2
votes
2
answers
213
views
How can I calculate the sum of a matrix of doubles using Vectorization in C#?
I have a 2 dimensional array of doubles representing a matrix which can potentially be large e.g. 200x200.
I need to be able to efficiently calculate the sum of this matrix. How can I achieve this ...
1
vote
0
answers
76
views
Boolean Equivalent For `System.Numerics.IBitwiseOperators` Interface
Included in the System.Numerics library is the relatively new interface IBitwiseOperators<TSelf, TOther, TResult>. It contains functionality for bitwise manipulations on integers (e.g. AND, OR, ...
0
votes
1
answer
80
views
Numerics BigInteger.Remainder (Mod) doesn't work with negative divisors
Consider the following equations:
10 % 3 = 1
10 % -3 = -2
10001 % 30 = 11
10001 % -30 = -19
C#'s System.Numerics.BigInteger Seems to produce positive results for negative divisors, as if ...
0
votes
1
answer
163
views
How do you subclass a C# generic container that implements System.Numerics interfaces which require a TSelf type argument?
I made a dictionary-like container that supports key-wise arithmetic operations. I want it to "act" like a value type in the sense that it can be added, subtracted, and multiplied by other ...
0
votes
0
answers
369
views
When using and ortho camera, ProjectionMatrix * viewMatrix skew objects on rotation, but viewMatrix * ProjectionMatrix fix the problem
I'm implementing a 3D graphics app for fun.
To create an orthographic camera following the "theory", you need to have a view projection Matrix implemented in this way:
ViewProjectionMatrix = ...
2
votes
1
answer
216
views
Unexpected sign when building rotation matrix in System.Numerics
I am using System.Numerics and I am trying to build a rotation matrix using methods such as CreateFromAxisAngle(Vector3, Single) and CreateRotationY(Single).
Let's say I want to build a rotation ...
0
votes
1
answer
93
views
Imaginary number comparison with C# [duplicate]
I want to analyse a polynomial and only output the real roots. I use the Systems.Numerics to get the complex number and then compare their imaginary component to a set value to find out if they are ...
0
votes
0
answers
2k
views
why does System.Numerics Matrix4x4 use a transposed notation?
Traditionally notation of a Transformation matrix is as such:
R1 R2 R3 T1
R4 R5 R6 T2
R7 R8 R9 T3
0 0 0 1
The C# System.Numerics.Matrix4x4 class seems to use this convention instead:
https://learn....
0
votes
1
answer
301
views
Possibilities to improve performance using vectorization for the following function in C#?
I have a function that estimates correlation between two input arrays.
The input is feeded by a dataDict which is of type Dictionary<string, double[]> which has 153 keys with values as double ...
2
votes
2
answers
593
views
Why am I getting a system overflow using big integer (System.Numerics)?
I am getting this error: System.OverflowException: 'The value is not a number.'
I was under the impression that big integer could store any sized value (500 ^ 500 in this case), so I don't understand ...
7
votes
3
answers
2k
views
SIMD string to unsigned int parsing in C# performance improvement
I've implemented a method for parsing an unsigned integer string of length <= 8 using SIMD intrinsics available in .NET as follows:
public unsafe static uint ParseUint(string text)
{
fixed (char* ...