Comments (1)
The reason of this behavior is that the Vec2d class uses pythons magic function (__mul__
...) format but cython magic functions behave differently.
See http://cython.readthedocs.io/en/latest/src/userguide/special_methods.html#arithmetic-methods.
There are no "right side of operation" functions (rmul, rsub,...) like in python. but the same arithmetic function is called for the right side with self
set to the left value and other
to the right if the magic function of the left side returns NotImplemented
A fix for the __mul__
function could look like this:
def __mul__(self, other):
if not isinstance(self, Vec2d):
self, other = other, self
if isinstance(other, Vec2d):
return Vec2d(self.x * other.x, self.y * other.y)
if (hasattr(other, "__getitem__")):
return Vec2d(self.x*other[0], self.y*other[1])
else:
return Vec2d(self.x*other, self.y*other)
I could prepare a PR with "cythonized" magic functions some when the next days.
from cymunk.
Related Issues (17)
- shape.pxi - Poly __init__ i_vs possibly unitialised HOT 1
- Shape Layers and Sensors HOT 3
- Can't build on Arch Linux HOT 8
- Crashes on windows 8.1, build with gcc-tdm 4.8 HOT 3
- problems building/importing on windows HOT 15
- free(): invalid pointer error HOT 10
- Error when I try make.
- Any success building this kivy-ios?
- precompiled version for windows? HOT 9
- Cymunk License HOT 2
- gcc: error: cymunk/cymunk.c: No such file or directory HOT 1
- Python 3.6 - doesn't compile on either MSVC or mingw HOT 6
- Use of .pxi files is deprecated
- Chipmunk 7 is out HOT 2
- .
- Error running setup.py on macOS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cymunk.