HitTest, Path and "collisionDetectionTolerence"


#1

Hi Jules!

I am having some problems with some of my hit tests.
some of my controls involve paths of ellipses, pie segments, and curves, that i pass as a path to the hit test using this:

[quote]
bool Control1D::hitTest (int x, int y)
{
return hitPath.contains(x, y);
}[/quote]
but the hitTest was not giving me proper results (not like what i see on the screen anyhow).
so i checked the contains method in the path class and i found this:

is it possible to have a the collitionDetectionTolerence inside the function like this?

bool contains (const float x, const float y, const float tolerence = 20.f) const throw();

is there is a more efficient way of testing paths or even a plain circle?

Thanks
Assaf


#2

Ok - that’s a good request, the value should really be a parameter.

Don’t think there’s a better way of checking for intersections in paths, though if you’re just using circles you could do the maths yourself and that’d be better (the Path class stores circles as cubic curves anyway, so it can’t be optimised for that)