Skip to content

Instantly share code, notes, and snippets.

@W-Net-AI
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save W-Net-AI/63513647e17c3e2bf06b to your computer and use it in GitHub Desktop.
Save W-Net-AI/63513647e17c3e2bf06b to your computer and use it in GitHub Desktop.
(defun set-br (self val)
(let ((a (cons self nil))
(rect-x (@ self :int))
(rect-y (@ self :int 1))
(rect-width (@ self :int 2))
(rect-height (@ self :int 3))
(point-x (@ val :int))
(point-y (@ val :int 1))
(new-x)
(new-y))
(if (>= point-x rect-x)
(setf new-x (- point-x rect-width)))
(if (>= point-y rect-y)
(setf new-y (- point-y rect-height)))
(if (<= point-x rect-x)
(setf new-x (- point-x rect-width)))
(if (<= point-y rect-y)
(setf new-y (- point-y rect-height)))
(setf (car a) (rect new-x new-y rect-width rect-height))(car a)))
(defun mutate (cons)
(let ((a (cons cons nil)))
(setf (car a) 5)(car a)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment