Esempio n. 1
0
        /*
         * This small example creates a line and a plane from points.
         * It then computes the intersection point of the line and the plane.
         *
         * In this step, all GA variables are stored in specialized multivector types,
         * such as 'line', 'plane' and 'flatPoint'.
         */
        static void Main(string[] args)
        {
            // get five points
            normalizedPoint linePt1  = c3ga.cgaPoint(1.0f, 0.0f, 0.0f);
            normalizedPoint linePt2  = c3ga.cgaPoint(1.0f, 1.0f, 0.0f);
            normalizedPoint planePt1 = c3ga.cgaPoint(1.0f, 2.0f, 0.0f);
            normalizedPoint planePt2 = c3ga.cgaPoint(1.0f, 2.0f, 1.0f);
            normalizedPoint planePt3 = c3ga.cgaPoint(0.0f, 2.0f, 1.0f);

            // output text the can be copy-pasted into GAViewer
            Console.WriteLine("linePt1 = " + linePt1 + ",");
            Console.WriteLine("linePt2 = " + linePt2 + ",");
            Console.WriteLine("planePt1 = " + planePt1 + ",");
            Console.WriteLine("planePt2 = " + planePt2 + ",");
            Console.WriteLine("planePt3 = " + planePt3 + ",");

            // create line and plane out of points
            line L = new line((mv)linePt1 ^ (mv)linePt2 ^ (mv)c3ga.ni);
            //line L = new line(c3ga.op(linePt1, c3ga.op(linePt2, c3ga.ni))); // alternative, no explicit conversion required

            plane P = new plane((mv)planePt1 ^ (mv)planePt2 ^ (mv)planePt3 ^ (mv)c3ga.ni);

            //plane P = new plane(c3ga.op(planePt1, c3ga.op(planePt2, c3ga.op(planePt3, c3ga.ni)))); // alternative, no explicit conversion required

            // output text the can be copy-pasted into GAViewer
            Console.WriteLine("L = " + L + ",");
            Console.WriteLine("P = " + P + ",");

            // compute intersection of line and plane
            flatPoint intersection = new flatPoint(c3ga.lc(c3ga.dual(L), P));

            Console.WriteLine("intersection = " + intersection + ",");
        }
Esempio n. 2
0
    public static void NewPlane(planeAction action)
    {
        plane newPlane = new plane();

        newPlane.ID      = planesProcesed;
        newPlane.airline = airlineName();

        if (action == planeAction.arrive)
        {
            newPlane.ID = landingID;
            landingID  += 2;
        }
        else if (action == planeAction.depart)
        {
            newPlane.ID = takeOffID;
            takeOffID  += 2;
        }

        bool refused = checkRefuse(newPlane, action);

        if (!refused && action == planeAction.arrive)
        {
            landingQ.Enqueue(newPlane);
        }
        else if (!refused && action == planeAction.depart)
        {
            takeOffQ.Enqueue(newPlane);
        }

        planesProcesed++;
    }
Esempio n. 3
0
        /*
         * This small example creates a line and a plane from points.
         * It then computes the intersection point of the line and the plane.
         *
         * In this step, all types and functions are specialized.
         */
        static void Main(string[] args)
        {
            // get five points
            normalizedPoint linePt1  = c3ga.cgaPoint(1.0f, 0.0f, 0.0f);
            normalizedPoint linePt2  = c3ga.cgaPoint(1.0f, 1.0f, 0.0f);
            normalizedPoint planePt1 = c3ga.cgaPoint(1.0f, 2.0f, 0.0f);
            normalizedPoint planePt2 = c3ga.cgaPoint(1.0f, 2.0f, 1.0f);
            normalizedPoint planePt3 = c3ga.cgaPoint(0.0f, 2.0f, 1.0f);

            // output text the can be copy-pasted into GAViewer
            Console.WriteLine("linePt1 = " + linePt1 + ",");
            Console.WriteLine("linePt2 = " + linePt2 + ",");
            Console.WriteLine("planePt1 = " + planePt1 + ",");
            Console.WriteLine("planePt2 = " + planePt2 + ",");
            Console.WriteLine("planePt3 = " + planePt3 + ",");

            // create line and plane out of points
            line L = linePt1 ^ (linePt2 ^ c3ga.ni);

            plane P = planePt1 ^ (planePt2 ^ (planePt3 ^ c3ga.ni));

            // output text the can be copy-pasted into GAViewer
            Console.WriteLine("L = " + L + ",");
            Console.WriteLine("P = " + P + ",");

            // compute intersection of line and plane
            flatPoint intersection = c3ga.lc(c3ga.dual(L), P);

            normalizedPoint intersectionPt = c3ga.cgaPoint(intersection); // example of how to convert flatPoint to normalizedPoint

            Console.WriteLine("intersection = " + intersection + ",");
        }
Esempio n. 4
0
 public Game(int z, string gtn)
 {
     je = gtn;
     InitializeComponent();
     MessageBox.Show("↑(+250м) shift+↑(+500м) →(+50км/ч) shift+→(+150км/ч) ↓(-250м) shift+↓(-500м) ←(-50км/ч) shift+←(-150км/ч)");
     gem = z;
     p   = new plane(gem);
 }
Esempio n. 5
0
    //==========================plane===================
    public void addplane(plane pl)
    {
        string     command = "INSERT INTO [Plane] (PlaneName,PlaneModel,SeatsNumber) VALUES('" + pl.pname + "','" + pl.pmodel + "','" + pl.seats + "')";
        SqlCommand com     = new SqlCommand(command, con);

        con.Open();
        com.ExecuteNonQuery();
        con.Close();
    }
Esempio n. 6
0
    protected void FlightSearch_Click(object sender, EventArgs e)
    {
        string depart = FromText.Text;
        string arrive = ToText.Text;

        Session["PlaneResults"] = null;
        RomeApi += "&oName=" + depart + "&dName=" + arrive + "";
        System.Net.WebRequest wrGETURL;
        wrGETURL = System.Net.WebRequest.Create(RomeApi);
        System.IO.Stream objStream;
        objStream = wrGETURL.GetResponse().GetResponseStream();
        System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
        xmlDoc.Load(objStream);
        XmlNamespaceManager mgr = new XmlNamespaceManager(xmlDoc.NameTable);

        mgr.AddNamespace("ns", "http://www.rome2rio.com/api/1.2/xml");
        System.Xml.XmlNodeList flightnode  = xmlDoc.SelectNodes("//ns:SearchResponse/ns:Route[@name='Fly']/ns:FlightSegment/ns:FlightItinerary", mgr);
        System.Xml.XmlNodeList flighthop   = xmlDoc.SelectNodes("//ns:SearchResponse/ns:Route[@name='Fly']/ns:FlightSegment/ns:FlightItinerary/ns:FlightLeg/ns:FlightHop", mgr);
        System.Xml.XmlNodeList flightprice = xmlDoc.SelectNodes("//ns:SearchResponse/ns:Route[@name='Fly']/ns:FlightSegment/ns:FlightItinerary/ns:FlightLeg/ns:IndicativePrice", mgr);
        plane[] flights = new plane[flightnode.Count];
        int     j       = 0;

        foreach (XmlNode xn in flightnode)
        {
            double monies = (Convert.ToDouble(xn.FirstChild.FirstChild.Attributes[0].Value));
            ahop[] ahops  = new ahop[xn.FirstChild.ChildNodes.Count - 1];
            System.Xml.XmlNodeList hoplist = xn.FirstChild.ChildNodes;
            int k = 0;
            foreach (XmlNode xhop in hoplist)
            {
                if (xhop.Name.Equals("IndicativePrice"))
                {
                    continue;
                }
                string dterm    = xhop.Attributes[0].Value;
                string aterm    = xhop.Attributes[1].Value;
                string dtime    = xhop.Attributes[2].Value;
                string atime    = xhop.Attributes[3].Value;
                string airline  = xhop.Attributes[5].Value;
                string flightid = xhop.Attributes[5].Value + xhop.Attributes[7].Value;
                ahops[k] = new ahop(dterm, aterm, dtime, atime, airline, flightid);
                k++;
            }
            string departure     = ahops[0].departure;
            string departuretime = ahops[0].departuretime;
            string arrival       = ahops[ahops.Length - 1].arrival;
            string arrivaltime   = ahops[ahops.Length - 1].arrivaltime;
            flights[j] = new plane(departure, departuretime, arrival, arrivaltime, monies);
            j++;
        }
        Session.Add("PlaneResults", flights);
        RomeApi = "http://free.rome2rio.com/api/1.2/xml/Search?key=RNMpNhbV";
        GridView1.DataSource = (plane[])Session["PlaneResults"];
        GridView1.DataBind();
    }
Esempio n. 7
0
        public static vec3 intersect(this plane pl, ray r)
        {
            float d = pl.normal ^ -r.direction;

            if (d == 0)
            {             // line is parallel to plane
                return(vec3.empty);
            }

            float n = pl.d + (pl.normal ^ r.origin);

            return(r.origin + r.direction * (n / d));
        }
Esempio n. 8
0
        public static line3_segment intersect(this ray a, ray b)
        {
            vec3 d = a.direction % b.direction;

            if (d.isZero)
            {
                return(line3_segment.empty);
            }

            plane pa = new plane(a.origin, (a.direction % d).normalized);
            plane pb = new plane(b.origin, (b.direction % d).normalized);

            return(new line3_segment(pa.intersect(b), pb.intersect(a)));
        }
Esempio n. 9
0
    public static bool checkRefuse(plane newPlane, planeAction action)
    {
        if (landingQ.Count >= 5 && action == planeAction.arrive)
        {
            Console.WriteLine("Plane " + newPlane.ID + " was turned away because there were too many planes waiting to land.");
            planesRefused++;
            return(true);
        }
        else if (takeOffQ.Count >= 5 && action != planeAction.depart)
        {
            Console.WriteLine("Plane " + newPlane.ID + " was turned away because there were too many planes waiting to take off.");
            planesRefused++;
            return(true);
        }

        return(false);
    }
Esempio n. 10
0
 static void manageRunways(int runways)
 {
     for (int countRunways = 1; countRunways < runways + 1; countRunways++)
     {
         if (landingQ.Count >= takeOffQ.Count && landingQ.Count != 0)
         {
             plane test = landingQ.Dequeue();
             Console.WriteLine(test.airline + "'s plane, plane #" + test.ID + ", was cleared to land on runway " + countRunways + ".");
             planesLanded++;
         }
         else if (takeOffQ.Count != 0)
         {
             plane test = takeOffQ.Dequeue();
             Console.WriteLine(test.airline + "'s plane, plane #" + test.ID + ", was cleared to takeoff on runway " + countRunways + ".");
             planesTakenOff++;
         }
     }
 }
Esempio n. 11
0
        public static ray intersect(this plane a, plane b)
        {
            vec3 dir = a.normal % b.normal;

            if (dir.isZero)
            {
                return(ray.empty);
            }

            if (a.b != 0)
            {
                float d = (b.b * a.c - b.c);
                if (d != 0)
                {
                    float z = (b.d - b.b * a.d) / (b.b * a.c - b.c);
                    float y = (a.d - a.c * z) / a.b;
                    return(new ray(new vec3(0, y, z), dir));
                }
            }

            if (a.c != 0)
            {
                float d = (b.c * a.a - b.a);
                if (d != 0)
                {
                    float x = (b.d - b.c * a.d) / (b.c * a.a - b.a);
                    float z = (a.d - a.a * x) / a.c;
                    return(new ray(new vec3(x, 0, z), dir));
                }
            }

            if (a.a != 0)
            {
                float d = (b.a * a.b - b.b);
                if (a.a != 0 && d != 0)
                {
                    float y = (b.d - b.a * a.d) / (b.a * a.b - b.b);
                    float x = (a.d - a.b * y) / a.a;
                    return(new ray(new vec3(x, y, 0), dir));
                }
            }

            return(new ray(vec3.empty, dir));
        }
Esempio n. 12
0
            /// <summary>
            /// Adds a polygon to the topology. Can be used immediately after initializing the topology.
            /// </summary>
            /// <param name="P">An array of Points which make up the vertices of the polygon.</param>
            public void Add_Polygon(Point[] P)
            {
                List <Point> VertexList = new List <Point>(P.Length);

                for (int p = 0; p < P.Length; p++)
                {
                    VertexList.Add(this.AddGetIndex(P[p]));
                }

                //Array.Resize(ref Polys, Polys.Length + 1);
                if (P.Length == 4)
                {
                    lock (Top_Lock) Polys.Add(new Quadrilateral(ref VertexList, 0, Polys.Count));
                    //Polys[Polys.Count - 1] = new Quadrilateral(ref Vertices, VertexList, 0, Polys.Length - 1);
                }
                else if (P.Length == 3)
                {
                    lock (Top_Lock) Polys.Add(new Triangle(ref VertexList, 0, Polys.Count));
                    //Polys[Polys.Count - 1] = new Triangle(ref Vertices, VertexList, 0, Polys.Length - 1);
                }
                else
                {
                    throw new NotImplementedException("Hare Does not yet support polygons of more than 4 sides.");
                }

                plane p1 = new plane(Polys[Polys.Count - 1]);

                for (int i = 0; i < planeList.Count; i++)
                {
                    if (p1.GetHashCode() == planeList[i].GetHashCode())
                    {
                        Polys[Polys.Count - 1].Plane_ID = i;
                        Plane_Members[i].Add(Polys.Count - 1);
                        return;
                    }
                }
                planeList.Add(p1);
                Array.Resize <List <int> >(ref Plane_Members, Plane_Members.Length + 1);
                Plane_Members[Plane_Members.Length - 1] = new List <int>();
                Plane_Members[Plane_Members.Length - 1].Add(Polys.Count - 1);
                Polys[Polys.Count - 1].Plane_ID = planeList.Count - 1;
            }
Esempio n. 13
0
        public void Read(byte[] data)
        {
            using (var reader = new BinaryReader(new MemoryStream(data)))
            {
                fourcc = reader.ReadUInt32();
                size   = reader.ReadUInt32();

                max = new plane();
                for (var i = 0; i < 9; ++i)
                {
                    max.coords[i] = reader.ReadInt16();
                }

                min = new plane();
                for (var i = 0; i < 9; ++i)
                {
                    min.coords[i] = reader.ReadInt16();
                }
            }
        }
Esempio n. 14
0
        public uint[] AddPlane(plane p, vec3 origin, vec2 size, vec2i step, vec3 forward)
        {
            var  n     = MathEx.Convert.ToVec3(p.normal);
            vec3 right = vec3.Cross(n, forward);
            int  cn    = step.x + 1;
            int  rn    = step.y + 1;
            int  vn    = cn * rn;
            int  tn    = step.x * step.y * 2;
            vec2 dv    = size.Div(step);

            uint[] result = new uint[vn];

            Grow(vn, tn);

            int  ri = 0;
            vec3 v;

            for (int i = 0; i < cn; i++)
            {
                v = origin + i * right * dv.x;
                for (int j = 0; j < rn; j++, v += forward * dv.y)
                {
                    result[ri++] = CreateVertex(v, n);
                }
            }

            int vi = 0;

            for (int i = 0; i < tn / 2; i++, vi++)
            {
                if (((vi + 1) % rn) == 0)
                {
                    vi++;
                }

                MakeQuad(result[vi + 0], result[vi + 1], result[vi + 1 + rn], result[vi + 0 + rn]);
            }

            return(result);
        }
Esempio n. 15
0
        public JsonResult SaveFly(Fly DataFly)
        {
            Response response = new Response();

            try
            {
                System.Threading.Thread.Sleep(1000);
                var Flights = HttpContext.Session.GetObjectFromJson <List <Fly> >("DataFlights");

                plane   CurrentPlane = listAvions.Find(x => x.IdAvion.ToString() == DataFly.AvionChoisie);
                Airport DepartAr     = listAeroports.Find(x => x.CodeAeroport.ToString() == DataFly.LieuDepartChoisi);
                Airport ReturnAr     = listAeroports.Find(x => x.CodeAeroport.ToString() == DataFly.LieuArriveeChoisi);

                DataFly.Distance     = Utility.GetDistanceFromLatLonInKm(DepartAr.Latitude, DepartAr.Longitude, ReturnAr.Latitude, ReturnAr.Longitude);
                DataFly.Consommation = Utility.ConsommationKz(CurrentPlane.Consommation, DataFly.Distance);

                if (Flights != null)
                {
                    DataFly.IdFly = Flights.LastOrDefault().IdFly + 1;
                    Flights.Add(DataFly);
                    HttpContext.Session.SetObjectAsJson("DataFlights", Flights);
                }
                else
                {
                    DataFly.IdFly = 1;
                    List <Fly> NewFlight = new List <Fly>
                    {
                        DataFly
                    };
                    HttpContext.Session.SetObjectAsJson("DataFlights", NewFlight);
                }
                response.IsSuccess = true;
            }
            catch (Exception)
            {
                response.IsSuccess = false;
            }
            return(Json(response));
        }
Esempio n. 16
0
    public List <plane> getplane()
    {
        List <plane>  ret = new List <plane>();
        plane         pl;
        string        command = "SELECT * FROM [Plane]";
        SqlCommand    com     = new SqlCommand(command, con);
        SqlDataReader reader;

        con.Open();
        reader = com.ExecuteReader();
        while (reader.Read())
        {
            pl        = new plane();
            pl.id     = reader.GetInt32(0);
            pl.pname  = reader.GetString(1);
            pl.pmodel = reader.GetString(2);
            pl.seats  = reader.GetInt32(3);
            ret.Add(pl);
        }
        reader.Close();
        con.Close();
        return(ret);
    }
Esempio n. 17
0
        /*
         * This small example creates a line and a plane from points.
         * It then computes the intersection point of the line and the plane.
         *
         * In this step, the 'reportUsage' functionality is used to extract what
         * specialized functions and types are missing.
         */
        static void Main(string[] args)
        {
            // get five points
            normalizedPoint linePt1  = c3ga.cgaPoint(1.0f, 0.0f, 0.0f);
            normalizedPoint linePt2  = c3ga.cgaPoint(1.0f, 1.0f, 0.0f);
            normalizedPoint planePt1 = c3ga.cgaPoint(1.0f, 2.0f, 0.0f);
            normalizedPoint planePt2 = c3ga.cgaPoint(1.0f, 2.0f, 1.0f);
            normalizedPoint planePt3 = c3ga.cgaPoint(0.0f, 2.0f, 1.0f);

            // output text the can be copy-pasted into GAViewer
            Console.WriteLine("linePt1 = " + linePt1 + ",");
            Console.WriteLine("linePt2 = " + linePt2 + ",");
            Console.WriteLine("planePt1 = " + planePt1 + ",");
            Console.WriteLine("planePt2 = " + planePt2 + ",");
            Console.WriteLine("planePt3 = " + planePt3 + ",");

            // create line and plane out of points
            //line L = new line(linePt1 ^ (linePt2 ^ c3ga.ni));
            line L = new line(c3ga.op(linePt1, c3ga.op(linePt2, c3ga.ni))); // alternative, no explicit conversion required

            //plane P = new plane(planePt1 ^ (planePt2 ^ (planePt3 ^ c3ga.ni)));
            plane P = new plane(c3ga.op(planePt1, c3ga.op(planePt2, c3ga.op(planePt3, c3ga.ni)))); // alternative, no explicit conversion required

            // output text the can be copy-pasted into GAViewer
            Console.WriteLine("L = " + L + ",");
            Console.WriteLine("P = " + P + ",");

            // compute intersection of line and plane
            flatPoint intersection = new flatPoint(c3ga.lc(c3ga.dual(L), P));

            Console.WriteLine("intersection = " + intersection + ",");

            // output what functions could be optimized
            bool includeCount = true;

            Console.Write(ReportUsage.GetReport(includeCount));
        }
Esempio n. 18
0
    void ready_()
    {
        print("ready_");

        toggle = GameObject.Instantiate(perfab_pressedObj, Vector3.zero, new Quaternion());

        pressedObj = toggle.transform.GetChild(0).gameObject;

        toggle.SetActive(true);

        plane_ = GameObject.Instantiate(perfab_plane, new Vector3(birth_pos.x, birth_pos.y), new Quaternion());
        plane p = plane_.GetComponent <plane>();

        p.pressedObj = pressedObj;
        p.readyObj   = this.gameObject;
        p.pf_explode = perfab_explode;
        p.e_dead    += dead;
        gameObject.SetActive(false);


        RuntimeAnimatorController ctrl = app.loadFormAB <RuntimeAnimatorController>("plane_ab.ab", plane_types[type]);

        plane_.GetComponent <Animator>().runtimeAnimatorController = ctrl;
    }
Esempio n. 19
0
 public static vec3 project(this plane pl, vec3 p)
 {
     return(p - ((pl.normal ^ p) + pl.d) * pl.normal);
 }
Esempio n. 20
0
        private void GetTextureRepeat(out float repeatTextureX, out float repeatTextureY, Texture2D texture, plane plane)
        {
            repeatTextureX = 1f;
            repeatTextureY = 1f;

            float textureRepeatMultiplier = 9f;

            if (textureRepeatBack && plane == plane.back || textureRepeatFront && plane == plane.front ||
                textureRepeatLeft && plane == plane.left || textureRepeatRight && plane == plane.right ||
                textureRepeatTop && plane == plane.top || textureRepeatBottom && plane == plane.bottom)
            {
                if (plane == plane.front || plane == plane.back)
                {
                    repeatTextureX = (entity.Size.X / texture.Width) * textureRepeatMultiplier;
                    repeatTextureY = (entity.Size.Y / texture.Height) * textureRepeatMultiplier;
                }
                else
                if (plane == plane.right || plane == plane.left)
                {
                    repeatTextureX = (entity.Size.Z / texture.Width) * textureRepeatMultiplier;
                    repeatTextureY = (entity.Size.Y / texture.Height) * textureRepeatMultiplier;
                }
                else
                if (plane == plane.top || plane == plane.bottom)
                {
                    repeatTextureX = (entity.Size.X / texture.Width) * textureRepeatMultiplier;
                    repeatTextureY = (entity.Size.Z / texture.Height) * textureRepeatMultiplier;
                }
            }
        }
Esempio n. 21
0
		return DISTANCE_PLANE_POINT(plane, point);
Esempio n. 22
0
 public static extern void vec3_mirror(out Vector3 dst, out Vector3 v, out plane p);
Esempio n. 23
0
 public static float Angle(plane a, plane b)
 {
     return(vec3.Angle(a.normal, b.normal));
 }
Esempio n. 24
0
 public static extern float vec3_plane_dist(out Vector3 v, out plane p);
Esempio n. 25
0
 public uint[] AddPlane(plane p, vec3 origin, vec2 size, vec2i step)
 {
     return(AddPlane(p, origin, size, step, vec3.forward));
 }
Esempio n. 26
0
        delegate void Write(string msg); // делегат

        static void Main(string[] args)
        {
            Console.WriteLine("Инициализация:\n");
            engine dvs   = new engine("no_name", 10, 100, 0, 1000);                     // конструктор со всеми параметрами
            engine dvs1  = new engine();
            cars   avto  = new cars("no_name", "no_color", 2020, 1000, 10, 50, dvs, 5); // конструктор со всеми параметрами
            cars   avto1 = new cars("no_name", "no_color", 2020, 10000, 20, 0, dvs1, 10);

            avto = (cars)avto1.Clone();// глубокое клонирование
            Write message = Message;

            AddTov(avto);// вызов метода где использ абстракт класс
            Console.WriteLine("Машина:");
            Console.WriteLine(avto);
            avto.zapravka(message);
            bool f;

            do
            {
                f = false;
                try { avto.Read(); }
                catch (FormatException ex)// обработка программного исключения
                {
                    f = true;
                    Console.WriteLine("Ошибка: " + ex.Message);
                    Console.WriteLine("Введите данные еще раз");
                }
                catch (Exception ex)// обработка пользовательского исключения
                {
                    f = true;
                    Console.WriteLine("Ошибка: " + ex.Message);
                    Console.WriteLine("Введите данные еще раз");
                }
            } while (f);
            Console.WriteLine("\nДанные после ввода:");
            Console.Write(avto);
            int probegAfterDrive = 0;

            avto.zapravka(message);
            try { probegAfterDrive = avto.Drive(10); }
            catch (Exception ex)// обработка пользовательского исключения
            {
                Console.WriteLine("Ошибка: " + ex.Message);
                Console.WriteLine("Завершение работы программы");
                Environment.Exit(1);
            }
            Console.Write("\nПробег после тест-драйва: ");
            Console.WriteLine(probegAfterDrive);
            try { avto.Modern(100, 200, 500); }
            catch (Exception ex)// обработка пользовательского исключения
            {
                Console.WriteLine("Ошибка: " + ex.Message);
                Console.WriteLine("Завершение работы программы");
                Environment.Exit(1);
            }
            Console.WriteLine("\n\nПосле модернизации:");
            Console.Write(avto);
            Sale <cars> NEWPRICE = new Sale <cars>(avto, 4);                          // создание объекта шаблоа класса

            Console.WriteLine("Цена со скидкой: " + NEWPRICE.GetPriceWithSale());     // метод получения цены со скидкой
            avto.Sell();                                                              // вызов базового метода продажи авто
            avto.Sell(4);                                                             // вызов метода производного класса
            Console.WriteLine("Самолет:");
            plane pl = new plane("no_name", "no_color", 2020, 1000, 10, 10000, 5, 0); // конструктор со всеми параметрами

            pl.zapravka(message);
            pl.zapravka(message);
            Console.WriteLine(pl);
            do
            {
                f = false;
                try { pl.Read(); }
                catch (FormatException ex)// обработка программного исключения
                {
                    f = true;
                    Console.WriteLine("Ошибка: " + ex.Message);
                    Console.WriteLine("Введите данные еще раз");
                }
                catch (Exception ex)// обработка пользовательского исключения
                {
                    f = true;
                    Console.WriteLine("Ошибка: " + ex.Message);
                    Console.WriteLine("Введите данные еще раз");
                }
            } while (f);
            Console.WriteLine("\nДанные после ввода:");
            Console.Write(pl);

            pl.Fly(1);
            Console.WriteLine("Налет (в часах) после полета: " + pl.HOURFLY);
            pl.Sell();
            Console.ReadLine();
        }
Esempio n. 27
0
 public static extern void matrix3_mirror(out matrix3 dst, out matrix3 m, out plane p);
Esempio n. 28
0
 public static extern void vec3_mirror(out Vector3 dst, out Vector3 v, out plane p);
Esempio n. 29
0
 public static extern float vec3_plane_dist(out Vector3 v, out plane p);
Esempio n. 30
0
        private List <CustomVertexFormat> HorizontalFace(Vector3 p1, Vector3 p2, Texture2D texture, plane plane)
        {
            List <CustomVertexFormat> vertices = new List <CustomVertexFormat>();

            Vector3 normal;

            GetNormal(out normal);

            float repeatTextureX;
            float repeatTextureY;

            GetTextureRepeat(out repeatTextureX, out repeatTextureY, texture, plane);

            vertices.Add(new CustomVertexFormat(new Vector3(p1.X, p1.Y, p1.Z), new Vector2(0, repeatTextureY), normal));
            vertices.Add(new CustomVertexFormat(new Vector3(p2.X, p1.Y, p1.Z), new Vector2(repeatTextureX, repeatTextureY), normal));
            vertices.Add(new CustomVertexFormat(new Vector3(p2.X, p2.Y, p2.Z), new Vector2(repeatTextureX, 0), normal));
            vertices.Add(new CustomVertexFormat(new Vector3(p1.X, p1.Y, p1.Z), new Vector2(0, repeatTextureY), normal));
            vertices.Add(new CustomVertexFormat(new Vector3(p2.X, p2.Y, p2.Z), new Vector2(repeatTextureX, 0), normal));
            vertices.Add(new CustomVertexFormat(new Vector3(p1.X, p1.Y, p2.Z), new Vector2(0, 0), normal));

            return(vertices);
        }
Esempio n. 31
0
    public static void Main()
    {
        int numRunways = 2;

        while (timePassed < 120)
        {
            int numIncomingArrival = randomGenerator();
            int numTransToTakeOff  = randomGenerator();

            Console.WriteLine("\nThe time is: " + Time());
            for (int counterArrive = numIncomingArrival; counterArrive > 0; counterArrive--)
            {
                NewPlane(planeAction.arrive);
            }

            for (int counterDepart = numTransToTakeOff; counterDepart > 0; counterDepart--)
            {
                NewPlane(planeAction.depart);
            }

            Console.WriteLine(numIncomingArrival + " planes requested to land.");
            Console.WriteLine(numTransToTakeOff + " planes requested to depart.");

            totalWaitTimeLand    += landingQ.Count * 5;
            totalWaitTimeTakeOff += takeOffQ.Count * 5;

            manageRunways(numRunways);

            List <int>  waitingToLand   = new List <int>();
            List <int>  waitingToDepart = new List <int>();
            IEnumerator eLanding        = landingQ.GetEnumerator();
            IEnumerator eDeparting      = takeOffQ.GetEnumerator();
            while (eLanding.MoveNext())
            {
                plane current = (plane)eLanding.Current;
                waitingToLand.Add(current.ID);
            }
            while (eDeparting.MoveNext())
            {
                plane current = (plane)eDeparting.Current;
                waitingToDepart.Add(current.ID);
            }
            Console.WriteLine("Planes waiting to land: {0}", string.Join(", ", waitingToLand));
            Console.WriteLine("Planes waiting to depart: {0}", string.Join(", ", waitingToDepart));


            timePassed  += 5;
            currentTime += 5;
        }

        totalWaitTimeLand    -= landingQ.Count * 5;
        totalWaitTimeTakeOff -= takeOffQ.Count * 5;

        int averageWaitLand    = totalWaitTimeLand / planesLanded;
        int averageWaitTakeOff = totalWaitTimeTakeOff / planesTakenOff;

        Console.WriteLine("\n\n\n\nSummary statistics: ");
        Console.WriteLine("Planes processed: " + planesProcesed);
        Console.WriteLine("Planes landed: " + planesLanded);
        Console.WriteLine("Planes taken off: " + planesTakenOff);
        Console.WriteLine("# of planes refused: " + planesRefused);
        Console.WriteLine("Average wait time to land: " + averageWaitLand);
        Console.WriteLine("Average wait time to take off: " + averageWaitTakeOff);
    }
Esempio n. 32
0
 public static vec3 project(this plane pl, vec2 v, vec3 origin, vec3[] basis)
 {
     return(origin + basis[0] * v.x + basis[1] * v.y);
 }
Esempio n. 33
0
        public static vec2 project(this plane pl, vec3 v, vec3 origin, vec3[] basis)
        {
            vec3 pv = pl.project(v) - origin;

            return(new vec2(pv ^ basis[0], pv ^ basis[1]));
        }