Code Monkey home page Code Monkey logo

schlafli's Introduction

schlafli

openGL viewer for Polytopes and Tesselations of any dimension Great Stellated 120-cell

This code comes in 2 main parts. The interpreter is passed a schlafli symbol and produces the geometrical description of the polytope, and the viewer displays and/or manipulates the polytope. The interpreters are written in python and ruby whereas the viewer is written in C.

TO USE:

Compile the file with make. This was tested using the freeglut3 implementation of openGL.

make

Execute the code. Some default symbols are accessible within the right-click menu.

make test

Alternatively, execute the code by providing it a description of the geometry (e.g.)

./polytope -symbol "5/2 3 5" -scale 2.5

Commandline options are (Any order is accepted but options with "-" are expected to be followed by something):

-symbol "[schlafli symbol]"
-scale [multiplier] - scales the geometry of the shape by the multiplier
-schlegeldistance [distance] - specifies the distance from the origin used in schlegel projection
-pointsize [size]
-linewidth [size]
schlegel3d - {default} projects a more-than-3 dimensional shape into 3 dimensions using the schlegel projection method.
schlegel2d - projects a more-than-2 dimensional shape into 2 dimensions using the schlegel projection method.
points - draw points
wireframe - {default} draw edges
solid - draw faces. Misbehaves when drawing star polytopes because GL_POLYGON does not support concave shapes

Explanation of Schlafli symbol:

Based upon a community-answered question at: https://codegolf.stackexchange.com/questions/114280/schläfli-convex-regular-polytope-interpreter

Thanks to Level River St and Don Hatch for providing code to generate polytopes.

The Schläfli Symbol is a notation of the form {p,q,r,...} that defines regular polytopes and tessellations.

The Schläfli symbol is a recursive description, starting with a p-sided regular polygon as {p}. For example, {3} is an equilateral triangle, {4} is a square and so on.

A regular polyhedron that has q regular p-sided polygon faces around each vertex is represented by {p,q}. For example, the cube has 3 squares around each vertex and is represented by {4,3}.

A regular 4-dimensional polytope, with r {p,q} regular polyhedral cells around each edge is represented by {p,q,r}. For example a tesseract, {4,3,3}, has 3 cubes, {4,3}, around an edge.

In general a regular polytope {p,q,r,...,y,z} has z {p,q,r,...,y} facets around every peak, where a peak is a vertex in a polyhedron, an edge in a 4-polytope, a face in a 5-polytope, a cell in a 6-polytope, and an (n-3)-face in an n-polytope.

A regular polytope has a regular vertex figure. The vertex figure of a regular polytope {p,q,r,...y,z} is {q,r,...y,z}.

Regular polytopes can have star polygon elements, like the pentagram, with symbol {5/2}, represented by the vertices of a pentagon but connected alternately.

schlafli's People

Stargazers

Dani avatar Jen Bradley avatar Septimiu-Calin Bodica avatar  avatar James Bowman avatar

Watchers

 avatar

Forkers

ghxx

schlafli's Issues

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.