Skip to content

Commit

Permalink
[types] minor optimizations contains-point? & closest-point for Circl…
Browse files Browse the repository at this point in the history
…e2 & Sphere
  • Loading branch information
postspectacular committed Mar 31, 2015
1 parent d8b61f9 commit 887415a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions geom-types/src/circle.org
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
g/PBoundary
(contains-point?
[{p :p r :r} q]
(<= (g/mag-squared (g/- p q)) (* r r)))
(<= (g/dist-squared p q) (* r r)))
#+END_SRC

*** PCenter
Expand Down Expand Up @@ -203,7 +203,7 @@
g/PProximity
(closest-point
[{p :p r :r} q]
(g/+ p (g/normalize (g/- q p) r)))
(g/+! (g/normalize (g/- q p) r) p))
#+END_SRC

*** PSample
Expand Down
2 changes: 1 addition & 1 deletion geom-types/src/sphere.org
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ If there's no intersection, the function returns =nil=.
g/PProximity
(closest-point
[{p :p r :r} q]
(g/+ p (g/normalize (g/- q p) r)))
(g/+! (g/normalize (g/- q p) r) p))
#+END_SRC

*** PSample
Expand Down

0 comments on commit 887415a

Please sign in to comment.