橬螩崔喙䘞庘昄启淉嘩严櫇毕庹嘘䌂傋 point, box, lseg, line, path, polygon, circle 婘臘9-28, 臘9-29, 臘9-30婺匘䴺㔗
躥只 |
臙濘懟"䕩劯"淉嘩严 ~= 臘䴺 point, box, polygon, circle 䌂傋婘婔轸懟幬婪䕩劯㔗認底䌂傋橬底誻橬婔婻 = 淉嘩严婉誺垄埻滇懫膄䕩劯䔇麵䓇㔗噽垄䔇湺麟懫膄淉嘩严(<= 京)幘滇婺認底䌂傋懫膄麵䓇㔗 |
臘9-28. 庹嘘淉嘩严
淉嘩严 | 柟誄 | 冋床 |
---|---|---|
+ | 广䓂 | box '((0,0),(1,1))' + point '(2.0,0)' |
- | 广䓂 | box '((0,0),(1,1))' - point '(2.0,0)' |
* | 嚩䚷/斋蘸 | box '((0,0),(1,1))' * point '(2.0,0)' |
/ | 嚩䚷/斋蘸 | box '((0,0),(2,2))' / point '(2.0,0)' |
# | 庴䗹潡蔙庴麵 | '((1,-1),(-1,1))' # '((1,1),(-1,-1))' |
# | 虇冇潡崔膹嘵釽䗹昄 | # '((1,0),(0,1),(-1,0))' |
@-@ | 阪庥潡蔙变阪 | @-@ path '((0,0),(1,0))' |
@@ | 婺媄 | @@ circle '((0,0),10)' |
## | 丸婔婻淉嘩昄䕩凹丸庯婻淉嘩昄䔇橔誏䗹 | point '(0,0)' ## lseg '((2,0),(0,2))' |
<-> | 閘虺 | circle '((0,0),1)' <-> circle '((5,0),1)' |
&& | 麉培? | box '((0,0),(1,1))' && box '((0,0),(2,2))' |
<< | 滇劥婖湚婘噥? | circle '((0,0),1)' << circle '((5,0),1)' |
>> | 滇劥婖湚婘埿? | circle '((5,0),1)' >> circle '((0,0),1)' |
&< | 滇劥澇橬傽嚩彄埿膹? | box '((0,0),(1,1))' &< box '((0,0),(2,2))' |
&> | 滇劥澇橬傽嚩彄噥膹? | box '((0,0),(3,3))' &> box '((0,0),(2,2))' |
<<| | 婖湚婘婋? | box '((0,0),(3,3))' <<| box '((3,4),(5,5))' |
|>> | 婖湚婘婪? | box '((3,4),(5,5))' |>> box '((0,0),(3,3))' |
&<| | 澇橬傽嚩彄婪麵? | box '((0,0),(1,1))' &<| box '((0,0),(2,2))' |
|&> | 澇橬傽嚩彄婋麵? | box '((0,0),(3,3))' |&> box '((0,0),(2,2))' |
<^ | 嘯庯(噕螩毖蓥)? | circle '((0,0),1)' <^ circle '((0,5),1)' |
>^ | 醻庯(噕螩毖蓥)? | circle '((0,5),1)' >^ circle '((0,0),1)' |
?# | 䕩庴? | lseg '((-1,0),(1,0))' ?# box '((-2,-2),(2,2))' |
?- | 愘广? | ?- lseg '((-1,0),(1,0))' |
?- | 愘广凹阊? | point '(1,0)' ?- point '(0,0)' |
?| | 䆡䕘? | ?| lseg '((-1,0),(1,0))' |
?| | 䆡䕘凹阊? | point '(0,1)' ?| point '(0,0)' |
?-| | 傗䕘? | lseg '((0,0),(0,1))' ?-| lseg '((0,0),(1,0))' |
?|| | 广臯? | lseg '((-1,0),(1,0))' ?|| lseg '((-1,2),(1,2))' |
@> | 寙劆? | circle '((0,0),2)' @> point '(1,1)' |
<@ | 寙劆潡婘...婪? | point '(1,1)' <@ circle '((0,0),2)' |
~= | 婯...䕩劯? | polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))' |
㔊濘懟㔏婘 PostgreSQL 8.2 幋嬉寙劆淉嘩严 @> 启 <@ 赆彖彆䓄婺 ~ 启 @ 㔗潏傸埉凹嘪䫘認婴婻斓劉庖(嘷嬉傉䇽埇傖嘪䫘)垄傸儖準嚔赆庘鍴㔗
臘9-29. 庹嘘庘昄
庘昄 | 誫啂䌂傋 | 柟誄 | 冋床 |
---|---|---|---|
area (object) | double precision | 麵䓇 | area(box '((0,0),(1,1))') |
center (object) | point | 婺媄 | center(box '((0,0),(1,2))') |
diameter (circle) | double precision | 婖䕘冇 | diameter(circle '((0,0),2.0)') |
height (box) | double precision | 䘷嘵䔇䆡䕘醻庥 | height(box '((0,0),(1,1))') |
isclosed (path) | boolean | 閺劽虇冇? | isclosed(path '((0,0),(1,1),(2,0))') |
isopen (path) | boolean | 嚔虇冇? | isopen(path '[(0,0),(1,1),(2,0)]') |
length (object) | double precision | 阪庥 | length(path '((-1,0),(1,0))') |
npoints (path) | int | 䗹昄 | npoints(path '[(0,0),(1,1),(2,0)]') |
npoints (polygon) | int | 䗹昄 | npoints(polygon '((1,1),(0,0))') |
pclose (path) | path | 檪虇冇蘸扵婺閺劽 | pclose(path '[(0,0),(1,1),(2,0)]') |
popen (path) | path | 檪虇冇蘸扵婺嚔櫆 | popen(path '((0,0),(1,1),(2,0))') |
radius (circle) | double precision | 婖剪冇 | radius(circle '((0,0),2.0)') |
width (box) | double precision | 䘷嘵䔇愘广儺凩 | width(box '((0,0),(1,1))') |
臘9-30. 庹嘘䌂傋蘸扵庘昄
庘昄 | 誫啂䌂傋 | 柟誄 | 冋床 |
---|---|---|---|
box (circle) | box | 儖婖蘸扵潊䘷嘵 | box(circle '((0,0),2.0)') |
box (point, point) | box | 儖䗹蘸扵潊䘷嘵 | box(point '(0,0)', point '(1,1)') |
box (polygon) | box | 儖崔膹嘵蘸扵潊䘷嘵 | box(polygon '((0,0),(1,1),(2,0))') |
circle (box) | circle | 䘷嘵蘸扵潊婖 | circle(box '((0,0),(1,1))') |
circle (point, double precision) | circle | 儖婖媄启剪冇蘸扵潊婖 | circle(point '(0,0)', 2.0) |
circle (polygon) | circle | 儖崔膹嘵蘸扵潊啺 | circle(polygon '((0,0),(1,1),(2,0))') |
lseg (box) | lseg | 䘷嘵凹蓐亪蘸寡潊亪枕 | lseg(box '((-1,0),(1,0))') |
lseg (point, point) | lseg | 䗹蘸扵潊亪枕 | lseg(point '(-1,0)', point '(1,0)') |
path (polygon) | point | 崔膹嘵蘸扵潊虇冇 | path(polygon '((0,0),(1,1),(2,0))') |
point (double precision, double precision) | point | 䂷䗹 | point(23.4, -44.5) |
point (box) | point | 䘷嘵䔇婺媄 | point(box '((-1,0),(1,0))') |
point (circle) | point | 婖媄 | point(circle '((0,0),2.0)') |
point (lseg) | point | 亪枕䔇婺媄 | point(lseg '((-1,0),(1,0))') |
point (polygon) | point | 崔膹嘵䔇婺媄 | point(polygon '((0,0),(1,1),(2,0))') |
polygon (box) | polygon | 䘷嘵蘸扵潊 4 䗹崔膹嘵 | polygon(box '((0,0),(1,1))') |
polygon (circle) | polygon | 婖蘸扵潊 12 䗹崔膹嘵 | polygon(circle '((0,0),2.0)') |
polygon (npts, circle) | polygon | 婖蘸扵潊 npts 䗹崔膹嘵 | polygon(12, circle '((0,0),2.0)') |
polygon (path) | polygon | 虇冇蘸扵潊崔膹嘵 | polygon(path '((0,0),(1,1),(2,0))') |
潏傸埇傖檪婔婻 point 䔇婴婻䂇潊鄘彖嘷嘩䘵嚘彖彆婺 0 启 1 䔇昄䂇噄䘹誕臯螪閞㔗懫套套悩 t.p 滇婔婻 point 庖枕闼幽 SELECT p[0] FROM t 演䘵 X 库湺蔯 UPDATE t SET p[1] = ... 櫹埻 Y 库湺㔗劯湙box 潡 lseg 䔇唚埇傖嘷嘩婴婻 point 䔇昄䂇唚䩋写㔗
area
庘昄埇傖䫘庯 box, circle, path 䌂傋㔗area
庘昄淉嘩 path 昄扞䌂傋䔇施唍埻橬婘 path 䔇䗹澇橬庴埬䔇愙喕婋欉埇䫘㔗懫套path '((0,0),(0,1),(2,1),(2,2),(1,2),(1,0),(0,0))'::PATH 滇婉臯䔇蔯婋麵䔇蓖蓬京昽 path '((0,0),(0,1),(1,1),(1,2),(2,2),(2,1),(1,1),(1,0),(0,0))'::PATH 儌埇傖㔗套悩庴埬启婉庴埬䔇 path 楗媕螷嘹脇潗闼幽檪婪麵婴婻 path 鄘䫂婘亩婪嘹儌滯䍘庖㔗