HelixToolkit.Wpf.GridLinesVisual3D.Tessellate C# (CSharp) Method

Tessellate() protected method

Do the tesselation and return the MeshGeometry3D.
protected Tessellate ( ) : System.Windows.Media.Media3D.MeshGeometry3D
return System.Windows.Media.Media3D.MeshGeometry3D
        protected override MeshGeometry3D Tessellate()
        {
            this.lengthDirection = this.LengthDirection;
            this.lengthDirection.Normalize();
            this.widthDirection = Vector3D.CrossProduct(this.Normal, this.lengthDirection);
            this.widthDirection.Normalize();

            var mesh = new MeshBuilder(true, false);
            double minX = -this.Width / 2;
            double minY = -this.Length / 2;
            double maxX = this.Width / 2;
            double maxY = this.Length / 2;

            double x = minX;
            double eps = this.MinorDistance / 10;
            while (x <= maxX + eps)
            {
                double t = this.Thickness;
                if (IsMultipleOf(x, this.MajorDistance))
                {
                    t *= 2;
                }

                this.AddLineX(mesh, x, minY, maxY, t);
                x += this.MinorDistance;
            }

            double y = minY;
            while (y <= maxY + eps)
            {
                double t = this.Thickness;
                if (IsMultipleOf(y, this.MajorDistance))
                {
                    t *= 2;
                }

                this.AddLineY(mesh, y, minX, maxX, t);
                y += this.MinorDistance;
            }

            var m = mesh.ToMesh();
            m.Freeze();
            return m;
        }