2015-08-01 14:44:53 -07:00
|
|
|
|
/*
|
|
|
|
|
|
Copyright (c) 2014, Lars Brubaker
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice, this
|
|
|
|
|
|
list of conditions and the following disclaimer.
|
|
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
|
|
|
|
|
and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
The views and conclusions contained in the software and documentation are those
|
|
|
|
|
|
of the authors and should not be interpreted as representing official policies,
|
|
|
|
|
|
either expressed or implied, of the FreeBSD Project.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2018-01-05 12:44:57 -08:00
|
|
|
|
using System;
|
2018-03-29 16:48:54 -07:00
|
|
|
|
using System.Collections.Generic;
|
2015-08-01 14:44:53 -07:00
|
|
|
|
using MatterHackers.MatterControl.SlicerConfiguration;
|
|
|
|
|
|
using MatterHackers.VectorMath;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|
|
|
|
|
{
|
2018-03-29 12:31:36 -07:00
|
|
|
|
public class LevelWizard7PointRadial : LevelWizardBase
|
2017-04-12 12:12:11 -07:00
|
|
|
|
{
|
2018-04-06 14:58:25 -07:00
|
|
|
|
public LevelWizard7PointRadial(PrinterConfig printer)
|
|
|
|
|
|
: base(printer)
|
2017-04-12 12:12:11 -07:00
|
|
|
|
{
|
|
|
|
|
|
}
|
2015-08-15 16:18:49 -07:00
|
|
|
|
|
2018-03-29 16:16:31 -07:00
|
|
|
|
public override int ProbeCount => 7;
|
2015-08-15 16:18:49 -07:00
|
|
|
|
|
2018-03-29 16:48:54 -07:00
|
|
|
|
public override IEnumerable<Vector2> GetPrintLevelPositionToSample()
|
2017-04-12 12:12:11 -07:00
|
|
|
|
{
|
2018-03-29 12:31:36 -07:00
|
|
|
|
int numberOfRadialSamples = 6;
|
2017-10-31 12:51:16 -07:00
|
|
|
|
double bedRadius = Math.Min(printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).X, printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).Y) / 2;
|
2018-03-29 12:31:36 -07:00
|
|
|
|
Vector2 bedCenter = printer.Settings.GetValue<Vector2>(SettingsKey.print_center);
|
2018-03-29 16:48:54 -07:00
|
|
|
|
|
2018-04-04 14:57:59 -07:00
|
|
|
|
yield return bedCenter;
|
|
|
|
|
|
|
2018-03-29 16:48:54 -07:00
|
|
|
|
for (int i = 0; i < numberOfRadialSamples; i++)
|
2017-04-12 12:12:11 -07:00
|
|
|
|
{
|
2018-04-04 14:57:59 -07:00
|
|
|
|
Vector2 position = new Vector2(bedRadius * .9, 0);
|
2018-03-29 16:48:54 -07:00
|
|
|
|
position.Rotate(MathHelper.Tau / numberOfRadialSamples * i);
|
2017-04-12 12:12:11 -07:00
|
|
|
|
position += bedCenter;
|
2018-03-29 16:48:54 -07:00
|
|
|
|
yield return position;
|
2017-04-12 12:12:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2015-08-01 14:44:53 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|