Hi,
I am currently trying to implement a function to Hise in order to get the intersection point of a path.
Everything is going well except that if I rescale the path with a negative Y value, getClippedLine doesn’t work anymore and spits out either a fix [0,0] or [width,height] instead of the coordinates I am expecting.
- All other scaling values are working
- Path is closed
- It does this even with just 1 negative Y pixel when applying an affineTransform with the entire path still in the line interceptor range.
- Hise is currently under Juce 6.1.3
Thank you
void ScriptingObjects::PathObject::scaleToFit(var x, var y, var width, var height, bool preserveProportions)
{
applyTransform (getTransformToScaleToFit (x, y, w, h, preserveProportions));
}
var ScriptingObjects::PathObject::getIntersection(var start, var end, bool keepSectionOutsidePath)
{
Point<float> p1 = ApiHelpers::getPointFromVar(start);
Point<float> p2 = ApiHelpers::getPointFromVar(end);
Line<float> l(p1.getX(), p1.getY(), p2.getX(), p2.getY());
if (p.intersectsLine(l))
{
Line<float> clippedLine = p.getClippedLine(l, keepSectionOutsidePath);
Array<var> a;
if (keepSectionOutsidePath)
{
a.add(clippedLine.getStartX());
a.add(clippedLine.getStartY());
}
else
{
a.add(clippedLine.getEndX());
a.add(clippedLine.getEndY());
}
return var(a);
}
return false;
}