Vector math library

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Vilcans

    #1

    Vector math library

    Hi, I'm new to this mailing list and fairly new to Python as well. I'm
    working on a prototype for a 3D game using OpenGL, and take this
    opportunity to learn Python better.

    I'm looking for a good library for vector math. I need to do vector
    addition, cross products, dot products etc. and probably in the future
    I'll need matrix math as well.

    So far I've used the Scientific library, which is very nice, but
    unfortunately it crashes when I use the Rotation class under OSX (which
    is my current development environment). I've seen mailing list posts
    that suggests that this crash is because of some problem with 64 bit CPUs.

    I guess I can find a workaround for this problem, but first I want to
    check if there's a better library for vector math. When I googled for
    vector libraries, I found people claiming that the Numeric library can
    be used for vector math. But skimming the Numeric documentation, I
    didn't find a cross product function for instance, but it may just that
    I don't understand how to use it.

    I also found SciPy, but it doesn't seem to have any vector math in it.
    In fact, I'm a bit confused about the libraries SciPy, Scientific,
    Numeric and NumericArray and the relations between them.

    Any suggestions on what library I should use?

    Best regards,

    Martin Vilcans

  • Bas

    #2
    Re: Vector math library

    I am not a regular user of the libraries that you mention, but I played
    around with some of them because I need a replacement for Matlab.

    Numeric, NumArray and SciPy should be more or less compatible. All the
    functions you mention should be in there, or otherwise should be
    trivial to implement. Have a look at the functions cross(), dot(),
    inner(), outer(). Addition is just a+b.

    As far as I know Numeric was the original vector lib. NumArray was
    written as a successor but ended up as a fork due to some speed
    concerns. Scipy is the latest and tries to unite the previous two by
    implementing the best of both worlds. For future work you should stick
    to SciPy. Right now it is probably somewhere in a beta stage, but
    expect a final version in half a year or so. Hopefully it ends up being
    THE vector lib for python to avoid confusing beginners like you.

    Cheers,
    Bas

    Comment

    • jelle

      #3
      Re: Vector math library

      martin,

      pyformex has a vector module as well.
      its not very pythonic, but it could help you out creating a version of
      your own.
      worth checking out

      Comment

      • Scott David Daniels

        #4
        Re: Vector math library

        Martin Vilcans wrote:[color=blue]
        > Hi, I'm new to this mailing list and fairly new to Python as well. I'm
        > working on a prototype for a 3D game using OpenGL, and take this
        > opportunity to learn Python better.
        >
        > I'm looking for a good library for vector math. I need to do vector
        > addition, cross products, dot products etc. and probably in the future
        > I'll need matrix math as well.
        >[/color]

        Take a quick look at VPython. Should be great for breadboarding your
        display and calculations.


        --
        -Scott David Daniels
        scott.daniels@a cm.org

        Comment

        • mtallen@gmail.com

          #5
          Re: Vector math library

          And then more!

          I started out using cgtypes from the cgkit. Lots of other graphics
          goodies in there also:



          In the end I ended up rolling my own to better understand the whole
          thing.

          Comment

          • Erik Max Francis

            #6
            Re: Vector math library

            Martin Vilcans wrote:
            [color=blue]
            > Hi, I'm new to this mailing list and fairly new to Python as well. I'm
            > working on a prototype for a 3D game using OpenGL, and take this
            > opportunity to learn Python better.
            >
            > I'm looking for a good library for vector math. I need to do vector
            > addition, cross products, dot products etc. and probably in the future
            > I'll need matrix math as well.[/color]

            ZOE has an la a module that helps with linear algebra computations
            including (three-dimensional) vectors and matrices:



            --
            Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
            San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
            You are the lovers rock / The rock that I cling to
            -- Sade

            Comment

            Working...