Created
April 14, 2019 04:54
-
-
Save pgp44/52d9a9852533b258d3a63d0188b2a60c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
create aggregate largest_triangle (point_t,point_t,point_t) ( | |
stype = triangle_t, | |
sfunc = largest_triangle_accum | |
); | |
create function largest_triangle_accum (maxsurfacetriangle triangle_t, p1 point_t, p2 point_t, p3 point_t) | |
returns triangle_t | |
language SQL | |
as $$ | |
select | |
case | |
when maxsurfacetriangle is null or | |
triangle_surface(p1,p2,p3) > maxsurfacetriangle.surface | |
then (p1,p2,p3,triangle_surface(p1,p2,p3))::triangle_t | |
else maxsurfacetriangle | |
end | |
$$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment