Change readme. Allow toRad/deg take integers.
This commit is contained in:
parent
693002bacd
commit
43f9875df8
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue