Fonctions géométriques

Les types géométriques, point, box, lseg, line, path, polygon, et circle ont un ensemble important de fonctions natives.

Tableau 5-6. Fonctions géométriques

FonctionReturnsDescriptionExemple
area(box) float8 zone de la boîte area('((0,0),(1,1))'::box)
area(circle) float8 zone du cercle area('((0,0),2.0)'::circle)
box(box,box) box boxes to intersection box box('((0,0),(1,1))','((0.5,0.5),(2,2))')
center(box) point centre de l'object center('((0,0),(1,2))'::box)
center(circle) point centre de l'object center('((0,0),2.0)'::circle)
diameter(circle) float8 diamètre du cercle diameter('((0,0),2.0)'::circle)
height(box) float8 taille verticale de la boîte height('((0,0),(1,1))'::box)
isclosed(path) bool chemin fermé ? isclosed('((0,0),(1,1),(2,0))'::path)
isopen(path) bool chemin fermé ? isopen('[(0,0),(1,1),(2,0)]'::path)
length(lseg) float8 longueur d'un segment de ligne length('((-1,0),(1,0))'::lseg)
length(path) float8 longueur d'un chemin length('((0,0),(1,1),(2,0))'::path)
pclose(path) path convert path to closed popen('[(0,0),(1,1),(2,0)]'::path)
point(lseg,lseg) point intersection point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg)
points(path) int4 nombre de points points('[(0,0),(1,1),(2,0)]'::path)
popen(path) path convert path to open popen('((0,0),(1,1),(2,0))'::path)
radius(circle) float8 rayon du cercle radius('((0,0),2.0)'::circle)
width(box) float8 taille horizontale width('((0,0),(1,1))'::box)

Tableau 5-7. Type fonction de conversion géométrique

FonctionReturnsDescriptionExemple
box(circle) box convertit le cercle en boîte box('((0,0),2.0)'::circle)
box(point,point) box convertit les points en boîte box('(0,0)'::point,'(1,1)'::point)
box(polygon) box convertit le polygone en boîte box('((0,0),(1,1),(2,0))'::polygon)
circle(box) circle convertit en cercle circle('((0,0),(1,1))'::box)
circle(point,float8) circle convertit en cercle circle('(0,0)'::point,2.0)
lseg(box) lseg convertit le diagonale en segment de ligne lseg('((-1,0),(1,0))'::box)
lseg(point,point) lseg convertit en segment de ligne lseg('(-1,0)'::point,'(1,0)'::point)
path(polygon) point convertit en chemin path('((0,0),(1,1),(2,0))'::polygon)
point(circle) point convertit en point (centre) point('((0,0),2.0)'::circle)
point(lseg,lseg) point convertit en point (intersection) point('((-1,0),(1,0))'::lseg, '((-2,-2),(2,2))'::lseg)
point(polygon) point centre de polygone point('((0,0),(1,1),(2,0))'::polygon)
polygon(box) polygon convertit en polygone de 12 points polygon('((0,0),(1,1))'::box)
polygon(circle) polygon convertit en polygone de 12 points polygon('((0,0),2.0)'::circle)
polygon(npts,circle) polygon convertit en npts polygone polygon(12,'((0,0),2.0)'::circle)
polygon(path) polygon convertit en polygone polygon('((0,0),(1,1),(2,0))'::path)

Tableau 5-8. Fonctions géométriques de mise à jour

FonctionReturnsDescriptionExemple
isoldpath(path) path test path for pre-v6.1 form isoldpath('(1,3,0,0,1,1,2,0)'::path)
revertpoly(polygon) polygon convert pre-v6.1 polygon revertpoly('((0,0),(1,1),(2,0))'::polygon)
upgradepath(path) path convert pre-v6.1 path upgradepath('(1,3,0,0,1,1,2,0)'::path)
upgradepoly(polygon) polygon convert pre-v6.1 polygon upgradepoly('(0,1,2,0,1,0)'::polygon)