, Visual C#


         

, MatrixApplyFull.


// :
Lines[NumLines].Initialize();
Lines[NumLines].fr_points[1] = x1;
Lines[NumLines].fr_points[2] = y1;
Lines[NumLines].fr_points[3] = z1;
Lines[NumLines].fr_points[4] = 1;
Lines[NumLines].to_points[1] = x2;
Lines[NumLines].to_points[2] = y2;
Lines[NumLines].to_points[3] = z2;
Lines[NumLines].to_points[4] = 1;
}
// (translation matrix)
// , MatrixApplyFull.
// 0, 0, 0, 1 :
public void TransformAllDataFull(ref float[,] M)
{
TransformDataFull(ref M, 1, NumLines);
}
// (translation matrix)
// , MatrixApplyFull.
// 0, 0, 0, 1 :
public void TransformDataFull(ref float[,] M,
int line1, int line2)
{
for (int i = line1; i <= line2; i++)
{
MatrixApplyFull(ref Lines[i].fr_points, ref M,
ref Lines[i].fr_tr_points);
MatrixApplyFull(ref Lines[i].to_points, ref M,
ref Lines[i].to_tr_points);
}
}
// :
public void DrawSolid(Bitmap bmp,
int first_line, int last_line, Color color, bool clear)
{
float x1, y1, x2, y2;
Graphics g; Pen pen;
// , , 2
//( Designing):
pen = new Pen(color, 2);
// g bmp:
g = Graphics.FromImage(bmp);
if (clear) g.Clear(System.Drawing.Color.Black);
// :
for (int i = first_line; i <= last_line; i++)
{
x1 = Lines[i].fr_tr_points[1];
y1 = Lines[i].fr_tr_points[2];
x2 = Lines[i].to_tr_points[1];
y2 = Lines[i].to_tr_points[2];
// :
g.DrawLine(pen,
(x1 * bmp.Width / 4) + bmp.Width / 2.0F,
bmp.Height / 2.0F - (y1 * bmp.Height / 4),