This commit is contained in:
赵鑫 2022-12-18 00:07:31 +08:00
parent 91d471ea15
commit 9aae4d9c1e
2 changed files with 11 additions and 12 deletions

View File

@ -126,18 +126,6 @@
line(200, 50, 280, 50);
line(200, 50, 190, 60);
textInfo(`风扇`, "2022-12-17", "赵海洋爸爸", 0);
// let o = createVector(0, 0);
// let v = createVector(100, -100);
// let θ = createVector(1, 0).angleBetween(v);
// let r = v.mag();
// let x = cos(θ) * r;
// let y = sin(θ) * r;
// translate(width / 2, height / 2);
// stroke(255);
// strokeWeight(4);
// point(0, 0);
// point(x, y);
}
function keyPressed() {

View File

@ -65,3 +65,14 @@ function star(x, y, radius1, radius2, npoints) {
}
endShape(CLOSE);
}
// cartesian to polar
function cartesianToPolara(x, y) {
let v = createVector(x, y);
return { r: v.mag(), θ: createVector(1, 0).angleBetween(v) };
}
// polar to cartesian
function polarToCartesian(r, θ) {
return { x: r * cos(θ), y: r * sin(θ) };
}