summaryrefslogtreecommitdiff
path: root/platform/darwin/src
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-04-17 16:10:17 -0400
committerFabian Guerra <fabian.guerra@mapbox.com>2018-04-17 16:10:17 -0400
commitd830d6dacc428bf4779633b4aa65c6fb2bad577a (patch)
treec531f0d6d9858128aa07ab07b0d0ee3c43bc3555 /platform/darwin/src
parent5e0c4af7b25c1dd1e008b706e8a8ce1b84f09c02 (diff)
downloadqtlocation-mapboxgl-d830d6dacc428bf4779633b4aa65c6fb2bad577a.tar.gz
[ios, macos] Add sine NSExpresssion operator.
Diffstat (limited to 'platform/darwin/src')
-rw-r--r--platform/darwin/src/NSExpression+MGLAdditions.mm10
1 files changed, 10 insertions, 0 deletions
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm
index aa01fd6126..8c79fd43f8 100644
--- a/platform/darwin/src/NSExpression+MGLAdditions.mm
+++ b/platform/darwin/src/NSExpression+MGLAdditions.mm
@@ -71,6 +71,7 @@ const MGLExpressionInterpolationMode MGLExpressionInterpolationModeCubicBezier =
INSTALL_METHOD(mgl_acos:);
INSTALL_METHOD(mgl_cos:);
INSTALL_METHOD(mgl_asin:);
+ INSTALL_METHOD(mgl_sin:);
INSTALL_METHOD(mgl_atan:);
// Install functions that resemble control structures, taking arbitrary
@@ -123,6 +124,13 @@ const MGLExpressionInterpolationMode MGLExpressionInterpolationModeCubicBezier =
}
/**
+ Computes the principal value of the sine.
+ */
+- (NSNumber *)mgl_sin:(NSNumber *)number {
+ return @(sin(number.doubleValue));
+}
+
+/**
Computes the principal value of the inverse tangent.
*/
- (NSNumber *)mgl_atan:(NSNumber *)number {
@@ -710,6 +718,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) {
@"acos" : @"mgl_acos:",
@"cos" : @"mgl_cos:",
@"asin" : @"mgl_asin:",
+ @"sin" : @"mgl_sin:",
@"atan" : @"mgl_atan:",
@"floor": @"floor:",
@"ceil": @"ceiling:",
@@ -956,6 +965,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) {
@"mgl_acos:" : @"acos",
@"mgl_cos:" : @"cos",
@"mgl_asin:" : @"asin",
+ @"mgl_sin:" : @"sin",
@"mgl_atan:" : @"atan",
// Vararg aftermarket expressions need to be declared with an explicit and implicit first argument.
@"MGL_LET": @"let",