New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overlapping test methods for math shape types. #795
Comments
|
While this may be useful, it is quite out of the scope of our maths library. Frustum culling, Collision detection, etc. should all not be done by directly using these types anyways, either this should be deferred to the GPU or done using some optimization system on the CPU - likely the job of another library (for example Bepu Physics for physics/collision detection) |
This doesn't seem like a bad idea (the other stuff in Comments though is out of scope as Kai suggested), @HurricanKai we could just leave this open to see if anyone from the community picks up on it? |
|
Although I agree that frustum culling and collision detection require ultra-optimized types, this doesn't mean the types provided by Silk don't implement some commom methods. If Matrix4x4 has multiply, Inverse, etc.... I don't see why Sphere can't have a DistanceTo(Sphere), or an OverlapsWith(Sphere) or Intersects method, which are common use cases for shapes and volumes. Then the users can choose whether to use these types for their scenarios or not. I understand the concern about adding methods to these types, because once you open the box, the number of methods you can add is countless, but I think there's some stuff that can be added without harm. |
|
@vpenades for our reference, would you be willing to implement these methods if we said we're happy to have them? |
|
I could give a try, I am new to Silk, but I have some of these methods already implemented in similar types (using float) There's also public, well known implementations in other projects, like the old XNA. |
|
@HurricanKai free contribution? iirc we have IntersectsWith methods elsewhere; raycasting APIs seem in scope for silk.net as other maths libraries have this (e.g. unity's maths lib). I agree anything more, like Full-blown culling, is defo out-of-scope. |
|
Basic .IntersectsWith methods seem fine to me |
|
So if I understand the architecture correctly, it would be something like this? Ray2D.Intersections.cs
Ray3D.Intersections.cs
Also, I understand the common grammar would be like this: bool IntersectsWith(shape, out Scalar distanceFactor); |
Summary of feature
Math library has 2D and 3D common shape types like Ray2D, Ray3D, Cube, Sphere, etc
It could be useful to have Ray2D and Ray3D to have methods to return the intesection with shapes and volumes.
Also, test methods to get whether shapes and volumens overlap.
Comments
Area/volume overlapping is a very common practice for graphics development in areas like frutum culling, collision detection, etc
Does this have a proposal?
no
The text was updated successfully, but these errors were encountered: