Ejemplo n.º 1
0
        private void getSpeedVectors(WorkspacePanel workspace, Point4Dmm t1, Point4Dmm t2, out Vector speedVector12UVt, out Vector speedVector12XYt)
        {
            var maxSpeed      = workspace.CuttingSpeed;
            var maxSpeedRatio = (maxSpeed.StepCount * Constants.MilimetersPerStep) / (1.0 * maxSpeed.Ticks / Constants.TimerFrequency);

            //tower speeds
            speedVector12UVt = diffVector(t1.ToUV(), t2.ToUV());
            speedVector12XYt = diffVector(t1.ToXY(), t2.ToXY());
            if (speedVector12UVt.Length > speedVector12XYt.Length)
            {
                var speedRatio = speedVector12XYt.Length / speedVector12UVt.Length;
                speedVector12UVt.Normalize();
                speedVector12XYt.Normalize();

                speedVector12UVt = speedVector12UVt * maxSpeedRatio;
                speedVector12XYt = speedVector12XYt * speedRatio;
            }
            else
            {
                var speedRatio = speedVector12UVt.Length / speedVector12XYt.Length;
                speedVector12UVt.Normalize();
                speedVector12XYt.Normalize();

                speedVector12UVt = speedVector12UVt * maxSpeedRatio;
                speedVector12XYt = speedVector12XYt * speedRatio;
            }
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        protected override Point4Dmm applyKerf(Point4Dmm p1, Point4Dmm p2, Point4Dmm p3, WorkspacePanel workspace)
        {
            double kerfUV, kerfXY;

            if (UseExplicitKerf)
            {
                kerfUV = reCalculateKerf(KerfUV);
                kerfXY = reCalculateKerf(KerfXY);
            }
            else
            {
                getShapeSpeedVectors(workspace, p1, p2, out Vector speedVector12UV, out Vector speedVector12XY);
                getShapeSpeedVectors(workspace, p2, p3, out Vector speedVector23UV, out Vector speedVector23XY);

                var speedUV = (speedVector12UV.Length + speedVector23UV.Length) / 2;
                var speedXY = (speedVector12XY.Length + speedVector23XY.Length) / 2;

                var referentialKerf = workspace.CuttingKerf;
                kerfUV = reCalculateKerf(referentialKerf, speedUV, workspace);
                kerfXY = reCalculateKerf(referentialKerf, speedXY, workspace);
            }
            var shiftUV = calculateKerfShift(p1.ToUV(), p2.ToUV(), p3.ToUV(), kerfUV);
            var shiftXY = calculateKerfShift(p1.ToXY(), p2.ToXY(), p3.ToXY(), kerfXY);

            return(new Point4Dmm(p2.U + shiftUV.X, p2.V + shiftUV.Y, p2.X + shiftXY.X, p2.Y + shiftXY.Y));
        }