mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 14:10:31 +03:00
math: Add trigonometric functions and some angle helper functions
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 <joe@mooring.com>
This commit is contained in:
parent
0e00561620
commit
9d2b5f98d0
14 changed files with 933 additions and 54 deletions
24
docs/content/en/functions/math/Acos.md
Normal file
24
docs/content/en/functions/math/Acos.md
Normal file
|
@ -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
docs/content/en/functions/math/Asin.md
Normal file
24
docs/content/en/functions/math/Asin.md
Normal file
|
@ -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
docs/content/en/functions/math/Atan.md
Normal file
24
docs/content/en/functions/math/Atan.md
Normal file
|
@ -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
docs/content/en/functions/math/Atan2.md
Normal file
24
docs/content/en/functions/math/Atan2.md
Normal file
|
@ -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
docs/content/en/functions/math/Cos.md
Normal file
24
docs/content/en/functions/math/Cos.md
Normal file
|
@ -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
docs/content/en/functions/math/Pi.md
Normal file
24
docs/content/en/functions/math/Pi.md
Normal file
|
@ -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
docs/content/en/functions/math/Sin.md
Normal file
24
docs/content/en/functions/math/Sin.md
Normal file
|
@ -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
docs/content/en/functions/math/Tan.md
Normal file
24
docs/content/en/functions/math/Tan.md
Normal file
|
@ -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
docs/content/en/functions/math/ToDegrees.md
Normal file
19
docs/content/en/functions/math/ToDegrees.md
Normal file
|
@ -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
docs/content/en/functions/math/ToRadians.md
Normal file
19
docs/content/en/functions/math/ToRadians.md
Normal file
|
@ -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…
Add table
Add a link
Reference in a new issue