Ejemplo n.º 1
0
        public static double[] corecurve(double[] x, double[] y)
        {
            var mx = new MWNumericArray(1, x.Length, x);
            var my = new MWNumericArray(1, y.Length, y);

            return((double[])((MWNumericArray)ToolHandler.corecurve(mx, my)).ToVector(MWArrayComponent.Real));
        }
Ejemplo n.º 2
0
 private void Awake()
 {
     movePlaceable = FindObjectOfType <MovePlaceable>();
     inventory     = FindObjectOfType <Inventory>();
     objectPooler  = FindObjectOfType <ObjectPooler>();
     toolHandler   = FindObjectOfType <ToolHandler>();
 }
Ejemplo n.º 3
0
        public static void Kands(MWNumericArray x, double pp, out double[] groupA, out double[] groupB)
        {
            var rlst = ToolHandler.Kands(2, x, pp);

            groupA = (double[])((MWNumericArray)rlst[0]).ToVector(MWArrayComponent.Real);
            groupB = (double[])((MWNumericArray)rlst[1]).ToVector(MWArrayComponent.Real);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 选择指定列的数据
 /// </summary>
 /// <param name="m"></param>
 /// <param name="idx"></param>
 /// <returns></returns>
 public static MWNumericArray SelectColumn(MWNumericArray m, int[] idx)
 {
     if (m == null)
     {
         throw new ArgumentNullException("");
     }
     return((MWNumericArray)ToolHandler.SelectColumn(m, (MWNumericArray)idx));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 在矩阵中第idx行之前插入一行
 /// </summary>
 /// <param name="m">矩阵</param>
 /// <param name="row">待插入的列</param>
 /// <param name="idx">序号,从1开始,如果在矩阵最后一行扩展,则idx = m.RowCount+1</param>
 /// <returns></returns>
 public static MWNumericArray InsertRow(MWNumericArray m, MWNumericArray row, int idx)
 {
     if (m == null || row == null)
     {
         throw new ArgumentNullException("");
     }
     if (m.Dimensions[1] != row.Dimensions[1])
     {
         throw new ArgumentException(string.Format("矩阵m.columncount = {0}, column.columncount = {1}", m.Dimensions[1], row.Dimensions[1]));
     }
     return((MWNumericArray)ToolHandler.InsertRow(m, row, idx));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 在矩阵中第idx列之前插入一列
 /// </summary>
 /// <param name="m">矩阵</param>
 /// <param name="column">待插入的列</param>
 /// <param name="idx">序号,从1开始,如果在矩阵最后一列扩展,则idx = m.ColumnCount+1</param>
 /// <returns></returns>
 public static MWNumericArray InsertColumn(MWNumericArray m, MWNumericArray column, int idx)
 {
     if (m == null || column == null)
     {
         throw new ArgumentNullException("");
     }
     if (m.Dimensions[0] != column.Dimensions[0])
     {
         throw new ArgumentException(string.Format("矩阵m.rowcount = {0}, column.rowcount = {1}", m.Dimensions[0], column.Dimensions[0]));
     }
     return((MWNumericArray)ToolHandler.InsertColumn(m, column, idx));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 移除矩阵中的某一行
 /// </summary>
 /// <param name="m">矩阵</param>
 /// <param name="idx">待移除的行序号,从1开始</param>
 /// <returns></returns>
 public static MWNumericArray RemoveRow(MWNumericArray m, int idx)
 {
     if (m == null)
     {
         throw new ArgumentNullException("");
     }
     if (idx < 1 || idx > m.Dimensions[0])
     {
         throw new ArgumentException(string.Format("m.rowcount = {0}, idx = {1}", m.Dimensions[0], idx));
     }
     return((MWNumericArray)ToolHandler.RemoveRow(m, idx));
 }
Ejemplo n.º 8
0
        public PaintGunMod(PaintGun_GameSession session) : base(MOD_NAME, session)
        {
            string msg = "### PaintGun v23";

            VRage.Utils.MyLog.Default.WriteLineAndConsole(msg);
            Log.Info(msg);

            session.SetUpdateOrder(MyUpdateOrder.AfterSimulation); // define what update types the modAPI session comp should trigger

            DisablePaintGunVanillaShoot();

            // Systems
            Caches            = new Caches(this);
            Constants         = new Constants(this);
            PlayerHandler     = new PlayerHandler(this);
            NetworkLibHandler = new NetworkLibHandler(this);

            if (IsPlayer)
            {
                TextAPI    = new TextAPI(this);
                DrawUtils  = new DrawUtils(this);
                GameConfig = new GameConfig(this);
            }

            // Features
            Palette  = new Palette(this);
            Painting = new Painting(this);

            if (IsPlayer)
            {
                CheckPlayerField      = new CheckPlayerField(this);
                Settings              = new Settings(this);
                PaletteInputHandler   = new PaletteInputHandler(this);
                PaletteScheduledSync  = new PaletteScheduledSync(this);
                HUDSounds             = new HUDSounds(this);
                LocalToolHandler      = new LocalToolHandler(this);
                LocalToolDescription  = new LocalToolDescription(this);
                SelectionGUI          = new SelectionGUI(this);
                ToolHandler           = new ToolHandler(this);
                ChatCommands          = new ChatCommands(this);
                Notifications         = new Notifications(this);
                PaletteHUD            = new PaletteHUD(this);
                ColorPickerGUIWarning = new ColorPickerGUIWarning(this);
                ConfigMenuHandler     = new ConfigMenuHandler(this);
            }

            if (Constants.EnableTestComponent)
            {
                TestComp = new TestComp(this);
            }
        }
        static void RegisterToolHandlers(ref Dictionary <Type, CinemachineSceneToolDelegates> tools,
                                         Type tool, ToolHandler toggleSetter, ToolHandler isDisplayedSetter)
        {
            if (tools.ContainsKey(tool))
            {
                tools.Remove(tool);
            }

            tools.Add(tool, new CinemachineSceneToolDelegates
            {
                ToggleSetter      = toggleSetter,
                IsDisplayedSetter = isDisplayedSetter,
            });
        }
Ejemplo n.º 10
0
        public static List <double[]> ydcaculate(double[] TBP, List <int[]> tmpPoint)
        {
            MWNumericArray p = new MWNumericArray(1, tmpPoint.First().Length, tmpPoint.First());

            for (int i = 1; i < tmpPoint.Count; i++)
            {
                p = InsertRow(p, tmpPoint[i], i + 1);
            }
            var arry   = ((MWNumericArray)ToolHandler.ydcaculate(new MWNumericArray(TBP.Length, 1, TBP), p));
            var resutl = new List <double[]>();

            for (int r = 0; r < arry.Dimensions[0]; r++)
            {
                resutl.Add((double[])SelectRow(arry, r + 1).ToVector(MWArrayComponent.Real));
            }

            return(resutl);
        }
Ejemplo n.º 11
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            PluginHandler.LoadPlugins();

            ToolHandler.LoadTools();

            //put this after loadplugins to avoid "where's reflector" dialog
            HostHandler.SetupAssemblyResolver();

            #region About & Update
            try
            {
                ShowAbout(false);
                CheckUpdate();
            }
            catch (Exception ex)
            {
                SimpleMessage.ShowException(ex);
            }
            #endregion About & Update
        }
Ejemplo n.º 12
0
 private void Awake()
 {
     toolHandler   = FindObjectOfType <ToolHandler>();
     movePlaceable = GetComponent <MovePlaceable>();
 }
Ejemplo n.º 13
0
 public static double[] Corelatn(MWNumericArray x, MWNumericArray y)
 {
     return((double[])((MWNumericArray)ToolHandler.Corelatn(x, y)).ToVector(MWArrayComponent.Real));
 }
 /// <summary>
 /// Use for registering tool handlers for tools that can be active anytime
 /// without taking other tools into consideration.
 /// </summary>
 /// <param name="tool">The tool to register.</param>
 /// <param name="toggleSetter">The tool's toggle value setter.</param>
 /// <param name="isDisplayedSetter">The tool's isDisplayed setter.</param>
 internal static void RegisterToolHandlers(Type tool, ToolHandler toggleSetter, ToolHandler isDisplayedSetter)
 {
     RegisterToolHandlers(ref s_Tools, tool, toggleSetter, isDisplayedSetter);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 保存Matlab矩阵
 /// </summary>
 /// <param name="m">矩阵</param>
 /// <param name="p">完整路径</param>
 /// <param name="name">保存matlab中的变量名称</param>
 public static void Save(MWNumericArray m, string p, string name)
 {
     ToolHandler.Save(m, p, name);
 }
Ejemplo n.º 16
0
        public static double DotProduct(double[] x)
        {
            var mx = new MWNumericArray(1, x.Length, x);

            return(((MWNumericArray)ToolHandler.DotProduct(mx)).ToScalarDouble());
        }
Ejemplo n.º 17
0
 public static double Mean(double[] x)
 {
     return(((MWNumericArray)ToolHandler.Mean((MWNumericArray)x)).ToScalarDouble());
 }
Ejemplo n.º 18
0
 public static MWNumericArray SetColumn(MWNumericArray m, MWNumericArray col, int idx)
 {
     return((MWNumericArray)ToolHandler.SetColumn(m, col, (MWArray)idx));
 }
Ejemplo n.º 19
0
 public static MWNumericArray SetRow(MWNumericArray m, MWNumericArray row, int idx)
 {
     return((MWNumericArray)ToolHandler.SetRow(m, row, (MWArray)idx));
 }
Ejemplo n.º 20
0
        void HandleFileChange(FileSystemEventArgs e)
        {
            string key = e.Name.ToLower();

            if (lastWrites.ContainsKey(key))
            {
                if ((DateTime.Now - lastWrites[key]).TotalSeconds < 1.0)
                {
                    //#if DEBUG
                    //                  SimpleMessage.ShowInfo("Ignored file change event: " + e.Name);
                    //#endif
                    lastWrites[key] = DateTime.Now;
                    return;
                }
                else
                {
                    lastWrites[key] = DateTime.Now;
                }
            }
            else
            {
                lastWrites.Add(key, DateTime.Now);
            }

            if (e.Name.Equals(ToolFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                ToolFile.Default.Clear();
                ToolHandler.LoadTools();
            }
            else if (e.Name.Equals(PatternFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                PatternFile.Default.Clear();
            }
            else if (e.Name.Equals(RegexFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                RegexFile.Default.Clear();
            }
            else if (e.Name.Equals(ExceptionHandlerFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                ExceptionHandlerFile.Default.Clear();
            }
            else if (e.Name.Equals(KeywordFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                KeywordFile.Default.Clear();
            }
            else if (e.Name.Equals(IgnoredMethodFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                IgnoredMethodFile.Default.Clear();
            }
            else if (e.Name.Equals(IgnoredTypeFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                IgnoredTypeFile.Default.Clear();
            }
            else if (e.Name.Equals(AttributeFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                AttributeFile.Default.Clear();
            }
            else if (e.Name.Equals(ProfileFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                ProfileFile.Default.Clear();
            }
            else if (e.Name.Equals(RandomFile.Default.FileName, StringComparison.OrdinalIgnoreCase))
            {
                RandomFile.Default.Clear();
            }

            if (TextFileChanged != null)
            {
                TextFileChanged(this, e);
            }
        }