Vsak operator, ki ga program .lolo lahko pokliče, iz kanoničnega registra, ki ga prevajalnik vgradi.
Imenski prostori na tej strani: geo/, graph/, grid/, vec/.
geo/aabb-overlapAxis-aligned bounding box overlap test
(geo/aabb-overlap a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | object | First bounding box |
b | object | Second bounding box |
Vrne: boolean
Primer
(geo/aabb-overlap {"x":0,"y":0,"w":10,"h":10} {"x":5,"y":5,"w":10,"h":10}) // => truegeo/circle-overlapCircle overlap test: distance(centers) <= a.r+b.r
(geo/circle-overlap a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | object | First circle |
b | object | Second circle |
Vrne: boolean
Primer
(geo/circle-overlap {"x":0,"y":0,"r":3} {"x":4,"y":0,"r":2}) // => truegeo/point-in-circlePoint containment in circle (inclusive)
(geo/point-in-circle point circle)Parametri
| Ime | Tip | Opis |
|---|---|---|
point | object | Point coordinates |
circle | object | Circle (center and radius) |
Vrne: boolean
Primer
(geo/point-in-circle {"x":1,"y":1} {"x":0,"y":0,"r":2}) // => truegeo/point-in-rectPoint containment in rect (inclusive bounds)
(geo/point-in-rect point rect)Parametri
| Ime | Tip | Opis |
|---|---|---|
point | object | Point coordinates |
rect | object | Rectangle bounds |
Vrne: boolean
Primer
(geo/point-in-rect {"x":5,"y":5} {"x":0,"y":0,"w":10,"h":10}) // => truegeo/rect-circle-overlapRect-circle overlap via closest point on rect to circle center
(geo/rect-circle-overlap rect circle)Parametri
| Ime | Tip | Opis |
|---|---|---|
rect | object | Rectangle bounds |
circle | object | Circle (center and radius) |
Vrne: boolean
Primer
(geo/rect-circle-overlap {"x":0,"y":0,"w":10,"h":10} {"x":12,"y":5,"r":3}) // => truegeo/reflectReflect vector v across normal n (assumed normalized)
(geo/reflect v n)Parametri
| Ime | Tip | Opis |
|---|---|---|
v | object | Vector to reflect |
n | object | Surface normal |
Vrne: vector
Primer
(geo/reflect {"x":1,"y":-1} {"x":0,"y":1})geo/segment-intersectIntersection point of two segments, or null when parallel/none
(geo/segment-intersect seg1 seg2)Parametri
| Ime | Tip | Opis |
|---|---|---|
seg1 | array | First segment endpoints |
seg2 | array | Second segment endpoints |
Vrne: point | null
Primer
(geo/segment-intersect {"x1":0,"y1":0,"x2":4,"y2":4} {"x1":0,"y1":4,"x2":4,"y2":0})graph/add-self-loopsAdd self-loop edges to graph
(graph/add-self-loops graph)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to augment |
Vrne: graph
Primer
(graph/add-self-loops ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]])graph/batchBatch multiple graphs into one
(graph/batch graphs)Parametri
| Ime | Tip | Opis |
|---|---|---|
graphs | array | Graphs to batch |
Vrne: graph
Primer
(graph/batch [["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]]])graph/degreeGet node degree tensor
(graph/degree graph)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to query |
Vrne: tensor
Primer
(graph/degree ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]])graph/edge-featuresGet edge feature matrix
(graph/edge-features graph)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to query |
Vrne: tensor
Primer
(graph/edge-features ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]])graph/edge-indexGet edge index tensor
(graph/edge-index graph)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to query |
Vrne: tensor
Primer
(graph/edge-index ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]])graph/from-adjacencyBuild graph from adjacency matrix and features
(graph/from-adjacency adjacency features)Parametri
| Ime | Tip | Opis |
|---|---|---|
adjacency | object | Adjacency matrix |
features | object | Node features |
Vrne: graph
Primer
(graph/from-adjacency [[0,1],[1,0]] [[1.0],[2.0]])graph/from-edge-listBuild graph from edge list and features
(graph/from-edge-list edges features)Parametri
| Ime | Tip | Opis |
|---|---|---|
edges | array | Edge list |
features | object | Node features |
Vrne: graph
Primer
(graph/from-edge-list [[0,1]] [[1.0],[2.0]])graph/from-entitiesBuild PyG graph from entity collections
(graph/from-entities entities)Parametri
| Ime | Tip | Opis |
|---|---|---|
entities | array | Entity collection |
Vrne: graph
Primer
(graph/from-entities [{"age":30,"score":0.5},{"age":25,"score":0.7}])graph/k-hopK-hop neighborhood subgraph
(graph/k-hop graph nodeId k)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to traverse |
nodeId | string | Starting node ID |
k | number | Hop distance |
Vrne: graph
Primer
(graph/k-hop ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]] 0 2)graph/node-featuresGet node feature matrix
(graph/node-features graph)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to query |
Vrne: tensor
Primer
(graph/node-features ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]])graph/num-edgesGet edge count
(graph/num-edges graph)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to query |
Vrne: number
Primer
(graph/num-edges ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]]) // => 2graph/num-nodesGet node count
(graph/num-nodes graph)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to query |
Vrne: number
Primer
(graph/num-nodes ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]]) // => 2graph/subgraphExtract subgraph by node mask
(graph/subgraph graph mask)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Graph to subset |
mask | array | Node selection mask |
Vrne: graph
Primer
(graph/subgraph ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]] [true,false])graph/to-undirectedConvert directed graph to undirected
(graph/to-undirected graph)Parametri
| Ime | Tip | Opis |
|---|---|---|
graph | object | Directed graph |
Vrne: graph
Primer
(graph/to-undirected ["graph/from-adjacency",[[0,1],[1,0]],[[1.0],[2.0]]])grid/cells-in-radiusAll cells within Euclidean radius r (row-major order)
(grid/cells-in-radius center radius)Parametri
| Ime | Tip | Opis |
|---|---|---|
center | object | Center cell |
radius | number | Euclidean radius |
Vrne: array
Primer
(grid/cells-in-radius {"x":0,"y":0} 1)grid/distanceChebyshev distance max(|dx|,|dy|)
(grid/distance a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | object | First cell |
b | object | Second cell |
Vrne: number
Primer
(grid/distance {"x":0,"y":0} {"x":3,"y":2}) // => 3grid/from-worldWorld point to grid cell (floor)
(grid/from-world point cellSize)Parametri
| Ime | Tip | Opis |
|---|---|---|
point | object | World coordinates |
cellSize | number | Cell size in world units |
Vrne: cell
Primer
(grid/from-world {"x":80,"y":112} 32)grid/in-boundsWhether cell lies within a w×h grid
(grid/in-bounds cell width height)Parametri
| Ime | Tip | Opis |
|---|---|---|
cell | object | Cell to check |
width | number | Grid width |
height | number | Grid height |
Vrne: boolean
Primer
(grid/in-bounds {"x":2,"y":3} 5 5) // => truegrid/iso-to-screenIsometric cell to screen point
(grid/iso-to-screen cell tileW tileH)Parametri
| Ime | Tip | Opis |
|---|---|---|
cell | object | Isometric cell |
tileW | number | Tile width |
tileH | number | Tile height |
Vrne: point
Primer
(grid/iso-to-screen {"x":1,"y":0} 64 32)grid/lineBresenham line cells from a to b, inclusive, in step order
(grid/line a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | object | Starting cell |
b | object | Ending cell |
Vrne: array
Primer
(grid/line {"x":0,"y":0} {"x":2,"y":2})grid/manhattan-distanceManhattan distance |dx|+|dy|
(grid/manhattan-distance p1 p2)Parametri
| Ime | Tip | Opis |
|---|---|---|
p1 | object | First point |
p2 | object | Second point |
Vrne: number
Primer
(grid/manhattan-distance {"x":0,"y":0} {"x":3,"y":2}) // => 5grid/neighborsAdjacent cells in order N,E,S,W (+NE,SE,SW,NW if diagonal)
(grid/neighbors cell)Parametri
| Ime | Tip | Opis |
|---|---|---|
cell | object | Grid cell coordinates |
Vrne: array
Primer
(grid/neighbors {"x":1,"y":1})grid/screen-to-isoScreen point to isometric cell coordinates
(grid/screen-to-iso x y z)Parametri
| Ime | Tip | Opis |
|---|---|---|
x | number | Screen x coordinate |
y | number | Screen y coordinate |
z | number | Scale or depth |
Vrne: point
Primer
(grid/screen-to-iso 640 360 1)grid/to-worldCell to world-space center point
(grid/to-world x y)Parametri
| Ime | Tip | Opis |
|---|---|---|
x | number | Cell x coordinate |
y | number | Cell y coordinate |
Vrne: point
Primer
(grid/to-world 10 15) // => 150vec/addComponentwise vector addition a+b
(vec/add a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | vector | First vector |
b | vector | Second vector |
Vrne: vector
Primer
(vec/add [1 2 3] [4 5 6]) // => [5 7 9]vec/angleHeading atan2(y,x) (1 arg) or angle between two vectors (2 args), radians
(vec/angle v other)Parametri
| Ime | Tip | Opis |
|---|---|---|
v | vector | Vector or heading |
other | vector | Other vector (variadic) |
Vrne: number
Primer
(vec/angle [1 1]) // => 0.785vec/clamp-lengthClamp magnitude to max (preserves direction)
(vec/clamp-length v max_length)Parametri
| Ime | Tip | Opis |
|---|---|---|
v | vector | Vector to clamp |
max_length | number | Maximum magnitude |
Vrne: vector
Primer
(vec/clamp-length [10 10] 12) // => [8.485 8.485]vec/cross3D cross product → vector; 2D → scalar ax·by-ay·bx
(vec/cross a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | vector | First vector |
b | vector | Second vector |
Vrne: vector | number
Primer
(vec/cross [1 0 0] [0 1 0]) // => [0 0 1]vec/distanceEuclidean distance length(sub(a,b))
(vec/distance a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | vector | First point |
b | vector | Second point |
Vrne: number
Primer
(vec/distance [0 0] [3 4]) // => 5vec/distance-sqSquared distance length-sq(sub(a,b))
(vec/distance-sq a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | vector | First point |
b | vector | Second point |
Vrne: number
Primer
(vec/distance-sq [0 0] [3 4]) // => 25vec/dotDot product ax·bx+ay·by(+az·bz)
(vec/dot a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | vector | First vector |
b | vector | Second vector |
Vrne: number
Primer
(vec/dot [1 2 3] [4 5 6]) // => 32vec/lengthVector magnitude sqrt(dot(a,a))
(vec/length v)Parametri
| Ime | Tip | Opis |
|---|---|---|
v | vector | Vector |
Vrne: number
Primer
(vec/length [3 4]) // => 5vec/length-sqSquared magnitude dot(a,a)
(vec/length-sq v)Parametri
| Ime | Tip | Opis |
|---|---|---|
v | vector | Vector |
Vrne: number
Primer
(vec/length-sq [3 4]) // => 25vec/lerpComponentwise linear interpolation a+(b-a)*t
(vec/lerp a b t)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | vector | Start vector |
b | vector | End vector |
t | number | Interpolation factor |
Vrne: vector
Primer
(vec/lerp [0 0] [10 10] 0.5) // => [5 5]vec/normalizeUnit vector a/len; zero-length → zero vector (same dim)
(vec/normalize v)Parametri
| Ime | Tip | Opis |
|---|---|---|
v | vector | Vector to normalize |
Vrne: vector
Primer
(vec/normalize [3 4]) // => [0.6 0.8]vec/rotate2D rotate by rad (z preserved): x'=x·cos-y·sin, y'=x·sin+y·cos
(vec/rotate v rad)Parametri
| Ime | Tip | Opis |
|---|---|---|
v | vector | Vector to rotate |
rad | number | Rotation in radians |
Vrne: vector
Primer
(vec/rotate [1 0] 1.57) // => [0 1]vec/scaleComponentwise scalar multiply a*k
(vec/scale v k)Parametri
| Ime | Tip | Opis |
|---|---|---|
v | vector | Vector to scale |
k | number | Scale factor |
Vrne: vector
Primer
(vec/scale [1 2 3] 2) // => [2 4 6]vec/subComponentwise vector subtraction a-b
(vec/sub a b)Parametri
| Ime | Tip | Opis |
|---|---|---|
a | vector | First vector |
b | vector | Second vector |
Vrne: vector
Primer
(vec/sub [5 7 9] [1 2 3]) // => [4 5 6]