如何在图形中转换矩阵。PointF
我需要在画布中绘制“ n”一词,但是坐标位于矩阵中,我需要乘以该值,我尝试用多边形绘制结果并保存在一系列点中。 我该怎么做?因此,我需要使用该矩阵进行其他操作并将其绘制。
float[] wordN = { 0, 0 , 0.5f, 0 , 0.5f, 6.42f , 6, 0 , 6, 8 , 5.5f, 8 , 5.5f, 1.58f, 0, 8 };
private void panelNOriginal_Paint(object sender, PaintEventArgs e){
float[,] matriz = new float[2, 8];
PointF[] prueba = new PointF[16];
int conta = 0;
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 8; j++)
{
matriz[i, j] = wordN[conta] * 15;
conta++;
prueba[i] = new PointF(wordN[i], wordN[j]);
}
}
e.Graphics.DrawPolygon(new Pen(Color.Black), prueba);
} ```
I need to draw the word "N" in a canvas, but the coordinates are in a matrix and i need to multiply that values, i try to draw the results with polygon and save in a array of points.
how can i do that? so i need to do other operations with that matrix and graph it.
float[] wordN = { 0, 0 , 0.5f, 0 , 0.5f, 6.42f , 6, 0 , 6, 8 , 5.5f, 8 , 5.5f, 1.58f, 0, 8 };
private void panelNOriginal_Paint(object sender, PaintEventArgs e){
float[,] matriz = new float[2, 8];
PointF[] prueba = new PointF[16];
int conta = 0;
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 8; j++)
{
matriz[i, j] = wordN[conta] * 15;
conta++;
prueba[i] = new PointF(wordN[i], wordN[j]);
}
}
e.Graphics.DrawPolygon(new Pen(Color.Black), prueba);
} ```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜您想做这样的事情:
假设原始数组包含X0,x1,.. y0,y1 ..的坐标。
您可以将其转换为单个循环的点列表,并在此时进行任何缩放。我不确定需要什么矩阵。
如果原始列表包含交织的坐标,则IE x0,y0,x1,y1 ...,而不是将循环更改为
i&lt; wordn.length-1; I+= 2
和y-index toi+1
。I'm guessing you want to do something like this:
Assuming the original array contain coordinates like x0, x1,.. y0, y1..
You can convert this to a list of points with a single loop and do any scaling at this point. I'm not sure what the matrix is needed for.
If the original list contains interleaved coordinates, i.e. x0, y0, x1, y1..., than change the loop to
i < wordN.Length-1; i+=2
and the y-index toi+1
.