Chalkboard - v3.0.1
    Preparing search index...

    Function refract

    • Calculates the refraction vector of two vectors.

      Parameters

      • vect1: ChalkboardVector

        The first vector (the incident vector)

      • vect2: ChalkboardVector

        The second vector (the normal vector)

      • refractiveIndex: number

        The refractive index of the refractive medium

      Returns ChalkboardVector

      // Returns a refracted vector when light passes from air to water
      const refracted = Chalkboard.vect.refract(Chalkboard.vect.init(0, -1), Chalkboard.vect.init(0, 1), 1.33);