1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 22:52:29 +08:00

feat: add AngleToRadian and RadianToAngle

This commit is contained in:
dudaodong
2023-03-23 17:41:31 +08:00
parent f09e521783
commit c28803b25e
3 changed files with 75 additions and 3 deletions

View File

@@ -1,6 +1,9 @@
package mathutil
import "fmt"
import (
"fmt"
"math"
)
func ExampleExponent() {
result1 := Exponent(10, 0)
@@ -221,3 +224,33 @@ func ExampleRangeWithStep() {
// [-4 -2 0]
// [1 2.1 3.2]
}
func ExampleAngleToRadian() {
result1 := AngleToRadian(45)
result2 := AngleToRadian(90)
result3 := AngleToRadian(180)
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
// Output:
// 0.7853981633974483
// 1.5707963267948966
// 3.141592653589793
}
func ExampleRadianToAngle() {
result1 := RadianToAngle(math.Pi)
result2 := RadianToAngle(math.Pi / 2)
result3 := RadianToAngle(math.Pi / 4)
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
// Output:
// 180
// 90
// 45
}