コード例 #1
0
ファイル: DrawForm.cs プロジェクト: LilyNovikova/CompGraphics
        private void DrawGrid(Rectangle rect, Graphics g)
        {
            if (startSurfaceGrid.Count == 0)
            {
                surface = new BezierSurface();
                surface.SetPoints(startPoints);
                startSurfaceGrid  = surface.GetSurfaceGridPoints(tolerance, rows, columns);
                surfaceGridPoints = null;
                startSurfaceCells.Clear();
                surfaceCells = null;
            }
            var drawGridPoints = Point3Utils.GetObjectProjection(surfaceGridPoints ?? startSurfaceGrid, rect.Width, rect.Height);

            g.DrawGrid(Pens.Black, drawGridPoints);
        }
コード例 #2
0
ファイル: DrawForm.cs プロジェクト: LilyNovikova/CompGraphics
        private void Canvas_Paint(object sender, PaintEventArgs e)
        {
            var rect = new Rectangle(Canvas.Location.X, Canvas.Location.Y, Canvas.Size.Width, Canvas.Size.Height);

            DrawXYZAxes(e.Graphics, rect);
            var basePointsArray = points.Select(row => row.Select(point => point.GetDrawingPoint(rect.Width, rect.Height)).ToArray()).ToArray();

            e.Graphics.DrawPoints(Brushes.Black, basePointsArray, pointRadius);

            if (startSurfaceGrid.Count == 0)
            {
                surface = new BezierSurface();
                surface.SetPoints(startPoints);
                startSurfaceGrid  = surface.GetSurfaceGridPoints(tolerance, rows, columns);
                surfaceGridPoints = null;
            }
            var drawPoints = Point3Utils.GetObjectProjection(surfaceGridPoints ?? startSurfaceGrid, rect.Width, rect.Height);

            e.Graphics.DrawGrid(Pens.Red, drawPoints);
        }