alexus37 / asteroidField

A n-body simulation with collision detection https://www.youtube.com/watch?v=qUCG8pPnXn4&feature=youtu.be

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project: Asteroid Fields

Getting Started

Prerequisites

Open Scene Graph (OSG, Version > 3.2.1)

Windows:

  • Download the libraries of OSG from here: http://objexx.com/OpenSceneGraph.html (debug and release if you want to build in both)
  • Extract to <path_to_osg>/ (I pasted release and debug in the same, since they use a "d" as postfix for each files => no problems with overwritting etc)
  • Add path <path_to_osg>/bin to the PATH-environment-variable

Ubuntu:

  • Install the libraries with "sudo apt-get install openscenegraph libopenscenegraph-dev libopenscenegraph100v5"
  • For the examples one can use "sudo apt-get install openscenegraph-examples". These can then simply called by the command "osgteapot" for example.
  • Includes should be at "/usr/include" and libraries at /usr/lib/x86_64-linux-gnu (at least for me.. ;-) )

Boost (Version > 1.54)

Windows:

Ubuntu:

CGAL (Version 4.12-I-900 - Install from git-source)

Windows:

Ubuntu:

  • Instructions: https://www.cgal.org/download/linux.html
  • Install the libraries with "sudo apt-get install libcgal*"
  • If this works, fine, otherwise:
    • Download the source from git to <path_to_cgal>
    • Build it with make install in <path_to_cgal>/build

Project-setup

I suggest to use the cmake-gui, since it most likely does not find the variables autoamtically, so it might be easier to set them correctly.

  • Specify the location for source to "physSim/project/code" and for binaries to "physSim/project/code/build".
  • Hit configure (Windows => make sure to select 64Bit-version)
  • Verify or set these variables:
    • OPENSCENEGRAPH_INCLUDE_DIR:
      • Windows: <path_to_osg>/include
      • Ubuntu: /usr/include
    • OPENSCENEGRAPH_LIB_DIR:
      • Windows: <path_to_osg>/lib
      • Ubuntu: /usr/lib/x86_64-linux-gnu (for me)
    • BOOST_INCLUDE_DIR: (acvanced, when found => Boost version: 1.65.1 Boost_FOUND=true. is written in the output of cmake)
      • Windows: <path_to_boost>
      • Ubunutu: /usr/include
    • CGAL_DIR:
      • Windows: <path_to_cgal>/build
      • Ubuntu: <path_to_cgal>/build
  • Generate

Open the project, build and run it and enjoy :-) Verify that the path to the models in "config.h" is set to the correct folder (should already, but you never know).

Structure

I added two asteroid (3d obj models) and two planets (simple spheres). Both implemented in the classes Asteroid, and Planet respectively. So far it is really basic and I will continue with working on the look and feel of the whole scene => nicer background than violet and so on :-)

The structure is meant to be like this:

  • Core: main loop, path config, ...
  • Graphics: All graphics calculations (convex-hull, minkowski-sum, ...)
  • OSG: Using and setup of OSG. All rendering-relevant parts are included here as well classes to work with OSG.
  • OSG/Visitors: All visitors which are used for OSG to traverse the graph to make calculations/changes on the nodes
  • Physics: All physics calculations (Collision-handling, NBody-handling, ...)
  • Scene: Used to build and manage the scene and the objects which are currently on the scene.

About

A n-body simulation with collision detection https://www.youtube.com/watch?v=qUCG8pPnXn4&feature=youtu.be


Languages

Language:C++ 81.7%Language:Fortran 11.0%Language:CMake 2.8%Language:C 2.3%Language:Cuda 1.1%Language:Objective-C 0.6%Language:Shell 0.2%Language:Python 0.1%Language:GLSL 0.1%Language:JavaScript 0.1%Language:CSS 0.0%