Giter VIP home page Giter VIP logo

plate-tectonics's Introduction

Plate-tectonics

Travis Build Status AppVeyor Build status

This is a library to simulate plate tectonics. It is written in C++ and it has Python bindings (as part of this project), as well as Haskell bindings (hplatec).

How can I use it?

Being a library you want probably to use it inside some larger program. From example WorldEngine (a world generator) is based on plate-tectonics.

You can also use the examples to just run the code of this library and generate a few maps. However the examples do not unleash the full power of this library. For running the examples check section Running the examples (C++).

How it looks like

The library offers an API to generate heightmaps and some other data about the world resulting from the simulation. The example permits also to generate maps like this one:

You can see a video of simulation based on an old version of this library: http://www.youtube.com/watch?v=bi4b45tMEPE#t=0

How to build plate-tectonics (C++)

We use CMake. Install it and then run the folowing commands

Linux

cmake . -G "Unix Makefiles"
make

Mac OS-X

cmake .
make

This should produce a library (libPlateTectonics.a).

Windows

cmake .
cmake --build .

If you want to build also the examples run:

# instead of cmake .
cmake . -DWITH_EXAMPLES=ON

Note that this command will build the library in the same directory where the source files are hosted. Some prefer to build out of tree the library (i.e., in a separate dir). For example in this scenario:

-- plate-tectonics
\- build-directory

You can enter build-directory and type:

cmake ../plate-tectonics
make

To compile on other platforms please run:

cmake --help

Running the examples (C++)

To run also the examples you need to install the library libpng.

From the root directory run:

cmake -DWITH_EXAMPLE=TRUE -G "Unix Makefiles"
make
cd examples
./simulation_rect

How to run tests (C++)

To run tests you need to install DevIL

We use googletest (which is included in the project). After building the library:

cd test
make
./PlateTectonicsTest

Currently the test coverage is still poor (but improving!_, tests are present only for new code and tiny portion of the old code that were refactored.

Python bindings

Supported versions:

  • Python 2.6 (currently not supported on AppVeyor)
  • Python 2.7
  • Python 3.2 (currently not supported on AppVeyor)
  • Python 3.3
  • Python 3.4

To use it in your program you can either add a dependency use pip (pip install PyPlatec) or build and install it from source code.

Compile (Python)

python setup.py build

Usage (Python)

The library is quite simple:

    import platec

    p = platec.create(seed=3)
    while platec.is_finished(p) == 0:
        platec.step(p)
    hm = platec.get_heightmap(p)
    platec.destroy(p)

Or if you want more control:

    import platec
    
    p = platec.create(seed=3, width=1000, height=800,
                      sea_level=0.65,erosion_period=60,
                      folding_ratio=0.02,aggr_overlap_abs=1000000,
                      aggr_overlap_rel=0.33,cycle_count=2,num_plates=10)

Plans for the future

  • Improve the quality of the code and add some tests
  • Support Google protocol buffer

Projects using plate-tectonics

WorldEngine, a world generator

Original project

A fork of platec http://sourceforge.net/projects/platec/ . That project is part of a Bachelor of Engineering thesis in Metropolia University of Applied Sciences, Helsinki, Finland. The thesis is freely downloadable from http://urn.fi/URN:NBN:fi:amk-201204023993 .

Kudos to the original author: Lauri Viitanen!

plate-tectonics's People

Contributors

cycloverid avatar ftomassetti avatar newproggie avatar psi29a avatar

Watchers

 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.