我很难用方程的偏移C绘制出一朵极地玫瑰
r(theta) = cos(k*theta) + C.我试图绘制这朵极玫瑰花:
polar.gif
极坐标方程可以是:
R(θ)= cos(k *θ)
或
R(θ)= sin(k * theta)
我想画的极地玫瑰的方程式是:
R(θ)=2+ sin(6 *θ)
好的,参数方程是:
X=C+ sin(k * theta) *cos(θ)
Y=C+ sin(k * theta) *sin(θ)
在我的画布(绘画区),我的来源不是在屏幕的中心,所以我需要翻译玫瑰到它。好吧没什么大不了的。另一点是,我需要缩放玫瑰,以使它可见,否则它会太小,但仍然没有问题,这解释了: 100*。这是我的代码,它在C++上,顺便说一句:
for ( float t = 0; t < PI_2; t+= 0.01 )
{
r = Origin.get_x() + 100*(2+(sin(6*t) * cos(t)));
h = Origin.get_y() + 100*(2+(sin(6*t) * sin(t)));
point(r,h);
}我知道我做错了,因为当我添加+2 (应该是C常量)时,它不是我想要的工作方式,它只是翻译了更多,画了一个没有偏移量的极性玫瑰。我如何防止“额外的翻译”并正确地绘制它?
发布于 2015-04-12 05:08:58
x = r cos(theta),y = r sin(theta),所以你的参数方程应该是x(theta) = C * cos(theta) + sin(k*theta) * cos(theta)和y(theta) = C * sin(theta) + sin(k*theta) * sin(theta)。你只是忘了把C分别乘以cos(theta)和sin(theta)。
https://stackoverflow.com/questions/29586140
复制相似问题