src/bumpy

Search:
Group by:
Source   Edit  

Types

Circle = object
  pos*: Vec2
  radius*: float32
Source   Edit  
Line = object
  a*: Vec2
  b*: Vec2
Source   Edit  
Polygon = seq[Vec2]
Source   Edit  
Rect = object
  x*: float32
  y*: float32
  w*: float32
  h*: float32
Source   Edit  
Segment = object
  at*: Vec2
  to*: Vec2
Source   Edit  
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 `$`(a: Rect): string {....raises: [], tags: [], forbids: [].}
Source   Edit  
proc `*`(m: Mat3; s: Segment): Segment {.inline, ...raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc `*`(r: Rect; v: float): Rect {....raises: [], tags: [], forbids: [].}
  • all elements of a Rect.
Source   Edit  
proc `+`(a, b: Rect): Rect {....raises: [], tags: [], forbids: [].}
Add two boxes together. Source   Edit  
proc `+=`(s: var Segment; v: Vec2) {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc `/`(r: Rect; v: float): Rect {....raises: [], tags: [], forbids: [].}
/ all elements of a Rect. Source   Edit  
proc `and`(a, b: Rect): Rect {....raises: [], tags: [], forbids: [].}
Intersection of two rectangles. Source   Edit  
proc circle(pos: Vec2; radius: float32): Circle {.inline, ...raises: [], tags: [],
    forbids: [].}
Source   Edit  
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 length(s: Segment): float32 {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc line(a, b: Vec2): Line {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc `or`(a, b: Rect): Rect {....raises: [], tags: [], forbids: [].}
Union of two rectangles. 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 overlaps(w: Wedge; r: Rect; error = 0.5): bool {.inline, ...raises: [],
    tags: [], forbids: [].}
Test overlap: wedge vs rect. Converts wedge to polygon first using error tolerance parameter. Source   Edit  
proc overlaps(w: Wedge; s: Segment; error = 0.5): bool {.inline, ...raises: [],
    tags: [], forbids: [].}
Test overlap: wedge vs segment. 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  
proc polygon(wedge: Wedge; error: float32 = 0.5): Polygon {....raises: [],
    tags: [], forbids: [].}
Approximates a wedge shape with a Polygon Source   Edit  
proc rect(pos, size: Vec2): Rect {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc rect(x, y, w, h: float32): Rect {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc segment(at, to: Vec2): Segment {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc wh(rect: Rect): Vec2 {.inline, ...raises: [], tags: [], forbids: [].}
Gets the wh as a Vec2. Source   Edit  
proc wh=(rect: var Rect; v: Vec2) {.inline, ...raises: [], tags: [], forbids: [].}
Sets the wh from Vec2. Source   Edit  
proc xy(rect: Rect): Vec2 {.inline, ...raises: [], tags: [], forbids: [].}
Gets the xy as a Vec2. Source   Edit  
proc xy=(rect: var Rect; v: Vec2) {.inline, ...raises: [], tags: [], forbids: [].}
Sets the xy from Vec2. Source   Edit  

Iterators

iterator segments(poly: Polygon): Segment {....raises: [], tags: [], forbids: [].}
Return elements in pairs: (1st, 2nd), (2nd, 3rd) ... (last, 1st). Source   Edit