mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge pull request #2496 from AquaGeneral/master
linalg/extended radians and degrees fixed
This commit is contained in:
@@ -3,20 +3,21 @@ package linalg
|
|||||||
import "core:builtin"
|
import "core:builtin"
|
||||||
import "core:math"
|
import "core:math"
|
||||||
|
|
||||||
radians :: proc(degrees: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) {
|
to_radians :: proc(degrees: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) {
|
||||||
when IS_ARRAY(T) {
|
when IS_ARRAY(T) {
|
||||||
for i in 0..<len(T) {
|
for i in 0..<len(T) {
|
||||||
out[i] = degrees * RAD_PER_DEG
|
out[i] = degrees[i] * RAD_PER_DEG
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out = degrees * RAD_PER_DEG
|
out = degrees * RAD_PER_DEG
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
degrees :: proc(radians: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) {
|
|
||||||
|
to_degrees :: proc(radians: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) {
|
||||||
when IS_ARRAY(T) {
|
when IS_ARRAY(T) {
|
||||||
for i in 0..<len(T) {
|
for i in 0..<len(T) {
|
||||||
out[i] = radians * DEG_PER_RAD
|
out[i] = radians[i] * DEG_PER_RAD
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out = radians * DEG_PER_RAD
|
out = radians * DEG_PER_RAD
|
||||||
|
|||||||
Reference in New Issue
Block a user