public void ShouldNotBeStabilizedAfterSinglePoint() { var filter = new PointStabilizationFilter(2, 5); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); Assert.IsFalse(filter.HasStabilizedPoint); }
public void ShouldBeStabilizedAfterFiveOfSamePoint() { var filter = new PointStabilizationFilter(2, 5); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); Assert.IsTrue(filter.HasStabilizedPoint); }
public void ShouldNotBeStabilizedAfter4StablePointsAndOneOutOfTolerance() { var filter = new PointStabilizationFilter(2, 5); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(8, 8)); Assert.IsFalse(filter.HasStabilizedPoint); Assert.AreEqual(1, filter.PointCount); }
public void StabilizedPointShouldBeSameAsInputValue() { var filter = new PointStabilizationFilter(2, 5); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); Assert.AreEqual(5, filter.StabilizedPoint.X); Assert.AreEqual(5, filter.StabilizedPoint.Y); }
public void ShouldBeStabilizedIf6thPointInToleranceButDifferent() { var filter = new PointStabilizationFilter(2, 5); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(6.1, 4.75)); Assert.IsTrue(filter.HasStabilizedPoint); }
public void ShouldNotBeStabilizedIfStabilizedThen6thPointIsOutOfToleranceButDifferent() { var filter = new PointStabilizationFilter(2, 5); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5)); Assert.IsTrue(filter.HasStabilizedPoint); filter.Add(new Core.Models.Drawing.Point2D <double>(8, 4.75)); Assert.IsFalse(filter.HasStabilizedPoint); }
public Machine(MachinesRepo repo) { _machineRepo = repo; Messages = new System.Collections.ObjectModel.ObservableCollection <Models.StatusMessage>(); AddStatusMessage(StatusMessageTypes.Info, "Startup."); ToolChangeManager = new Managers.ToolChangeManager(this, Services.Logger); GCodeFileManager = new Managers.GCodeFileManager(this, Core.PlatformSupport.Services.Logger, ToolChangeManager); PCBManager = new Managers.PCBManager(this, Core.PlatformSupport.Services.Logger); HeightMapManager = new Managers.HeightMapManager(this, Core.PlatformSupport.Services.Logger, PCBManager); ProbingManager = new Managers.ProbingManager(this, Core.PlatformSupport.Services.Logger); MachineVisionManager = new Managers.MachineVisionManager(this, Core.PlatformSupport.Services.Logger, PCBManager); var pointStabilizationFilter = new PointStabilizationFilter(Constants.PixelToleranceEpsilon, Constants.PixelStabilizationToleranceCount); BoardAlignmentManager = new Managers.BoardAlignmentManager(this, Core.PlatformSupport.Services.Logger, PCBManager, pointStabilizationFilter); }