-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Showing
14 changed files
with
933 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
Oops, something went wrong.