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
|