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);
} ```
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
.