vrld ece4ff6472 Make love.math a singleton. Remove code duplication. Add love.math.triangulate.
love::math::Math is now a singleton, so other modules can use it via
love::math::Math::instance.


Removed duplicate implementations of various rng helper functions.
ParticleSystem now uses love::math::Math's RNG.


New function: love.math.triangulate(vertices)

Accepts a table or list of x/y coordinate pairs and returns a table of tables.
The inner tables are the triangles the polygon is composed of.

Works on all *simple* polygons, i.e. a closed chain of vertices that does not
intersect itself. Attempting to triangulate non-simple polygons is undefined
behavior - in the best case it throws an error, in the worst case it returns
an invalid triangulation.

Polygons must be ordered in *clockwise order* with respect to the love
coordinate system. Attempting to triangulate a ccw polygon will throw an
error.

Examples:

  triangles = love.math.triangulate(0,0, 1,1, 2,0, 2,2, 0,2)
  triangles == {
      {1,1, 2,0, 2,2},
      {1,1, 2,2, 0,2},
      {1,1, 0,2, 0,0},
  }

  triangles = love.math.triangulate({0,0, 1,1, 2,0, 2,2, 0,2})
  -- same as above

  triangles = love.math.triangulate(0,2, 2,2, 2,0, 1,1, 0,0)
  -- error - polygons is in counterclockwise order

  triangles = love.math.triangulate(0,0, 1,3, 2,0, 2,2, 0,2)
  -- undefined behavior - polygon intersects itself (because of edge 1,3)
2013-03-13 20:48:39 +01:00
2012-07-03 15:09:24 +02:00
2012-04-02 16:33:52 -04:00
2012-07-21 21:56:10 +02:00

LÖVE is an awesome framework you can use to make 2D games in Lua. It's free, open-source, and works on Windows, Mac OS X and Linux.

Documentation

We use our wiki for documentation. If you need further help, feel free to ask on our forums, and last but not least there's the irc channel #love on OFTC.

Compilation

###Windows Use the project files for Visual Studio 2010 located in the platform dir.

###*nix Run platform/unix/automagic, then run ./configure and make.

###OSX Use the XCode project in platform/macosx.

For both Windows and OSX there are dependencies available here.

Repository information

We use the 'default' branch for development, and therefore it should not be considered stable. Also used is the 'minor' branch, which is used for features in the next minor version and it is not our development target (which would be the next revision). (Version numbers formatted major.minor.revision.)

We tag all our releases (since we started using mercurial), and have binary downloads available for them.

Builds

Releases are found in the 'downloads' section on bitbucket, are linked on the site, and there's a ppa for ubuntu, ppa:bartbes/love-stable.

There are also unstable/nightly builds:

  • For windows they are located here.
  • For ubuntu linux they are in ppa:bartbes/love-unstable
  • For arch linux there's love-hg in the AUR.
  • For other linuxes and OSX there are currently no official builds.

Dependencies

  • SDL
  • OpenGL
  • OpenAL
  • Lua / LuaJIT / LLVM-lua
  • DevIL with MNG and TIFF
  • FreeType
  • PhysicsFS
  • ModPlug
  • mpg123
  • Vorbisfile
S
Description
No description provided
Readme 100 MiB
Languages
C++ 83.6%
C 13.4%
Lua 2%
Objective-C++ 0.5%
CMake 0.2%
Other 0.1%