Skip to content

Trigonometry

Arthur Guiot edited this page Sep 8, 2018 · 3 revisions

Trigonometry Functions

I won't go and describe each function because there are too much of them, but here is the Wikipedia article.

Here is how they work:

t.[func](x) // y (replace [func] and x)

List of all functions:

  • acos
  • acosh
  • asin
  • asinh
  • atan
  • atan2
  • atanh
  • acos
  • acosh
  • cos
  • cosh
  • sin
  • sinh
  • tan
  • tanh

Complex support

The following functions will accept and return complex numbers:

  • cos
  • sin
  • tan
  • cosh
  • sinh
  • tanh

Angle to Vector

You can transform any angle to a vector using t.angle2Vec:

t.angle2Vec(1) // [ 0.5403023058681398, 0.8414709848078965 ]

Degree to Radian

TheoremJS uses radian, so to convert degrees to them, you'll need to do this:

t.deg2rad(90) // pi / 2 => BigNumber

You can also to the opposite:

t.rad2deg(t.pi().div(2)) // 90 => BigNumber

Draw points around a circle

If you want to draw points around a circle (it might be helpful with Descartes), you can use that:

t.drawCircularPoints(n, r=1, start=[-r, 0]) // where n is the number of points, r the radius, and start the interval