Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
USING: kernel prettyprint sequences arrays math math.vectors ;
|
||||
IN: raycasting
|
||||
|
||||
: between ( a b x -- ? ) [ last ] tri@ [ < ] curry bi@ xor ;
|
||||
|
||||
: lincomb ( a b x -- w )
|
||||
3dup [ last ] tri@
|
||||
[ - ] curry bi@
|
||||
[ drop ] 2dip
|
||||
neg 2dup + [ / ] curry bi@
|
||||
[ [ v*n ] curry ] bi@ bi* v+ ;
|
||||
: leftof ( a b x -- ? ) dup [ lincomb ] dip [ first ] bi@ > ;
|
||||
|
||||
: ray ( a b x -- ? ) [ between ] [ leftof ] 3bi and ;
|
||||
|
||||
: raycast ( poly x -- ? )
|
||||
[ dup first suffix [ rest-slice ] [ but-last-slice ] bi ] dip
|
||||
[ ray ] curry 2map
|
||||
f [ xor ] reduce ;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
( scratchpad ) CONSTANT: square { { -2 -1 } { 1 -2 } { 2 1 } { -1 2 } }
|
||||
( scratchpad ) square { 0 0 } raycast .
|
||||
t
|
||||
( scratchpad ) square { 5 5 } raycast .
|
||||
f
|
||||
( scratchpad ) square { 2 0 } raycast .
|
||||
f
|
||||
Loading…
Add table
Add a link
Reference in a new issue