How to use the @mathigon/fermat.Point.interpolate function in @mathigon/fermat

To help you get started, we’ve selected a few @mathigon/fermat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mathigon / textbooks / content / sequences / components / polygons.ts View on Github external
export function polygonPoints(n: number, k: number) {
  const dots = [{x: 0, y: 0, m: 0}];

  for (let m = 1; m < k; ++m) {  // Loop over each iteration.

    // Generate the vertices of the polygon (except the first).
    const vertices = list(1, n - 1).map(i => polygonVertex(n, i, m));
    dots.push(...vertices);

    // Generate the in-between points along each edge.
    for (let a = 0; a < n - 2; ++a) {
      for (let x = 1; x < m; ++x) {
        const p = Point.interpolate(vertices[a], vertices[a + 1], x / m);
        dots.push({x: p.x, y: p.y, m});
      }
    }
  }

  return dots;
}
github mathigon / textbooks / content / graph-theory / functions.ts View on Github external
          ($v, i) => { $v.setCenter(Point.interpolate(start[i], end[i], x)); });
      $edges.forEach(($e, i) => {
github mathigon / textbooks / content / graph-theory / functions.ts View on Github external
$edges.forEach(($e, i) => {
        $e.setLine(Point.interpolate(start[i], end[i], x),
            Point.interpolate(start[(i + 1) % 4], end[(i + 1) % 4], x));
      });
    }, 400);
github mathigon / textbooks / content / graph-theory / functions.js View on Github external
      $edges.forEach(($e, i) => { $e.setLine(Point.interpolate(start[i], end[i], x),
        Point.interpolate(start[(i+1)%4], end[(i+1)%4], x)); });
    }, 400);
github mathigon / textbooks / content / graph-theory / functions.js View on Github external
$edges.forEach(($e, i) => { $e.setLine(Point.interpolate(start[i], end[i], x),
        Point.interpolate(start[(i+1)%4], end[(i+1)%4], x)); });
    }, 400);
github mathigon / textbooks / content / graph-theory / functions.js View on Github external
      $vertices.forEach(($v, i) => { $v.setCenter(Point.interpolate(start[i], end[i], x)); });
      $edges.forEach(($e, i) => { $e.setLine(Point.interpolate(start[i], end[i], x),
github mathigon / textbooks / content / graph-theory / functions.ts View on Github external
$edges.forEach(($e, i) => {
        $e.setLine(Point.interpolate(start[i], end[i], x),
            Point.interpolate(start[(i + 1) % 4], end[(i + 1) % 4], x));
      });
    }, 400);