kcell{                     ⍝ Relationship between point and k-cell.
    ⍺←(≢⍵)/2 1⍴0 1          ⍝ Default is unit k-cell.
    b←,[(2=⍴⍴⍺)/⎕IO]⍺       ⍝ Bounds of k-cell.
    p((2⌊⍴⍴⍺)↓1 1,⍴⍵)⍴⍵    ⍝ Points to evaluate.
    d←⊃,¨⍺⍺⌿×-b,.-p         ⍝ Apply operand to signum difference.
    ⍺⍺/⍬:⌈/d ⋄ 5⊥⍉d         ⍝ Result is {¯1,0,1} or integer.
}
code_colours

test script

Back to: notes

Back to: Workspaces