Giter VIP home page Giter VIP logo

pyglm's Introduction

pyglm

pyglm is a Python 3 implementation of the OpenGL math library glm. The objective of this module is to give native support to some of the best features of glm, such as vectors and matrices for computer graphics, as well as other relevant functions and structures.

Features

  • Vectors of 2, 3 and 4 dimensions.
  • Square matrices of 2, 3 and 4 dimensions.
  • Basic transforms: translate, rotate and scale.
  • Basic vector and matrix functionalites:
    • dot product for vectors
    • cross product for 3d vectors
    • *operator overload for arithmethic operations over matrices and vectors
  • **Test units
  • GLSL syntax

* The operator overload follows glm convention, such that a product between vectors: let a, b be two 2d vectors, a * b = (a.x * b.x, a.y * b.y)

** Test units are only implemented for vectors so far.

Planned Features

Check TODO document for the planned features list.

Changelog

Check the CHANGELOG document for a detailed list of changes between versions.

Dependencies

There are no explicit dependencies on the module apart from Python 3. This might change in the future, but I will try to keep third-party dependencies to a minimum, if they become necessary.

Usage

To use the modules, just import the module into your project and use it.

>>> from glvector import *
>>> from glmatrix import *
>>>
>>> u = vec2(1,2)
>>> v = vec2(3,4)
>>>
>>> distance(u,v)
2.8284271247461903
>>>
>>> A = mat2.fromVec2(u,v)
>>> A
mat2(1, 2, 3, 4)
>>>
>>> A * u
vec2(5,11)

License

MIT License

Copyright (c) 2016 Felipe Santos Oliveira

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

pyglm's People

Contributors

fesoliveira014 avatar

Stargazers

CANTENOT Thierry avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.