Skip to content

Commit

Permalink
fix distances of sierpinsky board
Browse files Browse the repository at this point in the history
  • Loading branch information
merowin committed Jan 2, 2025
1 parent 778f308 commit a86471b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Vector2D } from "./types/Vector2D";
import { Intersection } from "./types/intersection";

export function createSierpinskyBoard(depth: number): Intersection[] {
const sideLength = Math.pow(2, depth + 1);
const radius = Math.pow(2, depth + 1) / Math.sqrt(3);

const middleIntersections = [0, 1, 2].map(
(number) =>
new Intersection(
new Vector2D(
Math.cos((Math.PI * (0.5 + 2 * number)) / 3),
Math.sin((Math.PI * (0.5 + 2 * number)) / 3),
).Multiply(sideLength / 2),
).Multiply(radius),
),
) as [Intersection, Intersection, Intersection];

Expand Down

0 comments on commit a86471b

Please sign in to comment.