Пример #1
0
        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);
        }