-
Notifications
You must be signed in to change notification settings - Fork 1
Built In Functions
In the following we list all built-in functions that are supported in Hydra, in alphabetical order. A Funktion is described as function(parameter1:(Type1), parameter2:(Type2), ...).
circle(center:(Pol), radius:(Number))Draws a hyperbolic circle with the passed radius, centered at the specified polar coordinate.
var r = 10
var point = Pol(r: 7.0, phi: M_PI / 8)
circle(center: point, radius: r)clear()Removes all objects from the canvas.
cos(x:(Number))Evaluates the cosine function at the passed value.
var a = cos(x: M_PI) // a = -1cosh(x:(Number))Evaluates the hyperbolic cosine function at the passed value.
var a = cosh(x: 0) // a = 1curve_angle(from:(Pol), to:(Pol), angle:(Number)) {_p:(Pol)}Draws a curve containing the points that have an angular distance of angle to the line between the points from and to.
The parameters from and to are polar coordinates that are required to have the same angular coordinate and the radius of from must be smaller than the radius of to.
The angle parameter needs to evaluate to a number. It is the only parameter that may contain the hidden variable _p. Basically curve_angle draws the curve by walking from point from to point to, and evaluating angle at each point _p.
var R = 10.0
var start = Pol(r: R / 2.0, phi: 0.0)
var end = Pol(r: R, phi: 0.0)
curve_angle(from: start, to: end, angle: theta(r1: _p.r, r2: _p.r, R))exp(x:(Number))Evaluates the exponential function at the passed value.
var a = exp(x: 1) // a = 2.71828...line(from:(Pol), to:(Pol))Draws a hyperbolic line between the polar coordinates from and to.
var start = Pol(r: 7.0, phi: 0.0)
var end = Pol(r: 3.0, phi: M_PI / 4.0)
line(from: start, to: end)log(x:(Number))Evaluates the natural logarithm at the passed value.
var a = log(x: exp(x: 1)) // a = 1print(message:(String))Prints the passed message to the console. The message may contain new lines "\n" and is allowed to have escape sequences indicated by \( ).
var a = log(x: exp(x: 1)) // a = 1
print(message: "The natural logarithm of e is: \(a)!\n") // The natural logarithm of e is: 1!