Example #1
0
 public ObjectModel(float id, bool isActive, VectorModel position, VectorModel rotation)
 {
     Id       = id;
     IsActive = isActive;
     Position = position;
     Rotation = rotation;
 }
Example #2
0
        public JsonResult AVectorSpaceModelSearch(string Query)
        {
            try {
                Dictionary <double, AQUESTION> Result = VectorModel.ArabicSearch(Query);

                var JsonRes = Result.Select(Q => new {
                    Question = Q.Value.VALUE,
                    Answer   = Q.Value.ANSWER,
                    Rank     = Math.Round(Q.Key, 3)
                }).OrderByDescending(R => R.Rank);

                return(Json(JsonRes, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                var line = GetLineNumber(e);

                var JsonRes = new
                {
                    Message       = e.Message,
                    innerExeption = e.InnerException.Message,
                    factor3       = e.Data.ToString(),
                    factor4       = e.InnerException.ToString(),
                    line          = line
                };

                return(Json(JsonRes, JsonRequestBehavior.AllowGet));
            }
        }
Example #3
0
 public PlayerModel(VectorModel position, VectorModel rotation, int coins, float health, float maxHealth)
 {
     Position  = position;
     Rotation  = rotation;
     Coins     = coins;
     Health    = health;
     MaxHealth = maxHealth;
 }
Example #4
0
 public DeathShip(Game game, Camera camera) : base(game, camera)
 {
     blades[0]    = new VectorModel(game, camera);
     blades[1]    = new VectorModel(game, camera);
     borderBounce = new BorderBounce(game, camera);
     shot         = new Shot(game, camera);
     shotTimer    = new Timer(game, 2);
 }
        private VectorModel GenerateVector(int vectorLength)
        {
            Random random = new Random();
            var    vector = new VectorModel();

            vector.Coordinates = GenerateCoordinates(random, vectorLength);
            return(vector);
        }
 private bool IsVertical(VectorModel vector)
 {
     if (vector.Start.x == vector.End.x)
     {
         return(false);
     }
     return(true);
 }
        private List <VectorModel> GenerateVectorsList(int vectorLength, int count)
        {
            var vectorsList = new List <VectorModel>();

            for (int i = 0; i < count; i++)
            {
                VectorModel vector = GenerateVector(vectorLength);
                vectorsList.Add(vector);
            }
            return(vectorsList);
        }
Example #8
0
        private double CalculateL1(VectorModel queryVector, VectorModel datasetVector)
        {
            //distance = Sum|qi-di|
            double sum = 0;

            foreach (var queryVectorCoordinate in queryVector.Coordinates)
            {
                foreach (var datasetVectorCoordinate in datasetVector.Coordinates)
                {
                    sum = sum + Math.Abs(queryVectorCoordinate - datasetVectorCoordinate);
                }
            }
            return(sum);
        }
        private void AddLine(VectorModel vector)
        {
            var mover = (int)_multiplier / 4 - 1;

            var x = Vectors.Where(x => ((x.Start.y <vector.Start.y && x.End.y> vector.Start.y) || (x.Start.y <vector.End.y && x.End.y> vector.End.y) || (x.Start.y == vector.Start.y && x.End.y == vector.End.y)) && x.Start.x == vector.Start.x && x.Id != vector.Id && !IsVertical(x) && !IsVertical(vector)).ToList();
            var y = Vectors.Where(x => ((x.Start.x <vector.Start.x && x.End.x> vector.Start.x) || (x.Start.x <vector.End.x && x.End.x> vector.End.x) || (x.Start.x == vector.Start.x && x.End.x == vector.End.x)) && x.Start.y == vector.Start.y && x.Id != vector.Id && IsVertical(x) && IsVertical(vector)).ToList();

            if (x.Count >= 1 && !IsVertical(vector))
            {
                vector.AddChange();
                if (x.Count % 2 != 0 || vector.GetChangeNumber() % 2 != 0)
                {
                    MoveVectorsWithId(vector.Id, -mover * (int)(x.Count + 1 / 2 + vector.GetChangeNumber() / 2), 0);
                }
                else
                {
                    MoveVectorsWithId(vector.Id, mover * (int)(x.Count / 2 + vector.GetChangeNumber() / 2), 0);
                }
                if (!this.Recheck.Where(x => x.Id == vector.Id).Any())
                {
                    foreach (var recheck in Vectors.Where(x => x.Id == vector.Id))
                    {
                        //if (!this.Recheck.Contains(recheck))
                        this.Recheck.Enqueue(recheck);
                    }
                }
            }

            if (y.Count >= 1 && IsVertical(vector))
            {
                vector.AddChange();
                if (y.Count % 2 != 0 || vector.GetChangeNumber() % 2 != 0)
                {
                    MoveVectorsWithId(vector.Id, 0, -mover * (int)(y.Count + 1) / 2);
                }
                else
                {
                    MoveVectorsWithId(vector.Id, 0, mover * (int)y.Count / 2);
                }

                if (!this.Recheck.Where(x => x.Id == vector.Id).Any())
                {
                    foreach (var recheck in Vectors.Where(x => x.Id == vector.Id))
                    {
                        //if (!this.Recheck.Contains(recheck))
                        this.Recheck.Enqueue(recheck);
                    }
                }
            }
        }
        private void DrawVector(VectorModel vector)
        {
            Line line = new System.Windows.Shapes.Line();

            line.StrokeThickness = _lineThickness;
            //line.Stroke = BrushesArray[vector.Id];
            line.Stroke = Brushes.Black;
            line.X1     = vector.Start.y + _rectangleWidth / 2 + 20;
            line.X2     = vector.End.y + _rectangleWidth / 2 + 20;
            line.Y1     = vector.Start.x + _rectangleHeight / 2 + 20;
            line.Y2     = vector.End.x + _rectangleHeight / 2 + 20;

            myCanvas.Children.Add(line);
        }
Example #11
0
        private double CalculateL2(VectorModel queryVector, VectorModel datasetVector)
        {
            //distance = root(Sum(qi-di)*(qi-di))
            double sum = 0;

            foreach (var queryVectorCoordinate in queryVector.Coordinates)
            {
                foreach (var datasetVectorCoordinate in datasetVector.Coordinates)
                {
                    sum = sum + (queryVectorCoordinate - datasetVectorCoordinate) * (queryVectorCoordinate - datasetVectorCoordinate);
                }
            }
            return(Math.Sqrt(sum));
        }
Example #12
0
    public SaveModel(int onLevel, VectorModel currentCheckpoint, bool hasKey, PlayerModel player)
    {
        OnLevel           = onLevel;
        CurrentCheckpoint = currentCheckpoint;
        HasKey            = hasKey;
        Player            = player;

        MovableObjects = new List <ObjectModel>();
        Haybales       = new List <ObjectModel>();
        FallingObjects = new List <FallingObjectModel>();
        TrapObjects    = new List <FallingObjectModel>();
        Enemies        = new List <EnemyModel>();
        Gates          = new List <GateModel>();
        Dashables      = new List <ObjectModel>();
        Coins          = new List <ObjectModel>();
        Checkpoints    = new List <ObjectModel>();
    }
Example #13
0
        static void Main()
        {
            if (!RuntimeManager.Bind(ProductCode.EngineOrDesktop))
            {
                MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down.");
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new A_Form1());

            #region CreateNodes
            //CreateNodes
            CreateNodes e = new CreateNodes();
            e.CreateNode();
            e.GetEveryKindSingleProbability();
            e.GetSurfaceNode();
            e.CreatFeatureClasses();
            e.CreatTINs();
            #endregion

            #region GetOriginal
            //GetOriginal
            GetOriginal g = new GetOriginal();
            g.GetTinData();
            g.GetSurfaceNormalVector();
            g.GetNodeNormalVector();
            g.GetNodeCurvature();
            g.CreateFeatureClass();
            g.CreateFeature();
            #endregion

            #region VectorModel
            //VectorModel
            VectorModel v = new VectorModel();
            for (int d = 0; d < VectorModel.TinCount; d++)
            {
                v.D = d;
                v.GetTinData(d);
                if (d == 0)
                {
                    //只需要一个
                    v.GetMeanInfo();
                }
                v.GetSurfaceNormalVector();
                v.GetNodeNormalVector();
                v.GetNodeCurvature();
                if (d == 0)
                {
                    //只需要一个
                    v.CreateFeatureClass();
                }
                v.CreateFeature();
            }
            #endregion

            //#region GravityVector
            ////GravityVector
            //GravityVector gv = new GravityVector();
            //for (int d = 0; d < VectorModel.TinCount; d++)
            //{
            //    gv.GetTinData(d);
            //    gv.GetVolume();
            //    gv.GetBarycentre();
            //    gv.CreatEnclose();
            //    if (d == 0)
            //    {
            //        //只需要一个
            //        gv.CreateFeatureClass();
            //    }
            //}
            //gv.CreateFeature();
            //#endregion
        }
        public static void initVectorEnviroment()
        {
            if (vectorEnviroment == null)
            {
                vectorEnviroment = new VectorModel[8][];
                for(int i=0;i<vectorEnviroment.Length;i++)
                {
                    vectorEnviroment[i]=new VectorModel[8];
                    for (int j = 0; j < vectorEnviroment[i].Length; j++)
                    {
                        vectorEnviroment[i][j] = new VectorModel();

                    }
                }
            }
        }
Example #15
0
 public GateModel(float id, bool isActive, VectorModel position, VectorModel rotation, bool isOpen) : base(id, isActive, position, rotation)
 {
     IsOpen = isOpen;
 }
Example #16
0
 public FallingObjectModel(float id, bool isActive, VectorModel position, VectorModel rotation, bool hasFallen) : base(id, isActive, position, rotation)
 {
     HasFallen = hasFallen;
 }
Example #17
0
 public EnemyModel(float id, bool isActive, VectorModel position, VectorModel rotation, float currentToughness, bool isStunned) : base(id, isActive, position, rotation)
 {
     CurrentToughness = currentToughness;
     IsStunned        = isStunned;
 }
 public void setValue(VectorModel model)
 {
     setValue(model.x1, model.y1, model.x2, model.y2, model.x3, model.y3, model.x4, model.y4);
 }
 public bool equalsValue(VectorModel model)
 {
     if(model==null)
     {
         return false;
     }
     return x1==model.x1&&y1==model.y1&&x2==model.x2&&y2==model.y2&&x3==model.x3&&y3==model.y3&&x4==model.x4&&y4==model.y4;
 }
Example #20
0
 private double CalculateHamming(VectorModel queryVector, VectorModel datasetVector)
 {
     return(double.MinValue);
     //todo calculate
 }
Example #21
0
 public PlayerShip(Game game, Camera camera) : base(game, camera)
 {
     PO.Radius = LoadVectorModel("PlayerShip", new Color(200, 200, 255));
     ship      = new VectorModel(game, camera);
 }