private void heightmapDemo(object sender, RoutedEventArgs e) { enable3dOutput(); var toolDiameter = 5.0; var margin = toolDiameter; var radius = 50.0; var mapResolution = 0.2; var center = new Point(margin + radius, margin + radius); var modelShape = new ConeShape(center, radius); var mapStart = new Point(0, 0); var mapEnd = new Point(mapStart.X + 2 * margin + 2 * radius, mapStart.Y + 2 * margin + 2 * radius); var model = HeightMap.From(modelShape, mapStart, mapEnd, mapResolution); //simulate parallel machining var blockHeight = radius + margin; var stock = HeightMap.Flat(blockHeight, mapStart, mapEnd, mapResolution); var machiningStep = 1.0; var tool = new BallnoseEndMill(toolDiameter); simulateLinearMachining(stock, tool, model, toolDiameter, machiningStep, true); simulateLinearMachining(stock, tool, model, toolDiameter, machiningStep, false); output3D(stock); }
public override double[,] AsConvolution(double mapStepSize) { var toolShape = new HemisphereShape(new Point(Diameter / 2 - mapStepSize / 2, Diameter / 2 - mapStepSize / 2), Diameter / 2); var map = HeightMap.From(toolShape, new Point(0, 0), new Point(Diameter, Diameter), mapStepSize); return(getConvolutionWithOffset(map, 0)); }
public override double[,] AsConvolution(double mapResolution) { var shapeOffset = 1.0; var toolShape = new CylinderShape(new Point(Diameter / 2 - mapResolution / 2, Diameter / 2 - mapResolution / 2), shapeOffset, Diameter); var map = HeightMap.From(toolShape, new Point(0, 0), new Point(Diameter, Diameter), mapResolution); return(getConvolutionWithOffset(map, shapeOffset)); }