Java Reference
In-Depth Information
x[i] = (int) (w / 2 + r * Math.cos(theta));
y[i] = (int) (h / 2 - r * Math.sin(theta));
}
g.drawPolyline(x, y, nPoint);
}
}
Defining
x
and
y
functions in terms of t lets you divide the tasks of determining
x
values and
y
values. This is often simpler than defining
y
in terms of
x
and often
facilitates the mapping of
x
and
y
onto a
Graphics
object's coordinates. Parametric
equations also simplify the plotting of curves where
y
is not a single-valued function
of
x.