Intro

Nordcraft Math

A package of useful Math formulas. Nordcraft has some basic math built in to carry most standard web apps. However, if your app requires work with vectors, such as dot products or projections, then this package should give you all the utility you need. 

Formulas (more to come)

  • Sin

    Returns the sine of a number in radians

    Arguments

    nA number representing an angle in radians.
  • Cos

    Returns the cosine of a number in radians

    Arguments

    nA number representing an angle in radians.
  • Pi

    Represents the ratio of the circumference of a circle to its diameter, approximately 3.14159

  • Dot

    Returns the dot product of two same-length numeric arrays of any dimension.

    Arguments

    aAn array of numbers representing a vector in any dimension.
    bAn array of numbers representing a vector in any dimension.
  • Project

    Projects vector a onto vector b. It’s like casting a shadow of a onto the line defined by b, assuming light comes from above, perpendicular to b.

    Arguments

    aAn array of numbers representing the vector to project from.
    bAn array of numbers representing the vector to project onto.
  • VectorFromAngle

    Result is always a unit vector (length = 1)

    Arguments

    degreesAngle is measured counter-clockwise from the positive X-axis (standard math convention)