Anonymous user
Ray-casting algorithm: Difference between revisions
→{{header|Racket}}: Added missing implementation details from algorithm.
m (→{{header|REXX}}: used a better over/under statement construct.) |
(→{{header|Racket}}: Added missing implementation details from algorithm.) |
||
Line 2,993:
(module pip racket
(require racket/contract)
(provide point)
(provide seg)
Line 3,002:
(struct point (x y) #:transparent)
(struct seg (Ax Ay Bx By) #:transparent)
(define ε 0.000001)
(define (neq? x y) (not (eq? x y)))
Line 3,013:
(eq? Pyo By))
ε 0))])
(
(define Ay2 (if (< Ay By) Ay By))
(define Bx2 (if (< Ay By) Bx Ax))
(define By2 (if (< Ay By) By Ay))
(cond [(or (> Py (max Ay By)) (< Py (min Ay By))) #f]
[(> Px (max Ax Bx)) #f]
[
[
(if (>= blue red) #t #f))])])))
(define (point-in-polygon? point polygon)
|