/// <inheritdoc/> internal override void Build(WorkspacePanel workspace, List <Speed4Dstep> speedPoints, ItemJoin incommingJoin) { if (incommingJoin.Item2 != this) { throw new NotSupportedException("Incomming join point is not valid."); } var cuttingSpeed = workspace.CuttingSpeed; var cutPoints = CutPoints.ToArray(); if (!cutPoints.First().Equals(cutPoints.Last())) { throw new NotSupportedException("Shape is not closed."); } //skip the repetitive point so we can join to whatever shape part. cutPoints = cutPoints.Take(cutPoints.Length - 1).ToArray(); var outJoins = workspace.FindOutgoingJoins(this); var startIndex = incommingJoin.JoinPointIndex2; for (var i = startIndex + 1; i <= startIndex + cutPoints.Length; ++i) { var currentIndex = i % cutPoints.Length; var currentPoint = cutPoints[currentIndex]; speedPoints.Add(currentPoint.With(cuttingSpeed)); var currentOutgoingJoins = workspace.GetOutgoingJoinsFrom(currentIndex, outJoins); foreach (var currentOutgoingJoin in currentOutgoingJoins) { currentOutgoingJoin.Build(workspace, speedPoints); } } }
/// <inheritdoc/> protected override void OnRender(DrawingContext drawingContext) { var points = translateToWorkspace(TransformedShapeDefinition); var figureUV = CreatePathFigure(points.ToUV()); var figureXY = CreatePathFigure(points.ToXY()); var cutPoints = CutPoints.ToArray(); var cutUV = CreatePathFigure(cutPoints.ToUV()); var cutXY = CreatePathFigure(cutPoints.ToXY()); var geometryUV = new PathGeometry(new[] { figureUV }, FillRule.EvenOdd, Transform.Identity); var geometryXY = new PathGeometry(new[] { figureXY }, FillRule.EvenOdd, Transform.Identity); var geometryCutUV = new PathGeometry(new[] { cutUV }); var geometryCutXY = new PathGeometry(new[] { cutXY }); drawingContext.DrawGeometry(_itemBrushUV, _itemPen, geometryUV); drawingContext.DrawGeometry(_itemBrushXY, _itemPen, geometryXY); drawingContext.DrawGeometry(null, _cutPenUV, geometryCutUV); drawingContext.DrawGeometry(null, _cutPenXY, geometryCutXY); }
/// <inheritdoc/> internal override void Build(WorkspacePanel workspace, List <Speed4Dstep> speedPoints, ItemJoin incommingJoin) { if (_speedAlgorithm == SpeedAlgorithm.TowerBased || !UseExplicitKerf) { base.Build(workspace, speedPoints, incommingJoin); return; } if (incommingJoin.Item2 != this) { throw new NotSupportedException("Incomming join point is not valid."); } var cuttingSpeed = workspace.CuttingSpeed; var cutPoints = CutPoints.ToArray(); if (!cutPoints.First().Equals(cutPoints.Last())) { throw new NotSupportedException("Shape is not closed."); } var definitionPoints = CutDefinition.ToArray(); if (cutPoints.Count() != definitionPoints.Count()) { throw new NotSupportedException("Invalid cut points count."); } //skip the repetitive point so we can join to whatever shape part. cutPoints = cutPoints.Take(cutPoints.Length - 1).ToArray(); definitionPoints.Take(definitionPoints.Length - 1).ToArray(); var projector = new PlaneProjector(_shapeMetricThickness, _wireLength); var outJoins = workspace.FindOutgoingJoins(this); var startIndex = incommingJoin.JoinPointIndex2; for (var i = startIndex + 1; i <= startIndex + cutPoints.Length; ++i) { var currentIndex = i % cutPoints.Length; var currentPoint = cutPoints[currentIndex]; var speeds = getSpeeds(definitionPoints, currentIndex, cuttingSpeed, projector); //System.Diagnostics.Debug.Print(speeds.ToString()); var speed1Limit = speeds.Item1.ToDeltaT() >= Constants.StartDeltaT || speeds.Item1.ToDeltaT() < 0; var speed2Limit = speeds.Item2.ToDeltaT() >= Constants.StartDeltaT || speeds.Item2.ToDeltaT() < 0; if (!speed1Limit || !speed2Limit) { throw new PlanningException("Speed limit exceeded"); } speedPoints.Add(currentPoint.With(speeds.Item1, speeds.Item2)); var currentOutgoingJoins = workspace.GetOutgoingJoinsFrom(currentIndex, outJoins); foreach (var currentOutgoingJoin in currentOutgoingJoins) { currentOutgoingJoin.Build(workspace, speedPoints); } } }