Add Cartesian to Polar demo

This commit is contained in:
Lev
2021-07-15 23:41:26 -05:00
parent 2b733f856b
commit c319d1e29d
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="p5.min.js"></script>
<script src="sketch.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,21 @@
function setup()
{
createCanvas(500, 500);
background(0);
}
function draw()
{
background(0);
translate(width/2, height/2);
for (let angle=0; angle < TWO_PI; angle += 0.1)
{
let r = 100;
let x = r * cos(angle);
let y = r * sin(angle);
stroke(255);
strokeWeight(4);
point(x, y);
}
}