Coder Social home page Coder Social logo

fdf's Introduction

FdF

preview_gif
Visualizing "t1.fdf" in 3D.

scorebadge

About

Fdf (in franch 'fil de fer', meaning 'wireframe model') is about representing a landscape as a 3D object in which all surfaces are outlined in lines. The coordinates of this landscape are stored in a file passe as a parameter to your program. Here is an example:

0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0 10 10  0  0 10 10  0  0  0 10 10 10 10 10  0  0  0
0  0 10 10  0  0 10 10  0  0  0  0  0  0  0 10 10  0  0
0  0 10 10  0  0 10 10  0  0  0  0  0  0  0 10 10  0  0
0  0 10 10 10 10 10 10  0  0  0  0 10 10 10 10  0  0  0
0  0  0 10 10 10 10 10  0  0  0 10 10  0  0  0  0  0  0
0  0  0  0  0  0 10 10  0  0  0 10 10  0  0  0  0  0  0
0  0  0  0  0  0 10 10  0  0  0 10 10 10 10 10 10  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0

Each number corresponds to a point in space:
x: The horizontol position corresponds to its axis.
y: The vertical position corresponds to its ordinate.
z: The value corresponds to its altitude.

Wich render in Fdf:
42

Implementation

Drawing a line

At 42SP we are forced to do everything from the scratch. In this case it meant that we weren't given any line drawing function so we had to figure ourselves how to color pixels between line endpoints with help of miniLibX library. I used Bresenham's line algorithm for drawing a line which was the most obvious choice.

Projections

In this project we must have 2 type of projection but we were free to choose the type of projection: parallel, iso, conic.

I chose to use isometric and conic. Also I added dimetric projections which was very easy to implement from isometric projection (30 degree angle -> 15).

Controls

I have the following controls to help user to view different maps:

• Rotation around the axis: Arrow Keys
• Change projections: 1 = ISO 2 = DIMETRIC 3 = CONIC
• Zooming in and out: Mouse sroll
• Moving the map on the screen: Right click
• Change color mode: 'C' key
• Reset map values: 'D' key

Using graphic library: miniLibX

fdf's People

Contributors

humbertoarndt avatar

Watchers

 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.