mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-10 12:46:39 +00:00
Add trigonometric filter operators (#6127)
* Added missing trigonometrics filter operators This PR adds support to trigonometry operators, allowing to create spider graphs and other geometric shapes with filters. * Adds the missing trigonometric filter operators This PR adds support to the missing trigonometric filter operators (cos, sin, tan, acos, asin, atan, atan2), allowing to create spider graphs, [pie charts, donut charts, polar charts](https://ffoodd.github.io/chaarts/pie-charts.html) and other geometric shapes with filters, which was previously not possible without add-ons. Example : `[[2]cos[]] = -0.4161468365471424` See also this radar chart made in wikitext by @saqimtiaz using the new trigonometric operators : https://saqimtiaz.github.io/sq-tw/temp/radar-chart-demo.html
This commit is contained in:
parent
1f2e0ed189
commit
1f6ef07860
@ -165,6 +165,35 @@ exports["standard-deviation"] = makeNumericReducingOperator(
|
||||
}
|
||||
);
|
||||
|
||||
//trigonometry
|
||||
exports.cos = makeNumericBinaryOperator(
|
||||
function(a) {return Math.cos(a)}
|
||||
);
|
||||
|
||||
exports.sin = makeNumericBinaryOperator(
|
||||
function(a) {return Math.sin(a)}
|
||||
);
|
||||
|
||||
exports.tan = makeNumericBinaryOperator(
|
||||
function(a) {return Math.tan(a)}
|
||||
);
|
||||
|
||||
exports.acos = makeNumericBinaryOperator(
|
||||
function(a) {return Math.acos(a)}
|
||||
);
|
||||
|
||||
exports.asin = makeNumericBinaryOperator(
|
||||
function(a) {return Math.asin(a)}
|
||||
);
|
||||
|
||||
exports.atan = makeNumericBinaryOperator(
|
||||
function(a) {return Math.atan(a)}
|
||||
);
|
||||
|
||||
exports.atan2 = makeNumericBinaryOperator(
|
||||
function(a) {return Math.atan2(a)}
|
||||
);
|
||||
|
||||
//Calculate the variance of a population of numbers in an array given its mean
|
||||
function getVarianceFromArray(values,mean) {
|
||||
var deviationTotal = values.reduce(function(accumulator,value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user