Skip to main content

Geometry

import { angle2D, distance2D, midpoint2D } from '@rtorcato/js-common/geometry'

Exports

NameSummary
angle2DCalculates the angle (in radians) between two points in 2D space.
distance2DCalculates the distance between two points in 2D space.
midpoint2DCalculates the midpoint between two points in 2D space.
pointInRectChecks if a point is inside a rectangle.
polygonAreaCalculates the area of a polygon given its vertices (Shoelace formula).
rectsOverlapChecks if two rectangles overlap.