Created
April 14, 2019 05:15
-
-
Save pgp44/f6f8fd1243b12a66b55deeef3282c145 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
largesttriangle(grp,p) as ( | |
select | |
wga.grp, | |
((0,0),(wga.x,wga.y),(0,0),0.0)::triangle_t | |
from withgrpavg wga | |
where grp = 1 | |
union all | |
select distinct | |
wga.grp, | |
(largest_triangle( | |
(ltt.p).p2, -- the selected point of the previous bucket | |
(wga.x,wga.y), -- current bucket | |
(wga.xavg3,wga.yavg3)::triangle_t -- average of next bucket | |
) over (partition by wga.grp) | |
from withgrpavg wga join largesttriangle ltt on wga.grp=ltt.grp+1 | |
where wga.grp > 1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment