Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-19 Thread René Dudfield
I'll merge this in now. Consider it stable(ish).

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-15 Thread René Dudfield
Hi, here is a PR for Vector changes from our discussion here (and elsewhere). https://github.com/pygame/pygame/pull/416 - Tests and fixes for keyword arguments with Vector2 Vector3 - Tests for Vector2, and Vector3 scalar constructors like GLSL. Vector3(1) -> Vector3(1, 1, 1) -

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-03 Thread Greg Ewing
Russell Jones wrote: IDK about physics, but AIUI, Z points from side to side, Y points down and X points diagonally; it's Λ that points up. Only if your computer screen is oriented vertically. If you're using a tablet in your lap, Λ points forward and Y points backwards. So obviously the code

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-03 Thread Russell Jones
IDK about physics, but AIUI, Z points from side to side, Y points down and X points diagonally; it's Λ that points up. (sorry) Russell On 1 March 2018 at 08:43, Greg Ewing wrote: > Daniel Pope wrote: > > Y points up in real physics? >> > > No, no, no. Z points up

Re: [SPAM: 5.011] Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-02 Thread Greg Ewing
René Dudfield wrote: So it might be nice to return the length(magnitude) there? BTW, I don't really like the name "length" for a function that returns the magnitude of an arbitrary vector. It only makes sense for vectors representing a physical distance; it's nonsense for anything else

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-02 Thread René Dudfield
Having normalize_ip return the old length would be a bit weird. Yeah, another name like 'normalize_ip_return_length' But maybe longer ;) speed = direction.length_normalize_ip()

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-02 Thread René Dudfield
What is UP for rock climbers hanging upside down, when they are chatting on their phone, which points towards the horizon, whilst they live in Australia? ;) ( @Ian... give in to the temptation... ) Thanks Victor, those are some good notes. And I guess some of them will take some time to

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-01 Thread Ian Mallett
On Thu, Mar 1, 2018 at 1:43 AM, Greg Ewing wrote: > No, no, no. Z points up in real physics! Oh, and I expect "j" is the imaginary unit, "Σ"s can be omitted, gravity is exactly 10 m/s, without the square, and anyway one can drop units whenever one feels like it? (

Re: [SPAM: 6.600] Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-03-01 Thread Greg Ewing
Daniel Pope wrote: Y points up in real physics? No, no, no. Z points up in real physics! -- Greg

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-28 Thread Daniel Pope
> As René pointed out in most of the Pymunk examples Y is converted so that positive Y points up to keep examples consistent and close to "real" physics. Y points up in real physics? This is making my head hurt; I need to go lie -Y.  On Wed, 28 Feb 2018, 22:52 Victor Blomqvist,

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-28 Thread Victor Blomqvist
Hi, René sent an email asking if I had any input (as the author of pymunk), so here I am. In general I think it seems like a very well versed vector library in the making :) A couple of comments: 1. A function that normalizes and returns the length before normalizing in one call can be useful

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-27 Thread Daniel Pope
> Vector2(x=0, y=0) -> Vector(0, 0) If rgba and uvst are swizzle attributes, are they also accepted as kwargs? > However, I feel this single scalar is hard to make a mistake with accidentally passing in the wrong thing? I don't think so. I think it could easily happen accidentally, while

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-27 Thread Daniel Pope
> We want to go two left? This is sort of nice. > >>> velocity + Vector3.left * 2 Christening a particular axis or Vector as "left" had all kinds of problems. Which way is up? +y, like a graph? -y, like Surface coordinates? Is it a left-handed or right-handed coordinate system? On Tue, 27 Feb

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-27 Thread Ian Mallett
​(Skims discussion) For e.g. `abs(Vector2(2,-1).elementwise())`, my (C++) library instead handles this as `abs(Vec2(2,-1))`, returning another `Vec2`. In C++, if you weren't expecting that, you get a compile error on whatever happens next, whereas in Python you'll get a `TypeError`, so it's

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-27 Thread René Dudfield
Some static constructors could be useful. up, down, left, right forward, back zero, one, two, ... >>> velocity = Vector3(1, 2, 3) We want to go two left? This is sort of nice. >>> velocity + Vector3.left * 2 >>> Vector3.left >>> Vector3.right

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-27 Thread René Dudfield
Some good points. Thanks, I appreciate the discussion. On Tue, Feb 27, 2018 at 3:51 PM, Daniel Pope wrote: > > Single scalar constructor should Vector2(1) == Vector2(1, 1) > > This is the kind of situation where I'd follow PEP20: "In the face of > ambiguity, refuse the

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-27 Thread Daniel Pope
> Single scalar constructor should Vector2(1) == Vector2(1, 1) This is the kind of situation where I'd follow PEP20: "In the face of ambiguity, refuse the temptation to guess." There's an obvious pitfall if you expected to pass a tuple and you instead pass a scalar or the wrong length tuple - it

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-27 Thread René Dudfield
I've done a much larger review and testing. Comparing it to different vector implementations, and looking at how it inter-operates with pygame and OpenGL APIs. TLDR; these things need to be fixed: - scalar construction is buggy. - One naming improvement I'd like help with is .elementwise() ? I

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-27 Thread René Dudfield
I won't move pygame.math.Vector2/3 into pygame or pygame.locals namespace for now. That's potentially breaking things which already have their own Vector2/3. This type of API change will wait for pygame 2. Narrative documentation is missing, and I'm working on that now.

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-25 Thread René Dudfield
I fixed a bunch of compiler warnings, added a test for lerp(), and tweaked the documentation. Note that the pickle stuff isn't working under pypy.

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-25 Thread Daniel Pope
Indeed, getting the attribute returns a float so the attribute should be settable as a float for consistency. If users are familiar with GLSL[1], they might be surprised that the type of vectors returned by swizzle attribute access is not a vector: >>> from pygame.math import Vector3,

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-25 Thread René Dudfield
Hi, that's a good point. TLDR; I think it should be on by default too. There's still a couple of issues with doing that. It should have _no_ cost in almost all cases for attribute access. Because it first tries normal attribute access. See:

Re: [pygame] Re: removing 'experimental' notice from pygame.math

2018-02-24 Thread Daniel Pope
Does the Swizzling have a cost if you're not using it? If not I'd be tempted to say it should always be on. On Sat, 24 Feb 2018, 18:00 René Dudfield, wrote: > Hey hey, > > I noticed the pygame.math vectors couldn't be pickled/unpickled. > > So that has been added here: >