【发布时间】:2018-08-03 08:43:40
【问题描述】:
我想从我的计算机导入的图像(圆)上从笛卡尔表示转到极坐标点,但我不知道该怎么做。
这是我已经尝试过的代码:
private double rho (double t)
{
return (po-(vrot*tp*t));
}
private double tetha (double t)
{
return vrot*2*Math.PI*t;
}
private double x (double t)
{
return rho(t) * Math.Sin(tetha(t));
}
private double y (double t)
{
return rho(t) * Math.Cos(tetha(t));
}
public void DrawLinePoint(Bitmap bmp)
{
// Create pen.
Pen blackPen = new Pen(Color.Red, 3);
// Create points that define line.
PointF[] points =
{
new PointF((float)x(1.81818182),(float)y(1.81818182)),
new PointF((float)x(3.63636364), (float)y(3.63636364)),
};
// Draw line to screen.
using(var graphics = Graphics.FromImage(bmp))
{
graphics.DrawLines(blackPen, points);
}
}
【问题讨论】:
-
您了解转换本身吗?你只是向我们展示了一些方法,而没有解释什么是行不通的。
-
我已经搜索并编辑了答案。我可以代表双点吗?谢谢
标签: c# graphics polar-coordinates cartesian-coordinates pen