Lib 2d - A c++ library for paths defined by points within the 2d space

Related tags

Miscellaneous lib_2d
Overview

#lib_2d A c++ library for anything related to points within the 2d space (using floating point data types)
using Catch as testing framework https://github.com/philsquared/Catch

##version 0.9.1

##templated
tested for:

float  
double  
long double

##classes currently, the following classes are supported:

Point<T> //a point defined with two coordinates (x and y)  
PointCloud<T> //a collection Points, without topological information
OrderedPointCloud<T> //a PointCloud with additional information regarding sorting and filtering of points
KdTree<T> //search tree to quickly find nearest neighbors

//subclasses of PointCloud
LineSegment<T> //a line segment defined by start and end point
Rectangle<T> //a rectangle defined by width, height and center
Arc<T> //an arc defined by diameter, center, start- and end angle
Ellipse<T> //an ellipse
InterpolationBezier<T> //a bezier curve interpolation  
InterpolationLinear<T> //a linear interpolation
InvolutCircle<T> //involut curve of a circle

##methods
some of the supported methods:

move_by(...) //moves the Point or PointCloud  
mirror_vertically(...) //mirrors the Point or PointCloud at a vertical line (horizontally and point also supported)  
rotate(...) //rotate by angle around a center  
to_string(...) //write coordinates to a string  
from_string(...) //parse from a string
distance_to(...) //calculate distances between points
load(...) //load coordinates from file
to_file(...) //write coordinates to file  
bounding_box(...)  //the minimum bounding rectangle of a PointCloud  
convex_hull(...) //calculate the convex hull of a PointCloud  
concave_hull(...) //compareable to the convex hull, while better following the shape of a pointcloud
intersections_with(...) //intersections between paths  
sort_x(...) //sort by x (or y)  
range(from,to) //get ranges of PointCloud
and_many(more)  

also chainable:

path.move_by(...).rotate(...).sort_x(...)

##compatible with other containers

vector< Point <T> > vec = vector<Point <T> >(path.begin(), path.end());  
...  
PointCloud<T> path = PointCloud<T>(vec.begin(), vec.end());

##operator overloads

== != //equality  
+ += //appending to PointCloud  
[] //access elements of PointCloud
std::cout << PointCloud<T> << Point<T>; //overloads for streams

##using lib_2d add inc/ to your include path and #include lib_2d.h within your code
/tests/test_lib_2d.cpp also provides a basic usage example

##testing make tests
you can also use
make clean

##contribute
If you find any bugs, feel free to open an issue
If you'd like other PointClouds than Arc etc. open an issue
Also feel free to open a pull request, in case you added / fixed something yourself

You might also like...
WTD is a python tool for replacing values with the C preprocessor macro which defined them.

Where's That Define WTD is a python tool for replacing values with the C preprocessor macro which defined them. An example of this is when trying to u

A well-defined system API for abstracting the OS platform

xsys xsys is an effort to implement a thin and well-defined system API for enabling the development of programs that are portable; platform agnostic.

Set of examples how to use CLion with various unsupported compilers using Custom Defined Compiler feature

About This repository contains: Set of examples how to use CLion with various unsupported compilers using Custom Defined Compiler feature Public set o

My_Shell is a user-defined interactive shell written in C that works similar to the original shell in linux

MY_SHELL Overview My_Shell is a user-defined interactive shell written in C that works similar to the original shell and it can execeute many of the l

BokuLoader - Cobalt Strike User-Defined Reflective Loader written in Assembly & C for advanced evasion capabilities.
BokuLoader - Cobalt Strike User-Defined Reflective Loader written in Assembly & C for advanced evasion capabilities.

BokuLoader - Cobalt Strike Reflective Loader Cobalt Strike User-Defined Reflective Loader written in Assembly & C for advanced evasion capabilities. B

ToPS is an objected-oriented framework implemented using C++ that facilitates the integration of probabilistic models for sequences over a user defined alphabet

ToPS is an objected-oriented framework implemented using C++ that facilitates the integration of probabilistic models for sequences over a user defined alphabet

std::tuple like methods for user defined types without any macro or boilerplate code

Boost.PFR This is a C++14 library for very basic reflection that gives you access to structure elements by index and provides other std::tuple like me

Haptic input knob with software-defined endstops and virtual detents
Haptic input knob with software-defined endstops and virtual detents

SmartKnob SmartKnob is an open-source input device with software-configurable endstops and virtual detents. A brushless gimbal motor is paired with a

QtVerbalExpressions - This Qt lib is based off of the C++ VerbalExpressions library. [MIT]

QtVerbalExpressions Qt Regular Expressions made easy This Qt lib is based off of the C++ VerbalExpressions library by whackashoe. Testing if we have a

Comments
  • doesn't work on Ubuntu 14

    doesn't work on Ubuntu 14

    kbriggs:~/Downloads/lib_2d-master> make tests mkdir -p bin/ g++ -std=c++11 -fmax-errors=10 -DNDEBUG -D USE_DOUBLE tests/test_lib_2d.cpp -o bin/test_lib_2d_DOUBLE g++ -std=c++11 -fmax-errors=10 -DNDEBUG -D USE_LDOUBLE tests/test_lib_2d.cpp -o bin/test_lib_2d_LDOUBLE g++ -std=c++11 -fmax-errors=10 -DNDEBUG -D USE_FLOAT tests/test_lib_2d.cpp -o bin/test_lib_2d_FLOAT ./bin/test_lib_2d_DOUBLE make: *** [run_tests] Segmentation fault (core dumped)

    opened by keithbriggs 6
Owner
Martin Buck
Martin Buck
A web application which finds the shortest or quickest path from two points in the city of Rio de Janeiro.

A web application which finds the shortest or quickest path from two points in the city of Rio de Janeiro. Obviously not Waze. (final project for EDA @ EMAp, 2021)

null 2 Nov 17, 2021
K-Closest Points and Maximum Clique Pruning for Efficient and Effective 3-D Laser Scan Matching (RA-L 2022)

KCP The official implementation of KCP: K-Closest Points and Maximum Clique Pruning for Efficient and Effective 3D Laser Scan Matching, accepted for p

Yu-Kai Lin 109 Dec 14, 2022
Samir Teymurov 1 Oct 6, 2021
Some source code to demonstrate avoiding certain direct syscall detections by locating and JMPing to a legitimate syscall instruction within NTDLL.

hiding-your-syscalls What is this? This repository contains all of the source code from my blog post about avoiding direct syscall detections, which y

null 198 Dec 1, 2022
Godot module to use ROS2 within Godot

godot_ros This repo is a Godot Module meant to connect Robotic Operating System 2 (ROS2) and the Godot Game Engine. Quick Start Make sure to have both

Evan Flynn 32 Dec 27, 2022
This repository contains the source-code for the Robothon 24h series of workshops and competition within ENSTA Borj Cedria.

Robothon: The 24h long zero to hero robotics bootcamp What is Robothon? Robothon by Electronix ENSTABC is a 24h long event held within the walls of EN

Radhi SGHAIER 5 Mar 23, 2022
General repository for all code (games, BIOS, etc) that runs within the Vircon32 console itself

Vircon32: Console software This is a general repository containing all Vircon32 sources for any software running on the console itself. This includes:

Vircon32 17 Nov 13, 2022
The FLIP Fluids addon is a tool that helps you set up, run, and render high quality liquid fluid effects all within Blender, the free and open source 3D creation suite.

FLIP Fluids The FLIP Fluids addon is a tool that helps you set up, run, and render liquid simulation effects. Our custom built fluid engine is based a

Ryan Guy 1.4k Dec 22, 2022
Ramp is a HID attack program that steals all connected WiFi passwords within 13 seconds.

Ramp Ramp is a HID attack program that steals all connected WiFi passwords within 13 seconds. Tested Windows 10 Warning Ramp has been created for the

Md. Ridwanul Islam Muntakim 24 Dec 24, 2022
Cobalt Strike User-Defined Reflective Loader written in Assembly & C for advanced evasion capabilities.

Cobalt Strike User-Defined Reflective Loader Cobalt Strike User-Defined Reflective Loader written in Assembly & C for advanced evasion capabilities. B

Bobby Cooke 835 Jan 3, 2023