@prachwal/mandelbrot-generator - v1.1.1
    Preparing search index...

    Function calculateSetBoundary

    • Calculates an approximate boundary of the Mandelbrot set within given bounds

      This function samples points in the complex plane and identifies those that lie on or near the boundary of the Mandelbrot set. Boundary points are defined as those that escape after a significant number of iterations but before the maximum.

      Parameters

      • config: MandelbrotConfig

        Fractal generation configuration defining the sampling area

      • samples: number = 1000

        Number of sample points per dimension (default: 1000)

      Returns BoundaryPoint[]

      Array of boundary points with their coordinates and iteration counts

      import { calculateSetBoundary } from './mandelbrot.js';
      import { defaultConfig } from './config.js';

      // Find boundary points in the classic view
      const boundary = calculateSetBoundary({
      ...defaultConfig,
      centerX: -0.5,
      centerY: 0,
      zoom: 1,
      maxIterations: 256
      }, 500);

      console.log(`Found ${boundary.length} boundary points`);

      // Analyze boundary complexity
      const avgIterations = boundary.reduce((sum, p) => sum + p.iterations, 0) / boundary.length;
      console.log(`Average boundary iterations: ${avgIterations}`);

      // Find most interesting boundary points
      const complex = boundary.filter(p => p.iterations > 200);
      • Time complexity: O(samples²)
      • Memory complexity: O(boundary_points)
      • Higher sample counts provide more accurate boundaries but slower computation

      Points are considered on the boundary if their iteration count is between 50% and 100% of the maximum iterations, indicating they're near the escape threshold.

      1.0.0