|
geometric_type + point → geometric_type
将第二个point的坐标加到第一个参数各点的坐标上,从而执行平移。 适用于 point、box、path、circle。
box '(1,1),(0,0)' + point '(2,0)' → (3,1),(2,0)
|
|
path + path → path
连接两个打开的路径(如果其中一个路径是关闭的,则返回NULL)。
path '[(0,0),(1,1)]' + path '[(2,2),(3,3),(4,4)]' → [(0,0),(1,1),(2,2),(3,3),(4,4)]
|
|
geometric_type - point → geometric_type
从第一个参数各点的坐标中减去第二个point的坐标,从而执行平移。 适用于 point、 box、 path、circle。
box '(1,1),(0,0)' - point '(2,0)' → (-1,1),(-2,0)
|
|
geometric_type * point → geometric_type
将第一个参数的每个点乘上第二个point(将点视为由实部和虚部表示的复数,并执行标准的复数乘法)。 如果将第二个point解释为向量,这等价于将对象的大小和到原点的距离按向量的长度缩放,并以向量与x轴的夹角绕原点逆时针旋转。 适用于point、box、 path、circle。
path '((0,0),(1,0),(1,1))' * point '(3.0,0)' → ((0,0),(3,0),(3,3))
path '((0,0),(1,0),(1,1))' * point(cosd(45), sind(45)) → ((0,0),(0.7071067811865475,0.7071067811865475),(0,1.414213562373095))
|
|
geometric_type / point → geometric_type
将第一个参数的每个点除以第二个point(将点视为由实部和虚部表示的复数,并执行标准的复数除法)。 如果将第二个point解释为向量,这等价于将物体的大小和到原点的距离按向量的长度向下缩放,并以向量与x轴的夹角围绕原点顺时针旋转。 适用于 point, box, path,circle。
path '((0,0),(1,0),(1,1))' / point '(2.0,0)' → ((0,0),(0.5,0),(0.5,0.5))
path '((0,0),(1,0),(1,1))' / point(cosd(45), sind(45)) → ((0,0),(0.7071067811865476,-0.7071067811865476),(1.4142135623730951,0))
|
|
@-@ geometric_type → double precision
计算总长度。适用于 lseg, path.
@-@ path '[(0,0),(1,0),(1,1)]' → 2
|
|
@@ geometric_type → point
计算中心点。 适用于box,lseg, polygon,circle。
@@ box '(2,2),(0,0)' → (1,1)
|
|
# geometric_type → integer
返回点的数量。适用于 path, polygon。
# path '((1,0),(0,1),(-1,0))' → 3
|
|
geometric_type # geometric_type → point
计算交点,如果没有则为NULL。适用于 lseg, line。
lseg '[(0,0),(1,1)]' # lseg '[(1,0),(0,1)]' → (0.5,0.5)
|
|
box # box → box
计算两个方框的交集,如果没有则为NULL。
box '(2,2),(-1,-1)' # box '(1,1),(-2,-2)' → (1,1),(-1,-1)
|
|
geometric_type ## geometric_type → point
计算第一个对象上距离第二个对象最近的点。 可用于以下类型的配对: (point, box), (point, lseg), (point, line), (lseg, box), (lseg, lseg), (line, lseg).
point '(0,0)' ## lseg '[(2,0),(0,2)]' → (1,1)
|
|
geometric_type <-> geometric_type → double precision
计算对象之间的距离。 对于所有七种几何类型,所有point与另一种几何类型的组合, 以及以下这些额外的类型对: (box, lseg), (lseg, line), (polygon, circle) (以及交换位置的情况)。
circle '<(0,0),1>' <-> circle '<(5,0),1>' → 3
|
|
geometric_type @> geometric_type → boolean
第一个对象包含第二个对象吗? 适用于这些类型对: (box, point), (box, box), (path, point), (polygon, point), (polygon, polygon), (circle, point), (circle, circle).
circle '<(0,0),2>' @> point '(1,1)' → t
|
|
geometric_type <@ geometric_type → boolean
第一个对象包含在第二个对象之中还是在第二个对象之上? 适用于这些类型对: (point, box), (point, lseg), (point, line), (point, path), (point, polygon), (point, circle), (box, box), (lseg, box), (lseg, line), (polygon, polygon), (circle, circle).
point '(1,1)' <@ circle '<(0,0),2>' → t
|
|
geometric_type && geometric_type → boolean
这些对象有重叠吗?(一个共同点使之为真。) 适用于 box、polygon、circle。
box '(1,1),(0,0)' && box '(2,2),(0,0)' → t
|
|
geometric_type << geometric_type → boolean
第一个对象完全位于第二个对象的左边吗? 适用于 point, box, polygon, circle。
circle '<(0,0),1>' << circle '<(5,0),1>' → t
|
|
geometric_type >> geometric_type → boolean
第一个对象完全位于第二个对象的右边吗? 适用于 point, box, polygon, circle。
circle '<(5,0),1>' >> circle '<(0,0),1>' → t
|
|
geometric_type &< geometric_type → boolean
第一个对象没有延伸到第二个对象的右侧吗? 适用于 box, polygon, circle。
box '(1,1),(0,0)' &< box '(2,2),(0,0)' → t
|
|
geometric_type &> geometric_type → boolean
第一个对象没有延伸到第二个对象的左侧吗? 适用于 box, polygon, circle。
box '(3,3),(0,0)' &> box '(2,2),(0,0)' → t
|
|
geometric_type <<| geometric_type → boolean
第一个对象是否确定位于第二个对象下面? 适用于 point, box, polygon, circle。
box '(3,3),(0,0)' <<| box '(5,5),(3,4)' → t
|
|
geometric_type |>> geometric_type → boolean
第一个对象是否确定位于第二个对象上面? 适用于 point, box, polygon, circle.
box '(5,5),(3,4)' |>> box '(3,3),(0,0)' → t
|
|
geometric_type &<| geometric_type → boolean
第一个对象是否没有扩展到第二个对象上面? 适用于 box, polygon, circle.
box '(1,1),(0,0)' &<| box '(2,2),(0,0)' → t
|
|
geometric_type |&> geometric_type → boolean
第一个对象是否没有扩展到第二个对象下面? 适用于 box, polygon, circle.
box '(3,3),(0,0)' |&> box '(2,2),(0,0)' → t
|
|
box <^ box → boolean
第一个对象是否位于第二个对象下面(允许边缘相切)?
box '((1,1),(0,0))' <^ box '((2,2),(1,1))' → t
|
|
box >^ box → boolean
第一个对象是否位于第二个对象上面(允许边缘相切)?
box '((2,2),(1,1))' >^ box '((1,1),(0,0))' → t
|
|
geometric_type ?# geometric_type → boolean
这些对象是否相交? 适用于这些类型对: (box, box), (lseg, box), (lseg, lseg), (lseg, line), (line, box), (line, line), (path, path).
lseg '[(-1,0),(1,0)]' ?# box '(2,2),(-2,-2)' → t
|
|
?- line → boolean
?- lseg → boolean
线是水平的?
?- lseg '[(-1,0),(1,0)]' → t
|
|
point ?- point → boolean
点是否水平对齐(即具有相同的y坐标)?
point '(1,0)' ?- point '(0,0)' → t
|
|
?| line → boolean
?| lseg → boolean
线是纵向的?
?| lseg '[(-1,0),(1,0)]' → f
|
|
point ?| point → boolean
点是否垂直对齐(即具有相同的x坐标)?
point '(0,1)' ?| point '(0,0)' → t
|
|
line ?-| line → boolean
lseg ?-| lseg → boolean
线是垂直的?
lseg '[(0,0),(0,1)]' ?-| lseg '[(0,0),(1,0)]' → t
|
|
line ?|| line → boolean
lseg ?|| lseg → boolean
线是平行的?
lseg '[(-1,0),(1,0)]' ?|| lseg '[(-1,2),(1,2)]' → t
|
|
geometric_type ~= geometric_type → boolean
这些对象是相同的吗? 适用于 point, box, polygon, circle.
polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))' → t
|