Skip to content

Commit 5e390b9

Browse files
authored
Merge pull request #32 from guzba/master
bumpy
2 parents 8c3b30d + 120ad0a commit 5e390b9

5 files changed

Lines changed: 4 additions & 26 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ nimcache
99
*.pdb
1010
*.ilk
1111
.*
12+
*.dll

pixie.nimble

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ requires "chroma >= 0.1.5"
1111
requires "zippy >= 0.3.5"
1212
requires "flatty >= 0.1.2"
1313
requires "nimsimd >= 0.4.6"
14+
requires "bumpy >= 0.1.0"

src/pixie/common.nim

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,6 @@ import vmath
33
type
44
PixieError* = object of ValueError ## Raised if an operation fails.
55

6-
Segment* = object
7-
## A math segment from point "at" to point "to"
8-
at*: Vec2
9-
to*: Vec2
10-
11-
proc segment*(at, to: Vec2): Segment {.inline.} =
12-
result.at = at
13-
result.to = to
14-
15-
proc intersects*(a, b: Segment, at: var Vec2): bool {.inline.} =
16-
## Checks if the a segment intersects b segment.
17-
## If it returns true, at will have point of intersection
18-
let
19-
s1 = a.to - a.at
20-
s2 = b.to - b.at
21-
denominator = (-s2.x * s1.y + s1.x * s2.y)
22-
s = (-s1.y * (a.at.x - b.at.x) + s1.x * (a.at.y - b.at.y)) / denominator
23-
t = (s2.x * (a.at.y - b.at.y) - s2.y * (a.at.x - b.at.x)) / denominator
24-
25-
if s >= 0 and s < 1 and t >= 0 and t < 1:
26-
at = a.at + (t * s1)
27-
return true
28-
return false
29-
306
proc fractional*(v: float32): float32 {.inline.} =
317
## Returns unsigned fraction part of the float.
328
## -13.7868723 -> 0.7868723

src/pixie/images.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chroma, blends, vmath, common, nimsimd/sse2
1+
import chroma, blends, bumpy, vmath, common, nimsimd/sse2
22

33
const h = 0.5.float32
44

src/pixie/paths.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import vmath, images, chroma, strutils, algorithm, common
1+
import vmath, images, chroma, strutils, algorithm, common, bumpy
22

33
type
44

0 commit comments

Comments
 (0)