<p>Define the curves to have a positive and negative side then determine which side of the curve the point in question lies on.</p>
<p>There are a few ways to do this, one method is to shoot a ray out, usually along one of the primary axis, such as the positive x axis and count how many times the ray crosses the curve. If the number is even it can be considered positive, if it is odd it can be considered negative.</p>
<p>Do this with every curve and keep a collision count.  If the count is even it is inside, if it is odd it is outside depending on the direction the ray was cast.</p>
<p>This boils the problem down to colliding a ray with a Bezier curve for which there are many possible solutions.</p>
<p>It also depends on the winding direction of the curve which can be computed before hand.</p>

CC BY-SA 4.0
2024-01-02T16:34:39.327Z
2024-01-02T16:34:39.327Z
pmw1234
<p>I'm looking for algorithms or methods suitable for filling the area enclosed between complex curves - for example, the area within an outer ellipse but outside an inner ellipse, or the area bounded by two or more Bezier curves.</p>
<p>I'm familiar with the Flood Fill algorithm, which is quite universal, but it can also be inefficient and imprecise for complex shapes and large images.</p>
<p>I'm interested in alternatives, especially scanline-based methods. I understand that these work by intersecting the curves with horizontal or vertical lines and filling in the pixels between intersection points. However, the implementation details can get quite complex, especially for curves like ellipses or Bezier curves that require solving equations to find the intersection points.</p>
<p>Can anyone provide more detailed guidance or point me to resources about implementing these scanline fill methods for complex curves? Are there other, possibly more efficient or easier to implement, methods that I should consider?</p>
<p>Is analytical way to fast determine if point is inside such areas?</p>

<bezier-curve>
Methods for filling the area between complex curves
Saku
# Methods for filling the area between complex curves

(Asked by: username_0 on 2023-07-31)

I'm looking for algorithms or methods suitable for filling the area enclosed between complex curves - for example, the area within an outer ellipse but outside an inner ellipse, or the area bounded by two or more Bezier curves.

I'm familiar with the Flood Fill algorithm, which is quite universal, but it can also be inefficient and imprecise for complex shapes and large images.

I'm interested in alternatives, especially scanline-based methods. I understand that these work by intersecting the curves with horizontal or vertical lines and filling in the pixels between intersection points. However, the implementation details can get quite complex, especially for curves like ellipses or Bezier curves that require solving equations to find the intersection points.

Can anyone provide more detailed guidance or point me to resources about implementing these scanline fill methods for complex curves? Are there other, possibly more efficient or easier to implement, methods that I should consider?

Is analytical way to fast determine if point is inside such areas?

**Tags:** bezier-curve


---

## 1 answers

### Answer by username_1 on 2024-01-02. Score: 1

Define the curves to have a positive and negative side then determine which side of the curve the point in question lies on.

There are a few ways to do this, one method is to shoot a ray out, usually along one of the primary axis, such as the positive x axis and count how many times the ray crosses the curve. If the number is even it can be considered positive, if it is odd it can be considered negative.

Do this with every curve and keep a collision count. If the count is even it is inside, if it is odd it is outside depending on the direction the ray was cast.

This boils the problem down to colliding a ray with a Bezier curve for which there are many possible solutions.

It also depends on the winding direction of the curve which can be computed before hand.


---

