Giter Site home page Giter Site logo

toge / homog2d Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skramm/homog2d

0.0 0.0 0.0 3.58 MB

C++ 2D geometry library, handles points, lines, polylines, planar transformations (and other primitives), using homogeneous coordinates. Provided with complete manual and samples.

License: Other

Shell 0.48% C++ 95.87% CSS 0.02% TeX 0.63% Gnuplot 0.58% Makefile 2.43%

homog2d's Introduction

homog2d

Current test status: Build Status
License: MPLv2

A single-file header-only C++ library dedicated to handling 2D lines, points and homographies (2D planar transformations), using internally homogeneous coordinates. Also handles other geometric primitives, see full manual.

showcase1

(see other demos here)

Short preview:

#include "homog2d.hpp"
using namespace h2d;
int main()
{
	Line2d l1( Point2d(10,10) );               // a line passing through (0,0) and (10,10)
	Line2d l2( Point2d(0,10), Point2d(10,0) ); // a line passing through (0,10) and (10,0)
	auto pt = l1 * l2;                         // intersection point (5,5)
	Homogr H(2,3);                             // a translation matrix
	std::cout << H * pt;                       // prints [7,8]
}

News

  • 2022-11-23: fresh 2.9 release, lots of new features, see https://github.com/skramm/homog2d/releases
  • 2022-09-23: passed the 1000 unit tests threshold (with $ make test -j4 USE_TINYXML2=Y USE_OPENCV=Y)
  • 2022-08-30: added SVG import
  • 2022-08-02: 2.8 release
  • 2022-05-18: 2.7 release

(see history for more)

Details

  • Install: to install on your machine, copy file homog2d.hpp somewhere where your compiler can reach it, or $ sudo make install after cloning repo. This will copy that file in /usr/local/include.

  • Audience: any C++ dev requiring some basic computational geometry, without the burden of large scale framework.

  • Usage: see full manual

  • Reference: once downloaded, enter $ make doc (requires Doxygen).

  • A test file is provided, needs Catch. When installed, run $ make test (or $ make testall for testing with all 3 numerical types).

  • Contributing: at present, the best you can do is testing and bug/issue reporting. Don't hesitate, this is still beta but stable release expected soon.

  • Rationale:

    • Usage simplicity, max flexibility
    • No dependency (*)
    • Modern C++, using policy-based design, tag dispatching, sfinae, ...
    • Direct bindings with OpenCv (optional)
  • Geometric features:

    • basic primitives: points, lines, segments, circles, rectangles, polygons, ellipse,
    • planar transformation of any of these (rotation, translation, ...),
    • computing of intersection points between these,
    • easy binding with other libs,
    • ...
  • Related libraries:

    • Opencv the reference CV library, much more algorithms, but no direct support for homogeneous geometry.
    • Wykobi, has much more computational geometry features but no direct support for homogeneous geometry.

Warning: The images shown in the manual are there just there as an illustration of what the library does, but there is no rendering code included. The library provides drawing function whose implementation requires external code. The images are drawn using a third-party library, but it is not needed to use this library.

(*): Except for some additional features, see manual.

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.