我试图使用适当的x = cos(theta),y = sin(theta)函数绘制圆的下半部分.如果我将theta从Math.PI迭代到2*Math.PI,我似乎得到了圆圈的上半部分:

我在这段代码中做错了什么:
window.onload = function()
{
var canvas = document.getElementById('circle-canvas');
if (canvas && canvas.getContext) {
var context = canvas.getContext('2d');
if (context) {
context.strokeStyle = "#369";
context.lineWidth = 4;
j = canvas.width / 2;
k = canvas.height / 2;
r = canvas.width / 4;
function computeX(theta, r, j, k){ return r * Math.cos(theta) + j; }
function computeY(theta, r, j, k){ return r * Math.sin(theta) + k; }
start = Math.PI;
context.lineTo(computeX(start, r, j, k), computeY(start, r, …Run Code Online (Sandbox Code Playgroud)