projects
/
python-bulletml.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7b73a60
)
getattr3 is faster than try/except in pyrex.
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 23 Mar 2010 05:28:41 +0000
(22:28 -0700)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 23 Mar 2010 05:28:41 +0000
(22:28 -0700)
bulletml/_collision.pyx
patch
|
blob
|
history
diff --git
a/bulletml/_collision.pyx
b/bulletml/_collision.pyx
index 2011e984a06e1208d3fbe37535d364e0fc51a795..b05702213ca775d73079096d8b03a88005c53877 100644
(file)
--- a/
bulletml/_collision.pyx
+++ b/
bulletml/_collision.pyx
@@
-28,14
+28,10
@@
def overlaps(a, b):
dx = ax - bx
dy = ay - by
- try:
- radius = a.radius
- except AttributeError:
- radius = 0.5
- try:
- radius += b.radius
- except AttributeError:
- radius += 0.5
+
+ radius_a = getattr3(a, 'radius', 0.5)
+ radius_b = getattr3(b, 'radius', 0.5)
+ radius = radius_a + radius_b
return dx * dx + dy * dy <= radius * radius