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: Vec2): bool {.inline, ...raises: [], tags: [], forbids: [].}
- Test overlap: point vs point. (Must be exactly equal.) Source Edit
- Test overlap: wedge vs wedge. Converts wedge to polygon first using error tolerance parameter. Source Edit
- Test overlap: circle vs wedge. When needed converts wedge to polygon using error tolerance parameter. Source Edit
- Test overlap: line vs wedge Converts wedge to polygon first using error tolerance parameter. Source Edit
- Test overlap: polygon vs wedge. Converts wedge to polygon first using error tolerance parameter. Source Edit
- Test overlap: rect vs wedge. Converts wedge to polygon first using error tolerance parameter. Source Edit
- Test overlap: segment vs wedge. Converts wedge to polygon first using error tolerance parameter. Source Edit
- Test overlap: wedge vs circle. When needed converts wedge to polygon using error tolerance parameter. Source Edit
- Test overlap: wedge vs line. Converts wedge to polygon first using error tolerance parameter. Source Edit
- Test overlap: wedge vs polygon. Converts wedge to polygon first using error tolerance parameter. Source Edit
proc overlapsTri(tri: Polygon; p: Vec2): bool {....raises: [], tags: [], forbids: [].}
- Optimization for triangles: Source Edit