Re: magnet.py.new example in 1.0b2 does not work yet.

7 views
Skip to first unread message

Daniel Ross

unread,
Sep 1, 2010, 7:06:28 PM9/1/10
to General discussion of the Lepton particle engine for Python
I just realized that my 3D math isn't up to the task; I am planning to use Lepton for a 2D game similar to Asteroids. However, removing the "inner_cutoff" parameter on line 72 of magnet.py.new makes it run fine as far as I can tell.

DanR

unread,
Sep 1, 2010, 5:39:08 PM9/1/10
to General discussion of the Lepton particle engine for Python
I tried to run the magnet.py.new example and I got the following:

Traceback (most recent call last):
File "magnet.py.new", line 72, in <module>
proton1 = Magnet(Point((0,0,0)), charge=5000.0,
inner_cutoff=proton_size)
TypeError: 'inner_cutoff' is an invalid keyword argument for this
function

I grepped and located controllermodule.c and found something that
looks like a Magnet class (I've never used Python and C together):

static PyTypeObject MagnetController_Type;

typedef struct {
PyObject_HEAD
PyObject *domain;
float charge;
float exponent;
float epsilon;
float outer_cutoff;
} MagnetControllerObject;

It looks like an inner_cutoff has either not been implemented yet. I
will read about the outer_cutoff and try to make an inner_cutoff, but
I will be doing a several things for the first time here, so no
guarantees.

Casey Duncan

unread,
Sep 2, 2010, 10:57:48 AM9/2/10
to py-lept...@googlegroups.com
It looks like that's an old version of the example file that snuck
into the release. The It shouldn't be there, magnet.py is the correct
code. What used to be the inner_cutoff argument, is now epsilon, which
solves the same problem (forces tending toward infinity as you get
close to the magnet) but in a more satisfactory way.

You may have seen it already, but there is a splode2d.py example in
there as well, that is an example of how you can use lepton in 2d
projections. That said, there's nothing wrong with having 3d effects
in your 2d game either 8^).

Good luck with you game, I'm happy to help with any other questions
you might have. Keep us posted.

-Casey

> --
> You received this message because you are subscribed to the Google Groups "General discussion of the Lepton particle engine for Python" group.
> To post to this group, send email to py-lept...@googlegroups.com.
> To unsubscribe from this group, send email to py-lepton-use...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/py-lepton-users?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages