# Points and Lines

The very basics of geometry needs, for two and three-dimensional space.

# Boxes and detection collision

Boxes module introduces Bounding boxes for Points and Lines and services to detect collision or inclusion between boxes. It means a simple and fast way to test collision but not really accurate since it uses bounding boxes.

A QuadTree is a tree data structure in which each internal node has exactly four children They're most often used to partition two-dimensional space by recursively subdividing it into four quadrants or regions.

• They decompose space into adaptable cells
• Each cell has a maximum capacity. When maximum is reached, the cell splits.

Quadtrees are using Boxed objects to determine their distribution in the 2D space.

This API provides two different types of Quadtree : Static and Dynamic (respectively `SQuadTree` and `DQuadTree`).

• Static: When you create the QuadTree, you need to specify the region that it will cover

• Dynamic: You just need to fill the quadtree with objects, and when the threshold is reached, it will automatically divide the current region, depending on the distribution of objects already in the region.

# Polygons

Some basic polygon services.

This module contains interesting algorithms for `ConvexPolygon`only at the moment. A Convex polygon can be defined as follow :

• All its interior angles are less than 180°. this means that all the vertices of the polygon will point outwards, away from the interior of the shape.

• Every point on every line segment between two points inside or on the boundary of the polygon remains inside or on the boundary.

• The polygon is entirely contained in a closed half-plane defined by each of its edges.

• For each edge, the interior points are all on the same side of the line that the edge defines.

• The angle at each vertex contains all other vertices in its edges and interior.

A polygon which is not convex is called concave. Convex polygon are used because most geometric problems are simpler and faster on convex objects than on non-convex ones.

Services provided :

• Point in convex polygon
• Intersection of convex polygon
• Convex hull of a set of points
• Triangulation of polygon

## All groups and modules

##### module angles

geometry :: angles

Angle related service using `Float` to represent an angle in radians
##### module boxes

geometry :: boxes

Provides interfaces and classes to represent basic geometry needs.
##### module geometry

geometry :: geometry

Provides interfaces and classes to represent basic geometry needs.
##### module points_and_lines

geometry :: points_and_lines

Interfaces and classes to represent basic geometry needs.
##### module polygon

geometry :: polygon

Convex Polygons manipulations

QuadTree API mostly used for 2 dimensional collision detection

### Ancestors

##### package core

core

Nit common library of core classes and methods
##### package json

json

read and write JSON formatted text
##### package meta

meta

Simple user-defined meta-level to manipulate types of instances as object.
##### package parser_base

parser_base

Simple base for hand-made parsers of all kinds
##### package poset

poset

Pre order sets and partial order set (ie hierarchies)

### Parents

##### package pipeline

pipeline

Pipelined filters and operations on iterators.
##### package serialization

serialization

Abstract serialization services

### Children

##### package gamnit

gamnit

Portable game and multimedia framework for Nit

### Descendants

##### package android

android

Android platform support and APIs
##### package app

app

app.nit, a framework for portable applications
##### package egl

egl

Interface between rendering APIs (OpenGL, OpenGL ES, etc.) and the native windowing system.
##### package glesv2

glesv2

OpenGL graphics rendering library for embedded systems, version 2.0
##### package ios

ios

iOS support for app.nit
##### package linux

linux

Implementation of app.nit for the Linux platform