link to pages https://samuelkodehode.github.io/Polar-Visualization-of-Primes/
This TypeScript project visualizes prime numbers on an HTML canvas using polar coordinates.
The application leverages polar coordinates and the Sieve of Eratosthenes algorithm to generate and visualize prime numbers. Here's a brief overview:
-
Polar to Cartesian Conversion:
- The function
polarToCartesianconverts polar coordinates (radius and angle) to Cartesian coordinates (x and y).
- The function
-
Prime Number Check:
- The
isPrimefunction checks whether a given number is prime using a basic primality check algorithm.
- The
-
Visualization on Canvas:
- The
mainfunction generates prime numbers up to the user-specified value. - Each prime number is converted to Cartesian coordinates and drawn on an HTML canvas.
- The
-
Sieve of Eratosthenes:
- The algorithm efficiently finds all prime numbers up to a given limit.
- In this project, it is used implicitly in the
isPrimefunction to count the number of primes.
-
Polar Coordinates:
- Polar coordinates represent a point in a plane by its distance from a reference point and the angle made with a reference axis.
- The
polarToCartesianfunction converts polar coordinates to Cartesian coordinates for visualization.
-
Clone the Repository:
git clone https://github.com/your-username/your-project.git
-
Navigate to Project Directory:
cd your-project -
Install Dependencies:
npm install
-
Install Prettier:
npm install --save-dev prettier
-
Run TypeScript Compiler (tsc):
- To compile TypeScript files, run:
npx tsc
- To compile TypeScript files, run:
-
Watch Mode:
- To run TypeScript Compiler in watch mode, use:
npx tsc --watch
- To run TypeScript Compiler in watch mode, use: