I've been working on developing a system to handle optical effects such as reflection and refraction in Box2D for the past few weeks, and something that I've been thinking ahead to is the possibility of developing a custom Shape akin to a polygon that allows for curved edges. This custom shape could be used to do the job of a lens upon any number of Rays passing through it. The curve to the edges would not be arbitrary, as the curve radius would be constant as it is for a circle.
However, even assuming I can manage to develop a working model of such a shape, it is clear to me that any shape that includes an edge that curves inward toward the enclosed area of the shape ought to qualify as a concave shape. I take it that this is a problem, since I recently learned of Box2D's requirement on convex shapes, but as of right now I don't know why Box2D has this limitation. If the reason for this limitation can be explained to me in greater detail, it would help me a great deal in figuring out how large of a problem this is for me.
While convex lenses are certainly possible, if concave shapes are not valid, I am unable to build concave lenses without an approximation being built of incredibly numerous triangles (which, as a consequence of how I have built my refraction system so far, will possibly have significant a impact upon refraction behaviour).
So I guess what I really need to know is: Can concave shapes be constructed, and if so, can concave shapes theoretically work for the purposes of raycasting? I'm not using Box2D to perform any kinematic physics. In this current application, I'm really only using Box2D's raycasting features to allow me to detect where line segments intersect with the edges of fixtures. Is it possible for me to develop a shape of the type which I need and make it work, or is Box2D incapable of offering me the options I need? Is there some way to make this work?
Thank you in advance for anything that makes this problem clearer to me.
However, even assuming I can manage to develop a working model of such a shape, it is clear to me that any shape that includes an edge that curves inward toward the enclosed area of the shape ought to qualify as a concave shape. I take it that this is a problem, since I recently learned of Box2D's requirement on convex shapes, but as of right now I don't know why Box2D has this limitation. If the reason for this limitation can be explained to me in greater detail, it would help me a great deal in figuring out how large of a problem this is for me.
While convex lenses are certainly possible, if concave shapes are not valid, I am unable to build concave lenses without an approximation being built of incredibly numerous triangles (which, as a consequence of how I have built my refraction system so far, will possibly have significant a impact upon refraction behaviour).
So I guess what I really need to know is: Can concave shapes be constructed, and if so, can concave shapes theoretically work for the purposes of raycasting? I'm not using Box2D to perform any kinematic physics. In this current application, I'm really only using Box2D's raycasting features to allow me to detect where line segments intersect with the edges of fixtures. Is it possible for me to develop a shape of the type which I need and make it work, or is Box2D incapable of offering me the options I need? Is there some way to make this work?
Thank you in advance for anything that makes this problem clearer to me.