2014-06-05 11:45:40 -07:00
|
|
|
|
/*
|
|
|
|
|
|
Copyright (c) 2014, Lars Brubaker
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
2015-04-08 15:20:10 -07:00
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
2014-06-05 11:45:40 -07:00
|
|
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice, this
|
2015-04-08 15:20:10 -07:00
|
|
|
|
list of conditions and the following disclaimer.
|
2014-06-05 11:45:40 -07:00
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
2015-04-08 15:20:10 -07:00
|
|
|
|
and/or other materials provided with the distribution.
|
2014-06-05 11:45:40 -07:00
|
|
|
|
|
|
|
|
|
|
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
|
2015-04-08 15:20:10 -07:00
|
|
|
|
of the authors and should not be interpreted as representing official policies,
|
2014-06-05 11:45:40 -07:00
|
|
|
|
either expressed or implied, of the FreeBSD Project.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2018-01-05 12:44:57 -08:00
|
|
|
|
using System.Collections.Generic;
|
2014-06-05 11:45:40 -07:00
|
|
|
|
using MatterHackers.MatterControl.SlicerConfiguration;
|
2018-03-29 12:31:36 -07:00
|
|
|
|
using MatterHackers.MeshVisualizer;
|
2015-04-08 15:20:10 -07:00
|
|
|
|
using MatterHackers.VectorMath;
|
2014-06-05 11:45:40 -07:00
|
|
|
|
|
2014-06-06 16:05:18 -07:00
|
|
|
|
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
2014-06-05 11:45:40 -07:00
|
|
|
|
{
|
2018-05-23 17:54:31 -07:00
|
|
|
|
public class LevelWizard3Point : LevelingPlan
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
2018-05-23 17:54:31 -07:00
|
|
|
|
public LevelWizard3Point(PrinterConfig printer)
|
|
|
|
|
|
: base(printer)
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-03-29 12:31:36 -07:00
|
|
|
|
public override int ProbeCount => 3;
|
2015-08-01 14:44:53 -07:00
|
|
|
|
|
2021-02-09 17:27:26 -08:00
|
|
|
|
public override IEnumerable<Vector2> GetPositionsToSample(Vector3 startingPosition)
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
2018-03-29 12:31:36 -07:00
|
|
|
|
Vector2 bedSize = printer.Settings.GetValue<Vector2>(SettingsKey.bed_size);
|
|
|
|
|
|
Vector2 printCenter = printer.Settings.GetValue<Vector2>(SettingsKey.print_center);
|
|
|
|
|
|
|
2018-03-29 16:48:54 -07:00
|
|
|
|
if (printer.Settings.GetValue<BedShape>(SettingsKey.bed_shape) == BedShape.Circular)
|
2015-04-08 15:20:10 -07:00
|
|
|
|
{
|
2018-03-29 16:48:54 -07:00
|
|
|
|
Vector2 firstPosition = new Vector2(printCenter.X, printCenter.Y + (bedSize.Y / 2) * .5);
|
|
|
|
|
|
yield return firstPosition;
|
|
|
|
|
|
yield return Vector2.Rotate(firstPosition, MathHelper.Tau / 3);
|
|
|
|
|
|
yield return Vector2.Rotate(firstPosition, MathHelper.Tau * 2 / 3);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
yield return new Vector2(printCenter.X - (bedSize.X / 2) * .8, printCenter.Y - (bedSize.Y / 2) * .8);
|
|
|
|
|
|
yield return new Vector2(printCenter.X + (bedSize.X / 2) * .8, printCenter.Y - (bedSize.Y / 2) * .8);
|
2018-04-03 09:50:26 -07:00
|
|
|
|
yield return new Vector2(printCenter.X, printCenter.Y + (bedSize.Y / 2) * .8);
|
2015-04-08 15:20:10 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|