Detecting and searching a ray of intersection against a cubic Bezier triangle

While writing the model editor, in addition to including raytracing, I can think of several operations where I would like to find a very good approximation of the point of intersection between the ray and the triangular bezier.

How to do it? I know a couple of ways, but probably better.

Precise use cases: I could use a single Bezier triangle as a reference surface for drawing detailed shapes with the mouse. Perhaps I also want to determine the cleavage point from such a patch.

If you have the C source code, I might like this too. Maybe even use it instead of rolling my own code.

+3
source share
2 answers

I suggest you implement Triangular Bezier Clipping (PDF).

However, another option would be to convert your triangular patch into a patch of a gapless Bezier product. The advantage of this is that there is much more support for the tensor Beziers product, so you are more likely to find a code that you can use. The conversion is simple:

  • Look at your triangular patch as a series of n + 1 lines of breakpoints (where n is the degree)
    • The first line has 1 control point, and each line has one more control point than the last
  • Now consider each row as a Bezier curve of the corresponding degree (degree 0 to degree n)
  • Degree raises each row to degree n
    • n + 1 , n + 1 n + 1
  • , n n ,

, , . , - ( ), , . , . Bezier Clipping, .

+2

, , , , .

, , , . , , .

0

Source: https://habr.com/ru/post/1737218/


All Articles