# test if a point is inside a shape defined by quadratic B-splines

This topic is 2448 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I got it working, based on the idea that if a point is inside it will need to pass through odd number of edges to escape in a linear direction. In my drawing I pick my Y, and get all intersections on that Y. Now I have an array of X values for a given Y. It worked fine, until I started using more complex shapes. I increased precision from float to double, and it made my results much better . But still not good enough.

I don't know how to debug precision. When I step through the program this line right here has issues

 // this is from the expanded bezier formula A = (double)p[0].y + (double)p[2].y - 2.0*(double)p[1].y; // of course down the line I divide by 2.0*A // after quadratic formula I get a 't' which I plug into the formula below to get a (x, y) point of intersection // this is the interpolation formula Vector2D n; float t_u; t_u = 1.0 - t; n = p[0]*t_u*t_u + p[1]*2*t_u*t + p[2]*t*t; // p is a vector 

'A' goes really close to 0! I've been stuck on this problem for quite some time now. This is in my rendering loop I'm rendering a filled shape defined by this closed curve.

##### Share on other sites
Solved

I went for food came back and realized it. It degrades to a line ... SO SIMPLE. Just solve the linear equation and add to array done.

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633700
• Total Posts
3013428
×