コード例 #1
0
ファイル: DrawAcceleration.cs プロジェクト: John1900/G-Cam
        public void compute()
        {
            double prevLift = 0;
            double prevVelocity = 0;
            double timePerStep = 60.0 / Data.iRpm / 360.0 * STEPSIZE;

            CompGeometry cg = new CompGeometry();

            for (double alpha = Constants.R90; alpha >= 0; alpha -= Change.toRadians(STEPSIZE) )
            {
                Coord contact = cg.compLifterLift(alpha);

                // Half width of lifter
                if(contact.x > maxLifter) { maxLifter = contact.x; }

                // Lift
                double lift = contact.y; // -Data.dBaseRadius;
                pLift.Add(new Polar(lift, alpha));
                if(lift > maxLift.r) { maxLift = new Polar(lift, alpha); }
                if(lift < minLift.r) { minLift = new Polar(lift, alpha); }

                // Vertical velocity
                double velocity = (lift - prevLift) / timePerStep;
                pVelocity.Add(new Polar(velocity, alpha));
                if(velocity > maxVelocity.r) { maxVelocity = new Polar(velocity, alpha); }
                if(velocity < minVelocity.r) { minVelocity = new Polar(velocity, alpha); }

                // Vertical acceleration
                double acceleration = velocity - prevVelocity;
                pAcceleration.Add(new Polar(acceleration, alpha));
                if(acceleration > maxAcceleration.r) { maxAcceleration = new Polar(acceleration, alpha); }
                if(acceleration < minAcceleration.r) { minAcceleration = new Polar(acceleration, alpha); }

                // Save for previuos compares
                prevLift = lift;
                prevVelocity = velocity;

                // For testing
                double a = Change.toDegrees(alpha);
                double xx = contact.x;
                double yy = contact.y;
            }

            Data.dLifterDiameter = maxLifter * 2;

            // For testing
            //double l1 = maxLift.aDeg;
            //double l2 = maxLift.r;
            //double v1 = maxVelocity.aDeg;
            //double v2 = maxVelocity.r;
            //double v3 = minVelocity.aDeg;
            //double v4 = minVelocity.r;
            //double a1 = maxAcceleration.aDe
            //double a2 = maxAcceleration.r;
            //double a3 = minAcceleration.aDeg;
            //double a4 = minAcceleration.r;
        }
コード例 #2
0
ファイル: GGraphics.cs プロジェクト: John1900/G-Cam
 public void drawPoint(Brush b, Polar p)
 {
     float x = (float)(p.r * Math.Cos(p.a - Constants.R90));
     float y = (float)(p.r * Math.Sin(p.a - Constants.R90));
     g.FillRectangle(b, (float)((originX + x) * scale), (float)((originY - y) * scale), 1, 1);
 }
コード例 #3
0
ファイル: DrawAcceleration.cs プロジェクト: John1900/G-Cam
        public Image drawChart(List<Polar> pValues, Polar max, Polar min, int type)
        {
            // Setup Graphics
            Image image = new Bitmap((int)(DIAGRAMWIDTH * 1.4), (int)(DIAGRAMHEIGHT * 1.4));

            // compute scale
            xScale = (float)((DIAGRAMWIDTH  - XBORDER) / 90.0);

            top = NextHigher.get(max.r);
            bot = 0;
            if (min.r < 0) { bot = - NextHigher.get(-min.r); }

            yScale = (DIAGRAMHEIGHT - YTOPBORDER - YBOTBORDER) / (top + Math.Abs(bot));

            Graphics graphics = Graphics.FromImage(image);
            graphics.PageUnit = GraphicsUnit.Point;
            g = new GGraphics(graphics, 1, 0, 0);

            drawBakground(type);

            foreach (Polar p in pValues)
            {
                float x = transposeX(p.aDeg);
                float y = transposeY(p.r);
                g.drawPointAbsolute(pointBrush, x, y);
            }

            return image;
        }
コード例 #4
0
ファイル: DrawAcceleration.cs プロジェクト: John1900/G-Cam
        private void computeGrinder()
        {
            double prevOffset = 0;
            CompGeometry cg = new CompGeometry();

            for (double alpha = Constants.R90; alpha >= 0; alpha -= Change.toRadians(STEPSIZE) )
            {
                Polar offset = new Polar(cg.compGrinderOffset(alpha) - Data.dBaseRadius - Data.dWheelDiameter/2, alpha);

                if (prevOffset != 0 && Math.Abs((offset.r - prevOffset)) > 0.001)
                {
                    double x = Change.toDegrees(alpha);
                }
                prevOffset = offset.r;

                pGrinder.Add(offset);
                double lift = offset.r;
                pLift.Add(new Polar(lift, alpha));
                if (lift > maxGrind.r) { maxGrind = new Polar(lift, alpha); }
                if (lift < minGrind.r) { minGrind = new Polar(lift, alpha); }
            }
        }
コード例 #5
0
ファイル: Data.cs プロジェクト: John1900/G-Cam
 private static void putPolar(String keyR, String keyA, Polar value)
 {
     putDouble(keyR, value.r);
     putDouble(keyA, value.a);
 }