Code Monkey home page Code Monkey logo

computationalgeometry's Introduction

ComputationalGeometry

Computational Geometry has to do with the study of algorithms for solving geometrical problems. Concerning this field, this repository is an attempt to provide a codebase able to support the implementation of some of its algorithms.

Codebase

Representation of 2D points with integer coordinates

See src/point.h.

Polygon manipulation library

See src/polygon.h.

Applications

Polygon triangulation

Given is the counterclockwise sequence of vertices (one per line) that describe a simple polygon. Each vertex is represented by its coordinates. For instance (cf. eg/i.18 from [Ccode2.tar.gz] (http://cs.smith.edu/~orourke/CGCode/SecondEdition/Ccode2.tar.gz)):

0	0
10	7
12	3
20	8
13	17
10	12
12	14
14	9
8	10
6	14
10	15
7	18
0	16
1	13
3	15
5	8
-2	9
 5	5

Output n-3 (n being the number of vertices) diagonals that witness a triangulation for such polygon. For instance:

5 5 10 7
10 7 20 8
13 17 12 14
13 17 14 9
6 14 7 18
0 16 3 15
5 8 5 5
5 8 10 7
5 8 20 8
20 8 14 9
7 18 3 15
5 8 14 9
5 8 8 10
5 8 6 14
6 14 3 15

o.18

O(n^3) solution

See app/tri3.c. Usage example:

./tri3 < ../eg/i.18

O(n^2) solution

See app/tri2.c. Usage example:

./tri2 < ../eg/i.18

References

  • Computational Geometry in C (2nd ed), Joseph O'Rourke.

computationalgeometry's People

Contributors

xavierpinho avatar tacf 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.