예제 #1
0
 private void BuildFacesDictionary()
 {
     if (this.NumberOfDimensions <= 2)
     {
         FacesDictionary.Clear();
     }
     else
     {
         CreateFaces3D();
     }
 }
예제 #2
0
        private void CreateFaces3D()
        {
            #region FaceRight

            Face faceRight = new Face();
            faceRight.Degrees[0] = this.DegreeHeta;
            faceRight.Degrees[1] = this.DegreeZeta;
            faceRight.KnotValueVectors.Add(0, KnotValueVectorHeta);
            faceRight.KnotValueVectors.Add(1, KnotValueVectorZeta);
            faceRight.Patch = this;
            int counter = 0;
            for (int i = 0; i < this.NumberOfControlPointsHeta; i++)
            {
                for (int j = 0; j < this.NumberOfControlPointsZeta; j++)
                {
                    faceRight.ControlPointsDictionary.Add(counter++,
                                                          ControlPoints[j + this.NumberOfControlPointsZeta * i]);
                }
            }

            FacesDictionary.Add(0, faceRight);

            #endregion FaceRight

            #region FaceLeft

            Face faceLeft = new Face();
            faceLeft.Degrees[0] = this.DegreeHeta;
            faceLeft.Degrees[1] = this.DegreeZeta;
            faceLeft.KnotValueVectors.Add(0, KnotValueVectorHeta);
            faceLeft.KnotValueVectors.Add(1, KnotValueVectorZeta);
            faceLeft.Patch = this;
            counter        = 0;
            for (int i = 0; i < this.NumberOfControlPointsHeta; i++)
            {
                for (int j = 0; j < this.NumberOfControlPointsZeta; j++)
                {
                    faceLeft.ControlPointsDictionary.Add(counter++,
                                                         ControlPoints[j + this.NumberOfControlPointsZeta * i +
                                                                       this.NumberOfControlPointsHeta * this.NumberOfControlPointsZeta *
                                                                       (this.NumberOfControlPointsKsi - 1)]);
                }
            }

            FacesDictionary.Add(1, faceLeft);

            #endregion FaceLeft

            #region FaceBottom

            Face faceBottom = new Face();
            faceBottom.Degrees[0] = this.DegreeKsi;
            faceBottom.Degrees[1] = this.DegreeHeta;
            faceBottom.KnotValueVectors.Add(0, KnotValueVectorKsi);
            faceBottom.KnotValueVectors.Add(1, KnotValueVectorHeta);
            faceBottom.Patch = this;
            counter          = 0;
            for (int i = 0; i < this.NumberOfControlPointsKsi; i++)
            {
                for (int j = 0; j < this.NumberOfControlPointsHeta; j++)
                {
                    faceBottom.ControlPointsDictionary.Add(counter++,
                                                           ControlPoints[j * this.NumberOfControlPointsZeta +
                                                                         i * this.NumberOfControlPointsZeta * this.NumberOfControlPointsHeta]);
                }
            }

            FacesDictionary.Add(2, faceBottom);

            #endregion FaceBottom

            #region FaceUp

            Face faceUp = new Face();
            faceUp.Degrees[0] = this.DegreeKsi;
            faceUp.Degrees[1] = this.DegreeHeta;
            faceUp.KnotValueVectors.Add(0, KnotValueVectorKsi);
            faceUp.KnotValueVectors.Add(1, KnotValueVectorHeta);
            faceUp.Patch = this;
            counter      = 0;
            for (int i = 0; i < this.NumberOfControlPointsKsi; i++)
            {
                for (int j = 0; j < this.NumberOfControlPointsHeta; j++)
                {
                    faceUp.ControlPointsDictionary.Add(counter++,
                                                       ControlPoints[this.NumberOfControlPointsZeta - 1 + j * this.NumberOfControlPointsZeta +
                                                                     i * this.NumberOfControlPointsZeta * this.NumberOfControlPointsHeta]);
                }
            }

            FacesDictionary.Add(3, faceUp);

            #endregion FaceUp

            #region FaceFront

            Face faceFront = new Face();
            faceFront.Degrees[0] = this.DegreeKsi;
            faceFront.Degrees[1] = this.DegreeZeta;
            faceFront.KnotValueVectors.Add(0, KnotValueVectorKsi);
            faceFront.KnotValueVectors.Add(1, KnotValueVectorZeta);
            faceFront.Patch = this;
            counter         = 0;
            for (int i = 0; i < this.NumberOfControlPointsKsi; i++)
            {
                for (int j = 0; j < this.NumberOfControlPointsZeta; j++)
                {
                    faceFront.ControlPointsDictionary.Add(counter++,
                                                          ControlPoints[j + i * this.NumberOfControlPointsHeta * this.NumberOfControlPointsZeta]);
                }
            }

            FacesDictionary.Add(4, faceFront);

            #endregion FaceFront

            #region FaceBack

            Face faceBack = new Face();
            faceBack.Degrees[0] = this.DegreeKsi;
            faceBack.Degrees[1] = this.DegreeZeta;
            faceBack.KnotValueVectors.Add(0, KnotValueVectorKsi);
            faceBack.KnotValueVectors.Add(1, KnotValueVectorZeta);
            faceBack.Patch = this;
            counter        = 0;
            for (int i = 0; i < this.NumberOfControlPointsKsi; i++)
            {
                for (int j = 0; j < this.NumberOfControlPointsZeta; j++)
                {
                    faceBack.ControlPointsDictionary.Add(counter++,
                                                         ControlPoints[j + i * this.NumberOfControlPointsHeta * this.NumberOfControlPointsZeta +
                                                                       this.NumberOfControlPointsZeta * (this.NumberOfControlPointsHeta - 1)]);
                }
            }

            FacesDictionary.Add(5, faceBack);

            #endregion FaceBack
        }