Quote:...but the mesh is very large and i have to test too many points...How many? If you can measure allocations/garbage collection then it might be good to try it as well. If you pass around structures like Point3D/Vector3 or anything larger then one integer, it might be worth to pass it either using ref or in argument modifier. Passing structs around causes by value duplicates them and it can result in large slow downs.
Code:
void PassedByValue(SharpDX.Vector3 vertex, SharpDX.Plane plane)
{
// Do some stuff
}
void PassedByReference(ref SharpDX.Vector3 vertex, ref SharpDX.Plane plane)
{
// Do some stuff
}
void Main()
{
var v = new Vector3();
var p = new Plane();
// This will result in two copies of vector and plane
PassedByValue(v, p);
// This operation will be faster and no copies are created
PassedByReference(ref v, ref p);
}If you try to use SharpDX you will find out that most of functions come in pair and I would recommend to use the first one:
Code:
public static void DotNormal(ref Plane left, ref Vector3 right, out float result);
public static float DotNormal(Plane left, Vector3 right);If you don't need the results immediately (like per frame basis, the user can wait) but you only don't want to block the rendering thread you could use async task and await, where you would just run all the checks in separate task (not necessarily on new thread) and await on the result to resume your code flow.

