コード例 #1
0
 public void GenerateView()
 {
     for (int i = 0; i < VertexCount; i++)
     {
         Points.Add(GeometricArithmeticModule.GetPointAtPosition(
                        StartPoint, EndPoint, ControlPoint_1, ControlPoint_2, i / (double)(VertexCount - 1))
                    );
     }
 }
コード例 #2
0
ファイル: MarkGeometryArc.cs プロジェクト: AdilGM/2DCAD
        public override void SetExtents()
        {
            if (EndAngle < StartAngle)
            {
                Sweep = (EndAngle + (2d * Math.PI)) - StartAngle;
            }
            else
            {
                Sweep = EndAngle - StartAngle;
            }

            Area      = 0.5 * Sweep * Math.Pow(Radius, 2);
            Perimeter = Sweep * Radius;

            // determine start and end points
            StartPoint = GeometricArithmeticModule.GetPointAtPosition(this, 0.0);
            EndPoint   = GeometricArithmeticModule.GetPointAtPosition(this, 1.0);;
            Extents    = GeometricArithmeticModule.CalculateExtents((MarkGeometryPoint[])this);
        }
コード例 #3
0
ファイル: MarkGeometryLine.cs プロジェクト: AdilGM/2DCAD
 public MarkGeometryPoint GetMidpoint()
 {
     return(GeometricArithmeticModule.GetPointAtPosition(this, 0.5));
 }
コード例 #4
0
        public TimeSpan EstimateProcessTime(MRecipeDeviceLayer layer)
        {
            const double kConst        = 0.000001;
            double       totalTaktTime = 0;

            IMarkParametersComplete processParams = FetchDXFParameters(layer);

            if (processParams == null)
            {
                return(TimeSpan.Zero);
            }

            int    numOfJoints  = 0;
            double jumpDistance = 0;
            double markDistance = 0;
            double minX         = double.MaxValue;
            double minY         = double.MaxValue;
            double maxX         = double.MinValue;
            double maxY         = double.MinValue;

            MarkGeometryPoint lastPosition = null;

            foreach (var geometry in FetchDXF(layer))
            {
                if (geometry is MarkGeometryPoint point)
                {
                    if (lastPosition != null)
                    {
                        jumpDistance += GeometricArithmeticModule.ABSMeasure2D(lastPosition, point);
                    }

                    markDistance += point.Perimeter;
                    lastPosition  = point;
                }
                else if (geometry is MarkGeometryLine line)
                {
                    if (lastPosition != null)
                    {
                        jumpDistance += GeometricArithmeticModule.ABSMeasure2D(lastPosition, line.StartPoint);
                    }

                    markDistance += line.Perimeter;
                    lastPosition  = line.EndPoint;
                }
                else if (geometry is MarkGeometryCircle circle)
                {
                    if (lastPosition != null)
                    {
                        jumpDistance += GeometricArithmeticModule.ABSMeasure2D(
                            lastPosition,
                            GeometricArithmeticModule.GetPointAtPosition(
                                circle, 0
                                )
                            );
                    }

                    markDistance += circle.Perimeter;
                    numOfJoints  += Math.Max(circle.VertexCount - 1, 0);
                    lastPosition  = GeometricArithmeticModule.GetPointAtPosition(circle, 1.0);
                }
                else if (geometry is MarkGeometryArc arc)
                {
                    if (lastPosition != null)
                    {
                        jumpDistance += GeometricArithmeticModule.ABSMeasure2D(lastPosition, arc.StartPoint);
                    }

                    markDistance += arc.Perimeter;
                    numOfJoints  += Math.Max(arc.VertexCount - 1, 0);
                    lastPosition  = arc.EndPoint;
                }
                else if (geometry is MarkGeometryPath path)
                {
                    if (lastPosition != null)
                    {
                        jumpDistance += GeometricArithmeticModule.ABSMeasure2D(lastPosition, path.StartPoint);
                    }

                    markDistance += path.Perimeter;
                    numOfJoints  += Math.Max(path.Points.Count - 1, 0);
                    lastPosition  = path.EndPoint;
                }

                if (geometry.Extents.MinX < minX)
                {
                    minX = geometry.Extents.MinX;
                }

                if (geometry.Extents.MinY < minY)
                {
                    minY = geometry.Extents.MinY;
                }

                if (geometry.Extents.MaxX > maxX)
                {
                    maxX = geometry.Extents.MaxX;
                }

                if (geometry.Extents.MaxY > maxY)
                {
                    maxY = geometry.Extents.MaxY;
                }
            }

            double taktTime = (
                (markDistance / processParams.MarkSpeed) +
                (jumpDistance / processParams.JumpSpeed) +
                (kConst * numOfJoints * (processParams.JumpDelay_us + processParams.MarkDelay - processParams.Nprev))
                );

            // account for repeats and stepping between tiles - convert millisecond to second
            totalTaktTime += ((taktTime * processParams.Passes) + (0.001 * layer.TileDescriptions.Count() * processParams.SettlingTimems));

            return(TimeSpan.FromSeconds(Math.Round(totalTaktTime, 4)));
        }