Types
Wedge = object pos*: Vec2 ## Position rot*: float32 ## Rotation minRadius*: float32 ## min radius, can't fire really close maxRadius*: float32 ## far radius, max range arc*: float32 ## Radians, -arc/2 is left and +arc/2 is right.
- Used in Field of View, Area of Effect, Sector Targeting and Lighting/Shadows calculations. Source Edit
Procs
proc convexHull(points: Polygon): Polygon {....raises: [], tags: [], forbids: [].}
- Monotone chain, a.k.a. Andrew's algorithmโ O(n log n) Published in 1979 by A. M. Andrew. Source Edit
proc convexHullNormal(s: Segment): Vec2 {....raises: [], tags: [], forbids: [].}
- Gets the normal of the segment returned from convexHull(). Source Edit
proc intersects(a, b: Line; at: var Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Source Edit
proc intersects(a, b: Segment; at: var Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Checks if the a segment intersects b segment. If it returns true, at will have point of intersection Source Edit
proc intersects(l: Line; s: Segment; at: var Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Checks if the line intersects the segment. If it returns true, at will have point of intersection Source Edit
proc intersects(s: Segment; l: Line; at: var Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Checks if the line intersects the segment. If it returns true, at will have point of intersection Source Edit
proc overlaps(a, b: Circle): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: circle vs circle. Source Edit
proc overlaps(a, b: Line): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: line vs line. Source Edit
proc overlaps(a, b: Rect): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: rect vs rect. Source Edit
proc overlaps(a, b: Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: point vs point. (Must be exactly equal.) Source Edit
proc overlaps(a: Circle; b: Rect): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: circle vs rectangle. Source Edit
proc overlaps(a: Circle; b: Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: circle vs point. Source Edit
proc overlaps(a: Polygon; b: Polygon): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: polygon vs polygon. Source Edit
proc overlaps(a: Rect; b: Circle): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: rect vs circle. Source Edit
proc overlaps(a: Rect; b: Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: rect vs point. Source Edit
proc overlaps(a: Segment; b: Vec2; fudge = 0.1): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: segment vs point. Source Edit
proc overlaps(a: Vec2; b: Circle): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: point vs circle. Source Edit
proc overlaps(a: Vec2; b: Rect): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: point vs rectangle. Source Edit
proc overlaps(a: Vec2; s: Segment; fudge = 0.1): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: point vs segment. Source Edit
proc overlaps(a: Wedge; b: Wedge; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: wedge vs wedge. Converts wedge to polygon first using error tolerance parameter. Source Edit
proc overlaps(c: Circle; l: Line): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: circle vs line. Source Edit
proc overlaps(c: Circle; poly: Polygon): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: circle vs polygon. Source Edit
proc overlaps(c: Circle; s: Segment): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: circle vs segment. Source Edit
proc overlaps(c: Circle; w: Wedge; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: circle vs wedge. When needed converts wedge to polygon using error tolerance parameter. Source Edit
proc overlaps(d, s: Segment): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: segment vs segment. Source Edit
proc overlaps(l: Line; c: Circle): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: circle vs line. Source Edit
proc overlaps(l: Line; p: Polygon): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: line vs rect. Source Edit
proc overlaps(l: Line; p: Vec2; fudge = 0.1): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: line vs point. Source Edit
proc overlaps(l: Line; r: Rect): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: line vs rect. Source Edit
proc overlaps(l: Line; s: Segment): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: line vs segment. Source Edit
proc overlaps(l: Line; w: Wedge; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: line vs wedge Converts wedge to polygon first using error tolerance parameter. Source Edit
proc overlaps(p: Polygon; l: Line): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: rect vs line. Source Edit
proc overlaps(p: Polygon; w: Wedge; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: polygon vs wedge. Converts wedge to polygon first using error tolerance parameter. Source Edit
proc overlaps(p: Vec2; l: Line; fudge = 0.1): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: point vs line. Source Edit
proc overlaps(p: Vec2; poly: Polygon): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: point vs polygon. Source Edit
proc overlaps(p: Vec2; w: Wedge): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: point vs wedge. Source Edit
proc overlaps(poly: Polygon; c: Circle): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: polygon vs circle. Source Edit
proc overlaps(poly: Polygon; p: Vec2): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: polygon vs point. Source Edit
proc overlaps(poly: Polygon; r: Rect): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: polygon vs rect. Source Edit
proc overlaps(poly: Polygon; s: Segment): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: polygon vs segment. Source Edit
proc overlaps(r: Rect; l: Line): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: rect vs line. Source Edit
proc overlaps(r: Rect; poly: Polygon): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: rect vs polygon. Source Edit
proc overlaps(r: Rect; s: Segment): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: rectangle vs segment. Source Edit
proc overlaps(r: Rect; w: Wedge; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: rect vs wedge. Converts wedge to polygon first using error tolerance parameter. Source Edit
proc overlaps(s: Segment; c: Circle): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: circle vs segment. Source Edit
proc overlaps(s: Segment; l: Line): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: segment vs line. Source Edit
proc overlaps(s: Segment; poly: Polygon): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: segment vs polygon. Source Edit
proc overlaps(s: Segment; r: Rect): bool {....raises: [], tags: [], forbids: [].}
- Test overlap: segments vs rectangle. Source Edit
proc overlaps(s: Segment; w: Wedge; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: segment vs wedge. Converts wedge to polygon first using error tolerance parameter. Source Edit
proc overlaps(w: Wedge; c: Circle; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: wedge vs circle. When needed converts wedge to polygon using error tolerance parameter. Source Edit
proc overlaps(w: Wedge; l: Line; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: wedge vs line. Converts wedge to polygon first using error tolerance parameter. Source Edit
proc overlaps(w: Wedge; p: Polygon; error = 0.5): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: wedge vs polygon. Converts wedge to polygon first using error tolerance parameter. Source Edit
proc overlaps(w: Wedge; p: Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: wedge vs point. Source Edit
proc overlapsTri(tri: Polygon; p: Vec2): bool {....raises: [], tags: [], forbids: [].}
- Optimization for triangles: Source Edit