Skip to content

Commit

Permalink
math: Add trigonometric functions and some angle helper functions
Browse files Browse the repository at this point in the history
This commit adds these new template functions in the `math` namespace:

math.Acos
math.Asin
math.Atan
math.Atan2
math.Cos
math.Pi
math.Sin
math.Tan
math.ToDegrees
math.ToRadians

Co-authored-by: Joe Mooring <[email protected]>
  • Loading branch information
raoulb and jmooring authored Jul 29, 2024
1 parent 0e00561 commit 9d2b5f9
Show file tree
Hide file tree
Showing 14 changed files with 933 additions and 54 deletions.
24 changes: 24 additions & 0 deletions docs/content/en/functions/math/Acos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: math.Acos
description: Returns the arccosine, in radians, of the given number.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/Asin
- functions/math/Atan
- functions/math/Atan2
- functions/math/Pi
- functions/math/Sin
- functions/math/Cos
- functions/math/Tan
returnType: float64
signatures: [math.Acos VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.Acos 1 }} → 0
```
24 changes: 24 additions & 0 deletions docs/content/en/functions/math/Asin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: math.Asin
description: Returns the arcsine, in radians, of the given number.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/Acos
- functions/math/Atan
- functions/math/Atan2
- functions/math/Pi
- functions/math/Sin
- functions/math/Cos
- functions/math/Tan
returnType: float64
signatures: [math.Asin VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.Asin 1 }} → 1.5707963267948966
```
24 changes: 24 additions & 0 deletions docs/content/en/functions/math/Atan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: math.Atan
description: Returns the arctangent, in radians, of the given number.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/Atan2
- functions/math/Asin
- functions/math/Acos
- functions/math/Pi
- functions/math/Sin
- functions/math/Cos
- functions/math/Tan
returnType: float64
signatures: [math.Atan VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.Atan 1 }} → 0.7853981633974483
```
24 changes: 24 additions & 0 deletions docs/content/en/functions/math/Atan2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: math.Atan2
description: Returns the arctangent, in radians, of the given number pair, determining the correct quadrant from their signs.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/Atan
- functions/math/Asin
- functions/math/Acos
- functions/math/Pi
- functions/math/Sin
- functions/math/Cos
- functions/math/Tan
returnType: float64
signatures: [math.Atan2 VALUE VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.Atan2 1 2 }} → 0.4636476090008061
```
24 changes: 24 additions & 0 deletions docs/content/en/functions/math/Cos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: math.Cos
description: Returns the cosine of the given radian number.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/Pi
- functions/math/Sin
- functions/math/Tan
- functions/math/Asin
- functions/math/Acos
- functions/math/Atan
- functions/math/Atan2
returnType: float64
signatures: [math.Cos VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.Cos 1 }} → 0.5403023058681398
```
24 changes: 24 additions & 0 deletions docs/content/en/functions/math/Pi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: math.Pi
description: Returns the mathematical constant pi.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/Sin
- functions/math/Cos
- functions/math/Tan
- functions/math/Asin
- functions/math/Acos
- functions/math/Atan
- functions/math/Atan2
returnType: float64
signatures: [math.Pi]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.Pi }} → 3.141592653589793
```
24 changes: 24 additions & 0 deletions docs/content/en/functions/math/Sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: math.Sin
description: Returns the sine of the given radian number.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/Pi
- functions/math/Cos
- functions/math/Tan
- functions/math/Asin
- functions/math/Acos
- functions/math/Atan
- functions/math/Atan2
returnType: float64
signatures: [math.Sin VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.Sin 1 }} → 0.8414709848078965
```
24 changes: 24 additions & 0 deletions docs/content/en/functions/math/Tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: math.Tan
description: Returns the tangent of the given radian number.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/Pi
- functions/math/Sin
- functions/math/Cos
- functions/math/Asin
- functions/math/Acos
- functions/math/Atan
- functions/math/Atan2
returnType: float64
signatures: [math.Tan VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.Tan 1 }} → 1.557407724654902
```
19 changes: 19 additions & 0 deletions docs/content/en/functions/math/ToDegrees.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: math.ToDegrees
description: ToDegrees converts radians into degrees.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/ToRadians
- functions/math/Pi
returnType: float64
signatures: [math.ToDegrees VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.ToDegrees 1.5707963267948966 }} → 90
```
19 changes: 19 additions & 0 deletions docs/content/en/functions/math/ToRadians.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: math.ToRadians
description: ToRadians converts degrees into radians.
categories: []
keywords: []
action:
aliases: []
related:
- functions/math/ToDegrees
- functions/math/Pi
returnType: float64
signatures: [math.ToRadians VALUE]
---

{{< new-in 0.130.0 >}}

```go-html-template
{{ math.ToRadians 90 }} → 1.5707963267948966
```
Loading

0 comments on commit 9d2b5f9

Please sign in to comment.