Skip to content

Commit bc75bbf

Browse files
author
Jonathan Feinberg
committed
Do PVector.sub in Python to save some garbage.
1 parent 274e2dd commit bc75bbf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

runtime/src/jycessing/core.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,14 @@ def __instance_add__(self, *args):
104104

105105
def __instance_sub__(self, *args):
106106
if len(args) == 1:
107-
return PVector.sub(self, args[0], self)
107+
v = args[0]
108+
self.x -= v.x
109+
self.y -= v.y
110+
self.z -= v.z
108111
else:
109-
return PVector.sub(self, PVector(*args), self)
112+
self.x -= args[0]
113+
self.y -= args[1]
114+
self.z -= args[2]
110115

111116
def __instance_mult__(self, o):
112117
PVector.mult(self, o, self)

0 commit comments

Comments
 (0)