Example #1
0
        private void drawPointsAndLines(Random random)
        {
            for (int i = 0; i < boundaryPoints.Count; i++)
            {
                Color color = roundColor(random);
                for (int j = 0; j < boundaryPoints[i].Count; j++)
                {
                    Debug.WriteLine("Rysuję punkt: " + boundaryPoints[i][j].toString());

                    Models.Point thirdPoint = findThirdPoint(new Models.Point(0, 0), new Models.Point(boundaryPoints[i][j].x1, boundaryPoints[i][j].x2), maxPointValue);
                    float[,] array2D = new float[, ] {
                        { 0, 0 }, { boundaryPoints[i][j].x1, boundaryPoints[i][j].x2 }, { thirdPoint.x1, thirdPoint.x2 }
                    };
                    ILArray <float> Pos = array2D;
                    plotCube.Add(new ILLinePlot(Pos, tag: "mylineplot")
                    {
                        Line =
                        {
                            Width        =     2,
                            Color        = color,
                            Antialiasing = true,
                            DashStyle    = DashStyle.Solid
                        }
                    });
                }

                try
                {
                    float[,] pointsForCar = new float[carDealers[i].carList.Count, 3];
                    for (int j = 0; j < carDealers[i].carList.Count; j++)
                    {
                        pointsForCar[j, 0] = carDealers[i].carList[j].age;
                        pointsForCar[j, 1] = carDealers[i].carList[j].beuty;
                        pointsForCar[j, 2] = 0;
                    }

                    ILPoints points = new ILPoints();
                    points.Positions = pointsForCar;
                    points.Color     = color;

                    plotCube.Add(points);
                }
                catch (NullReferenceException e)
                {
                    Debug.WriteLine("Poleciał wyjątek brak listy samchoddów.");
                }
            }
        }
Example #2
0
        public Models.Point findThirdPoint(Models.Point point1, Models.Point point2, float maxValue)
        {
            Debug.WriteLine("Wyszukiwanie punktu maksymalnego: ");
            Debug.WriteLine("Punkt1: " + point1.toString());
            Debug.WriteLine("Punkt2: " + point2.toString());

            if (point2.x1 < 0)
            {
                maxValue = -maxValue;
            }

            float y  = point1.x2 - point2.x2;
            float aH = point1.x1 - point2.x1;
            float a  = y / aH;
            float b  = point1.x2 - a * point1.x1;

            Debug.WriteLine("a: {0}, b: {1} ", a, b);

            float x2 = a * maxValue + b;

            Debug.WriteLine("Finalny punkt: ({0}, {1}) ", maxValue, x2);

            return(new Models.Point(maxValue, x2));
        }