I am using Helixtoolkit.WPF in my C # program. I imported the NuGet package and it works fine. However, I want to edit one of the files, in particular GridLinesVisual.cs. I want to change how one of the functions in this file works, but it doesn't seem to work.
The function I need to change starts on line 247 protected override MeshGeometry3D Tessellate()
Here is the link to the file I need to update / change
https://searchcode.com/codesearch/view/10564811/
The calling code from my program grid = new GridLinesVisual3D();
I am not as familiar with C # as I am with C ++, but I know that I cannot create a child class to edit this function. I think overriding is the right way to do this, but I can't get it to work. I created a new RectGrid.cs file, and this is what I have in the code:
using HelixToolkit.Wpf;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Media3D;
namespace Axcro.Helix_Toolkit_Extentions
{
class RectGrid : GridLinesVisual3D
{
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;
}
var m = mesh.ToMesh();
m.Freeze();
return m;
}
}
}
This code compiles just fine, but my changes to Tessellate are not displayed. Is using override the correct way to change the Tessellate function or is there a better / easier way to edit it?
For what it's worth, the Tessellate function creates grid lines in the X and Y directions. I only need grid lines in the Y direction, not X. So basically I don't want the grid, I just need the lines ...