// Start is called before the first frame update
    void Start()
    {
        var mul = 10.0f;

        var it = new CombinationIterator(8, coords.Count);
        var destVectorRichtingFoenestra = new Sv(expectedValues[0], expectedValues[1], expectedValues[2]);
        var destVectorTerug             = new Sv(-expectedValues[0], -expectedValues[1], -expectedValues[2]);

        var dest = destVectorRichtingFoenestra;

        var summedList = it
                         .Select(t => new { ItemsToSelect = it, Data = coords.GetElementsAt(t) })
                         .Select(t => new { ItemsToSelect = t.ItemsToSelect, Data = t.Data, Sum = SumSv(t.Data) })
                         .OrderBy(t => DistTwoVectors(dest, t.Sum.Normalized))
                         .ToList();

        float brrr = 1;

        foreach (var dist in summedList.Take(1))
        {
            var cur = Vector3.zero;
            foreach (var item in dist.Data)
            {
                DrawBol(cur * mul, (item.ToVector3() + cur) * mul, prefabje, new Color(1 - brrr, brrr, 0));
                cur = item.ToVector3() + cur;
            }

            DrawBol(cur * mul, dist.Sum.Normalized.ToVector3() * mul, prefabjeBlue, new Color(1 - brrr, brrr, 255));
            DrawLine(Vector3.zero, cur * mul, new Color(1 - brrr, brrr, 255));
            brrr = brrr - 0.1f;
        }
    }
示例#2
0
        /// <summary>
        ///     Returns true if Order instances are equal
        /// </summary>
        /// <param name="other">Instance of Order to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Order other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((Side == other.Side || Side != null && Side.Equals(other.Side)) &&
                   (Sv == other.Sv || Sv != null && Sv.Equals(other.Sv)) &&
                   (Pt == other.Pt || Pt != null && Pt.Equals(other.Pt)) &&
                   (Ot == other.Ot || Ot != null && Ot.Equals(other.Ot)) &&
                   (P == other.P || P != null && P.Equals(other.P)) &&
                   (Sc == other.Sc || Sc != null && Sc.Equals(other.Sc)) &&
                   (Rc == other.Rc || Rc != null && Rc.Equals(other.Rc)) &&
                   (S == other.S || S != null && S.Equals(other.S)) &&
                   (Pd == other.Pd || Pd != null && Pd.Equals(other.Pd)) &&
                   (Rac == other.Rac || Rac != null && Rac.Equals(other.Rac)) &&
                   (Md == other.Md || Md != null && Md.Equals(other.Md)) &&
                   (Sl == other.Sl || Sl != null && Sl.Equals(other.Sl)) &&
                   (Avp == other.Avp || Avp != null && Avp.Equals(other.Avp)) &&
                   (Sm == other.Sm || Sm != null && Sm.Equals(other.Sm)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)) &&
                   (Bsp == other.Bsp || Bsp != null && Bsp.Equals(other.Bsp)) &&
                   (Status == other.Status || Status != null && Status.Equals(other.Status)) &&
                   (Sr == other.Sr || Sr != null && Sr.Equals(other.Sr)) &&
                   (Cd == other.Cd || Cd != null && Cd.Equals(other.Cd)));
        }
示例#3
0
        static void Main(string[] args)
        {
            NccpcDll.NccpcNw1Cmn.stWsaStartup();

            var sv = new Sv();

            Console.WriteLine("server starting");

            if (!sv.create())
            {
                return;
            }

            Console.WriteLine("server started");

            bool bWhile = true;

            while (bWhile)
            {
                sv.framemove();

                System.Threading.Thread.Sleep(1000);
            }

            sv.release();

            NccpcDll.NccpcNw1Cmn.stWsaCleanup();
        }
    public decimal DistTwoVectors(Sv a, Sv b)
    {
        var x = Math.Abs(a.X - b.X);
        var y = Math.Abs(a.Y - b.Y);
        var z = Math.Abs(a.Z - b.Z);

        return(x + y + z);
    }
示例#5
0
        static void Main(string[] args)
        {
            QLSV qLSV = new QLSV();

            //create data
            Sv sv_add = new Sv {
                NameSv = "duyxxxx", Gender = true, Birthday = new DateTime(1998, 12, 12), Dtb = 8.0, IdLop = 2222
            };
            Lop lop = new Lop {
                IdLop = 2222, NameLop = "KTPM222"
            };

            // //get all sv
            Console.WriteLine("Hien thi danh sach sinh vien ");
            qLSV.DisplaySv();

            //get single sv
            Console.WriteLine("Hien thi 1 sinh vien ");
            qLSV.GetSingleSvById(100000);

            //Add sv
            Console.WriteLine("Them sinh vien ");
            qLSV.AddSv(sv_add);

            //update sv
            Console.WriteLine("Chinh sua sinh vien ");
            Sv sv_update = new Sv {
                NameSv = "Dinh Quang Duy", Gender = true, Birthday = new DateTime(1998, 03, 26), Dtb = 8.0, IdLop = 1
            };

            qLSV.UpdateSv(6, sv_update);

            //Delete sv
            Console.WriteLine("Xoa sinh vien ");
            qLSV.DeleteSvById(9);

            //Get all Lop
            Console.WriteLine("Hien thi danh sach lop ");
            qLSV.DisplayLop();

            //Add Lop
            Console.WriteLine("Them lop ");
            qLSV.AddLop(lop);

            //Update Lop
            Console.WriteLine("chinh sua lop ");
            Lop lop_update = new Lop {
                NameLop = "Kiem thu"
            };

            qLSV.UpdateLop(1, lop_update);

            //Delete lop
            Console.WriteLine("xoa lop ");
            qLSV.DeleteLopById(2222);
        }
示例#6
0
        public void UpdateSv(int mssv, Sv sv)
        {
            Sv sv_update = GetSingleSvById(mssv);

            sv_update.NameSv   = sv.NameSv;
            sv_update.Gender   = sv.Gender;
            sv_update.Birthday = sv.Birthday;
            sv_update.Dtb      = sv.Dtb;
            sv_update.IdLop    = sv.IdLop;
            db.SaveChanges();
        }
    // Start is called before the first frame update
    void Start()
    {
        var mul   = 10.0f;
        var dfoen = new Sv(expectedValues[0], expectedValues[1], expectedValues[2]);

        DrawBol(Vector3.zero, dfoen.ToVector3() * mul, prefabjeFoen, Color.red);

        foreach (var value in coords)
        {
            DrawBol(Vector3.zero, value.ToVector3() * mul, prefabje, Color.blue);
        }
    }
示例#8
0
 public void DeleteSvById(int mssv)
 {
     try
     {
         Sv sv_del = GetSingleSvById(mssv);
         db.Sv.Remove(sv_del);
         db.SaveChanges();
     }
     catch (System.Exception)
     {
         Console.WriteLine("Khong ton tai sinh vien co ma so " + mssv);
     }
 }
示例#9
0
        public Sv GetSingleSvById(int mssv)
        {
            Sv sv = null;

            try
            {
                sv = db.Sv.Where(p => p.Mssv == mssv).FirstOrDefault();
            }
            catch (System.Exception)
            {
                Console.WriteLine("Khong ton tai sinh vien co ma so " + mssv);
            }
            return(sv);
        }
示例#10
0
        public void predict_internal_measurement(Vector xv, MatrixFixed Pxx)
        {
            internal_measurement_model.func_hv_and_dhv_by_dxv(xv);

            hv.Update(internal_measurement_model.get_hvRES());
            dhv_by_dxv.Update(internal_measurement_model.get_dhv_by_dxvRES());

            internal_measurement_model.func_Rv(hv);
            Rv.Update(internal_measurement_model.get_RvRES());

            internal_measurement_model.func_Sv(Pxx, dhv_by_dxv, Rv);
            Sv.Update(internal_measurement_model.get_SvRES());

            //if (DEBUGDUMP) cout << "Internal measurement prediction: hv " << endl
            //<< hv << endl;
        }
示例#11
0
        static void Main(string[] args)
        {
            using (var db = new demoContext()){
                // truy van doi tuong
                //querty
                // var s = (from p in db.Sv select p).ToList();
                // var s = (from p in db.Sv select new { p.NameSv, p.IdLopNavigation.NameLop}).ToList();

                var s = from p in db.Sv where p.NameSv == "Duy" select new { p.NameSv, p.IdLopNavigation.NameLop };

                //method

                //var s1 = db.Sv.Select (p => new { p.NameSv, p.IdLopNavigation.NameLop}).ToList();
                var s1 = db.Sv.Where(p => p.NameSv == "Duy").Select(p => new { p.NameSv, p.IdLopNavigation.NameLop });

                //
                foreach (var i in s1)
                {
                    Console.WriteLine(i.NameSv);
                }
                //S1 HOAC S2
                //
                // foreach(var i in s){
                //      Console.WriteLine(i.NameSv + " " + i.NameLop);
                // }

                //==========================================================///
                // add
                //tao moi doi tuong
                Sv sv_add = new Sv {
                    Mssv = 5, NameSv = "duytesst", Gender = true, Birthday = new DateTime(1998, 12, 12), Dtb = 8.0, IdLop = 2222
                };
                //them doi tuong trong entitys
                db.Sv.Add(sv_add);
                // dong bo tu entity ve CSDL
                db.SaveChanges();

                //delete
                // int MSSV = 1;
                // var sv_del = db.Sv.Where(p => p.Mssv == MSSV).FirstOrDefault();
                // db.Sv.Remove(sv_del);
                // db.SaveChanges();
            }
        }
        public void Go4()
        {
            //for (int i = 8; i < 64; i++)
            //{
            //    var w = Stopwatch.StartNew();
            //    var itt = new CombinationIterator(8, i);
            //    var data = itt.ToList();
            //    w.Stop();
            //    Console.WriteLine($"{i}: duration: {w.Elapsed} length: {data.Count}");
            //}



            var it = new CombinationIterator(8, coords.Count);

            var destVectorRichtingFoenestra = new Sv(expectedValues[0], expectedValues[1], expectedValues[2]);
            var destVectorTerug             = new Sv(-expectedValues[0], -expectedValues[1], -expectedValues[2]);

            var dest = destVectorRichtingFoenestra;

            var summedList = it
                             .Select(t => new { ItemsToSelect = it, Data = coords.GetElementsAt(t) })
                             .Select(t => new { ItemsToSelect = t.ItemsToSelect, Data = t.Data, Sum = SumSv(t.Data) })
                             .OrderBy(t => DistTwoVectors(dest, t.Sum.Normalized))
                             .ToList();


            var testestje = coords.GetElementsAt(Enumerable.Range(0, 8)).ToList();
            var sum       = SumSv(testestje);
            var norm      = sum.Normalized;



            var sb = new StringBuilder();

            foreach (var val in summedList)
            {
                var line = $"{val.Sum.Normalized} ({DistTwoVectors(dest, val.Sum.Normalized)}) {val.Sum} ({string.Join(",", val.Data)})";
                sb.AppendLine(line);
                //Console.WriteLine(line);
            }
            File.WriteAllText("Outputje123123.txt", sb.ToString());
        }
示例#13
0
 public void AddSv(Sv sv_add)
 {
     db.Sv.Add(sv_add);
     db.SaveChanges();
 }
示例#14
0
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Side != null)
                {
                    hash = hash * 59 + Side.GetHashCode();
                }

                if (Sv != null)
                {
                    hash = hash * 59 + Sv.GetHashCode();
                }

                if (Pt != null)
                {
                    hash = hash * 59 + Pt.GetHashCode();
                }

                if (Ot != null)
                {
                    hash = hash * 59 + Ot.GetHashCode();
                }

                if (P != null)
                {
                    hash = hash * 59 + P.GetHashCode();
                }

                if (Sc != null)
                {
                    hash = hash * 59 + Sc.GetHashCode();
                }

                if (Rc != null)
                {
                    hash = hash * 59 + Rc.GetHashCode();
                }

                if (S != null)
                {
                    hash = hash * 59 + S.GetHashCode();
                }

                if (Pd != null)
                {
                    hash = hash * 59 + Pd.GetHashCode();
                }

                if (Rac != null)
                {
                    hash = hash * 59 + Rac.GetHashCode();
                }

                if (Md != null)
                {
                    hash = hash * 59 + Md.GetHashCode();
                }

                if (Sl != null)
                {
                    hash = hash * 59 + Sl.GetHashCode();
                }

                if (Avp != null)
                {
                    hash = hash * 59 + Avp.GetHashCode();
                }

                if (Sm != null)
                {
                    hash = hash * 59 + Sm.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (Bsp != null)
                {
                    hash = hash * 59 + Bsp.GetHashCode();
                }

                if (Status != null)
                {
                    hash = hash * 59 + Status.GetHashCode();
                }

                if (Sr != null)
                {
                    hash = hash * 59 + Sr.GetHashCode();
                }

                if (Cd != null)
                {
                    hash = hash * 59 + Cd.GetHashCode();
                }

                return(hash);
            }
        }