|
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,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
計算兩個 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
|