New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalar multiplication and division for wx.Point and friends #971

Closed
RobinD42 opened this Issue Aug 23, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@RobinD42
Copy link
Member

RobinD42 commented Aug 23, 2018

Operating system: any
wxPython version & source: any
Python version & source: any

Description of the problem:

Multiplying a wx.Point by a double ends up truncating the floating point value before passing it to the C++ operator. This is likely just due to not including a wrapper for the double version of the operator.

Add the missing double operators for wx.Point, and others, and corresponding unit tests. I think sip will be able to handle overloads between int/double, but that will need to be verified.

@mesalu

This comment has been minimized.

Copy link
Collaborator

mesalu commented Aug 28, 2018

There's an overloading issue in SIP if we add the extra overload to WIG code. Options are to take a hit by coercing all scalar arithmetic to double precision (overal minor hit, but could potentially stack up in computationally complex drawing?)
or try to solve the issue at a far lower level.

@RobinD42, thoughts?

@RobinD42

This comment has been minimized.

Copy link
Member

RobinD42 commented Aug 30, 2018

I think it would be okay to just provide the double version of those operator wrappers.

@mesalu mesalu changed the title Scalar multiplication for wx.Point and friends Scalar multiplication and division for wx.Point and friends Aug 30, 2018

@itsayellow

This comment has been minimized.

Copy link
Contributor

itsayellow commented Sep 1, 2018

In particular I noticed that wx.RealPoint doesn't allow multiplication by a floating point number, which seemed particularly non-intuitive, since the actual point is already a floating point value.

Would wx.RealPoint count as a "friend" of wx.Point that could get this ability to multiply by a floating point number? That would be awesome.

@mesalu

This comment has been minimized.

Copy link
Collaborator

mesalu commented Sep 1, 2018

@itsayellow, yes, it is one of the classes affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment