Change readme. Allow toRad/deg take integers.

This commit is contained in:
treeform 2021-05-29 11:24:48 -07:00
parent 693002bacd
commit 43f9875df8
3 changed files with 56 additions and 2689 deletions

2729
README.md

File diff suppressed because it is too large Load diff

View file

@ -418,11 +418,19 @@ proc turnAngle*[T: SomeFloat](a, b, speed: T): T =
proc toRadians*[T: SomeFloat](deg: T): T =
## Convert degrees to radians.
return PI * deg / 180.0
PI * deg / 180.0
proc toDegrees*[T: SomeFloat](rad: T): T =
## Convert radians to degrees.
return fixAngle(180.0 * rad / PI)
fixAngle(180.0 * rad / PI)
proc toRadians*(deg: SomeInteger): float32 =
## Convert degrees to radians.
deg.float32.toRadians
proc toDegrees*(deg: SomeInteger): float32 =
## Convert degrees to radians.
deg.float32.toDegrees
proc isNaN*(x: float32): bool =
## Returns true if number is a NaN.

View file

@ -753,4 +753,8 @@ block:
q = fromTwoVectors(a, b)
doAssert q.mat4 * a ~= b
block:
let mat2d = translate(vec2(10, 20)) * rotate(45.toRadians) * scale(vec2(2))
let mat3d = translate(vec3(10, 20, 0)) * rotateZ(45.toRadians) * scale(vec3(2))
echo "test finished successfully"