9.10. ���κ����Ͳ�����

��������ú����Ͳ�����֧�� ��������point��box��lseg�� line��path��polygon �� circle �ȣ� ��Table 9-28�� Table 9-29���� Table 9-30��

Table 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))'
&<�Ƿ�û�����쵽�ұߣ�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 '((5,0),1)'
>> ���ұߣ�circle '((5,0),1)' >> circle '((0,0),1)'
<^���ڣ�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))'

Table 9-29. �����

��������������������
area(object)double precisionĿ������area(box '((0,0),(1,1))')
box_intersect(box, box)box���Ľ�box_intersect(box '((0,0),(1,1))',box '((0.5,0.5),(2,2))')
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�DZպ�·����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(polygon)integer����npoints(path '[(0,0),(1,1),(2,0)]')
npoints(polygon)integer����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))')

Table 9-30. ��������ת������

��������������������
box(circle)box��Բת���ɳ�����box(cricle '((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)
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(circle)pointԲ��point(circle '((0,0),2.0)')
point(lseg, lseg)pointת���ɵ㣨�ཻ��point(lseg '((-1,0),(1,0))', lseg '((-2,-2),(2,2))')
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 �Dz��еģ� ��������Ӿ���Ч path'((0,0),(0,1),(1,1),(1,2),(2,2),(2,1),(1,1),(1,0),(0,0))'::PATH �Ϳ��ԡ� �������Ͳ������ path ���������Ϳ����ô���������� path ������һ��ֽ�ϣ���������ˡ�