Esempio n. 1
0
        public Point GetPointDerivativeV(double u, double v)
        {
            double[] coord = GetPatchNumber(u, v);
            var      pointsToDrawSinglePatch = Copy4x4PieceOfPointsCollecionTransposed(3 * (int)coord[0], 3 * (int)coord[1]);

            return(MatrixProvider.Multiply(CalculateB(coord[2]), pointsToDrawSinglePatch, CalculateDerrivativeB(coord[3])));
        }
Esempio n. 2
0
        public void CalculateCurvesPatchPoints()
        { //TODO: Przerobić
            Point[,] _pointsToDrawSinglePatch = new Point[4, 4];

            if (PatchesAreCylinder)
            {
                //_curvesPatchPoints = new Point[1 + (_u - 1) * VerticalPatches, 1 + (_v - 1) * (HorizontalPatches + 3)];
                //int ii = 0;
                //int jj = 0;

                //for (ii = 0; ii < VerticalPatches; ii++)
                //{
                //    for (jj = 0; jj < HorizontalPatches + 3; jj++)
                //    {

                //        _pointsToDrawSinglePatch = Copy4x4PieceOfPointsCollecion(3 * ii, 3 * jj);
                //        for (int i = 0; i < U.Length; i++)
                //        {
                //            for (int j = 0; j < V.Length; j++)
                //            {
                //                _curvesPatchPoints[(_u - 1) * ii + i, (_v - 1) * jj + j] = MatrixProvider.Multiply(CalculateB(U[i]), _pointsToDrawSinglePatch, CalculateB(V[j]));
                //            }
                //        }


                //    }
                //}
                _curvesPatchPoints  = new Point[1 + (_u - 1) * VerticalPatches, 1 + (_v * multiplier - 1) * (HorizontalPatches + 3)];
                _curvesPatchPoints1 = new Point[(1 + (_u * multiplier - 1) * VerticalPatches), 1 + (_v - 1) * (HorizontalPatches + 3)];


                for (int ii = 0; ii < VerticalPatches; ii++)
                {
                    for (int jj = 0; jj < HorizontalPatches + 3; jj++)
                    {
                        _pointsToDrawSinglePatch = Copy4x4PieceOfPointsCollecion(3 * ii, 3 * jj);
                        for (int i = 0; i < U.Length; i++)
                        {
                            for (int j = 0; j < VCurve.Length; j++)
                            {
                                _curvesPatchPoints[(_u - 1) * ii + i, (_v * multiplier - 1) * jj + j] = MatrixProvider.Multiply(CalculateB(U[i]), _pointsToDrawSinglePatch, CalculateB(VCurve[j]));
                            }
                        }


                        for (int i = 0; i < UCurve.Length; i++)
                        {
                            for (int j = 0; j < V.Length; j++)
                            {
                                _curvesPatchPoints1[(_u * multiplier - 1) * ii + i, (_v - 1) * jj + j] = MatrixProvider.Multiply(CalculateB(UCurve[i]), _pointsToDrawSinglePatch, CalculateB(V[j]));
                            }
                        }
                    }
                }
            }

            else
            {
                _curvesPatchPoints  = new Point[1 + (_u - 1) * VerticalPatches, (1 + (_v * multiplier - 1) * HorizontalPatches)];
                _curvesPatchPoints1 = new Point[(1 + (_u * multiplier - 1) * VerticalPatches), (1 + (_v - 1) * HorizontalPatches)];


                for (int ii = 0; ii < VerticalPatches; ii++)
                {
                    for (int jj = 0; jj < HorizontalPatches; jj++)
                    {
                        _pointsToDrawSinglePatch = Copy4x4PieceOfPointsCollecion(3 * ii, 3 * jj);
                        for (int i = 0; i < U.Length; i++)
                        {
                            for (int j = 0; j < VCurve.Length; j++)
                            {
                                _curvesPatchPoints[(_u - 1) * ii + i, (_v * multiplier - 1) * jj + j] = MatrixProvider.Multiply(CalculateB(U[i]), _pointsToDrawSinglePatch, CalculateB(VCurve[j]));
                            }
                        }


                        for (int i = 0; i < UCurve.Length; i++)
                        {
                            for (int j = 0; j < V.Length; j++)
                            {
                                _curvesPatchPoints1[(_u * multiplier - 1) * ii + i, (_v - 1) * jj + j] = MatrixProvider.Multiply(CalculateB(UCurve[i]), _pointsToDrawSinglePatch, CalculateB(V[j]));
                            }
                        }
                    }
                }
            }
            // GL.End();
        }
Esempio n. 3
0
 public Point GetPointDerrivativeV(double u, double v)
 {
     Point[,] bezierPatch1 = Transpose(PatchPoints);
     return(MatrixProvider.Multiply(CalculateB(u), bezierPatch1, CalculateDerrivativeB(v)));
 }
Esempio n. 4
0
        public void CalculateCurvesPatchPoints()
        {
            int       multiplier        = multiplierU;
            const int VerticalPatches   = 1;
            const int HorizontalPatches = 1;

            Point[,] _pointsToDrawSinglePatch = PatchPoints;

            _curvesPatchPoints  = new Point[1 + (_u - 1) * VerticalPatches, (1 + (_v * multiplier - 1) * HorizontalPatches)];
            _curvesPatchPoints1 = new Point[(1 + (_u * multiplier - 1) * VerticalPatches), (1 + (_v - 1) * HorizontalPatches)];


            for (int ii = 0; ii < VerticalPatches; ii++)
            {
                for (int jj = 0; jj < HorizontalPatches; jj++)
                {
                    //_pointsToDrawSinglePatch = PatchPoints;
                    for (int i = 0; i < U.Length; i++)
                    {
                        for (int j = 0; j < VCurve.Length; j++)
                        {
                            _curvesPatchPoints[(_u - 1) * ii + i, (_v * multiplier - 1) * jj + j] = MatrixProvider.Multiply(CalculateB(U[i]), _pointsToDrawSinglePatch, CalculateB(VCurve[j]));
                        }
                    }


                    for (int i = 0; i < UCurve.Length; i++)
                    {
                        for (int j = 0; j < V.Length; j++)
                        {
                            _curvesPatchPoints1[(_u * multiplier - 1) * ii + i, (_v - 1) * jj + j] = MatrixProvider.Multiply(CalculateB(UCurve[i]), _pointsToDrawSinglePatch, CalculateB(V[j]));
                        }
                    }
                }
            }
        }
Esempio n. 5
0
 public Point GetPointGregory(double u, double v)
 {
     Point[,] _pointsToDrawSinglePatch = (PatchPoints);
     return(MatrixProvider.Multiply(CalculateB(u), _pointsToDrawSinglePatch, CalculateB(v)));
 }