Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More aggressive RectWithSize usage for local rectangles #1087

Merged
merged 4 commits into from Apr 10, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Rewrote intersect_rect to be more robust

  • Loading branch information
kvark committed Apr 7, 2017
commit f4f932b9d8c12e8dc30202952030d6d7f25a0df5
@@ -132,15 +132,13 @@ vec4 clamp_rect(vec4 points, RectWithEndpoint rect) {
}

RectWithSize intersect_rect(RectWithSize a, RectWithSize b) {
vec2 p0 = max(a.p0, b.p0);
vec2 p1 = min(a.p0 + a.size, b.p0 + b.size);
return RectWithSize(p0, max(vec2(0.0), p1 - p0));
vec4 p = clamp_rect(vec4(a.p0, a.p0 + a.size), b);
return RectWithSize(p.xy, max(vec2(0.0), p.zw - p.xy));
}

RectWithEndpoint intersect_rect(RectWithEndpoint a, RectWithEndpoint b) {
vec2 p0 = max(a.p0, b.p0);
vec2 p1 = min(a.p1, b.p1);
return RectWithEndpoint(p0, max(p0, p1));
vec4 p = clamp_rect(vec4(a.p0, a.p1), b);
return RectWithEndpoint(p.xy, max(p.xy, p.zw));
}


ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.