It's a Slippery Slope
Jelly, 23 bytes
Ṛ⁹,2⁶v$Ṡ$e⁵$?¥þị“/ \-”Y
Try it online!
Arguments: Y
, X
, U
, f
f
is a Python string containing Jelly code. Be sure to quote it appropriately, otherwise you may encounter errors.
Also, f
takes a pair [x, y]
as its argument, not two arguments x
and y
.
APL (Dyalog), 36 34 bytes
2 bytes saved thanks to @ngn
{o←⍺⍺⋄'\-/ '[⊖⍉⍺∘.{0::4⋄2+×⍺o⍵}⍵]}
Try it online! (with modified division, since basic APL 0÷0 is 1)
The black box function comes as left operand, X
as left argument, and Y
as right argument.
Haskell, 114 113 109 bytes
z x=last$0:[x|abs x>1e-9]
(x#y)(%)u=reverse[[last$"\\-/"!!floor(1+signum(z$c%r)):[' '|elem(c,r)u]|c<-x]|r<-y]
Try it online!
Fairly straightforward solution. Uses signum
to index into a string for the right char if the point is defined.
EDIT: Thought of a way to shave off a byte
EDIT 2: Thanks @Laikoni for taking off another 4 bytes!