Example #1
0
 void PinchRightDetected()
 {
     //Debug.Log("Pinch R Detected");
     nb_pinch += 1;
     if (cMenu.GetCurrentMenu() == CurrentMenu.Menu.Selection && cMenu.GetCurrentMenuSelection() == CurrentMenu.Selection.Modification)
     {
         LeapDeformation.PinchRightDetected();
     }
     //Debug.Log("JE SUIS LA!");
 }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (cMenu.GetCurrentMenu() == CurrentMenu.Menu.Creation &&
         Input.GetKeyDown("n"))
     {
         for (i = -20; i < 20; i++)
         {
             // Gets the prefab
             currentSelection = Instantiate(Resources.Load("Prefab/sphereMesh", typeof(GameObject))) as GameObject;
             //Modifies the position and scale
             currentSelection.transform.position   = new Vector3(i, 0, 0);
             currentSelection.transform.localScale = new Vector3(1, 1, 1);
             /* End here*/
         }
         for (i = -20; i < 20; i++)
         {
             // Gets the prefab
             currentSelection = Instantiate(Resources.Load("Prefab/sphereMesh", typeof(GameObject))) as GameObject;
             //Modifies the position and scale
             currentSelection.transform.position   = new Vector3(0, i, 0);
             currentSelection.transform.localScale = new Vector3(1, 1, 1);
             /* End here*/
         }
         for (i = -20; i < 20; i++)
         {
             // Gets the prefab
             currentSelection = Instantiate(Resources.Load("Prefab/sphereMesh", typeof(GameObject))) as GameObject;
             //Modifies the position and scale
             currentSelection.transform.position   = new Vector3(0, 0, i);
             currentSelection.transform.localScale = new Vector3(1, 1, 1);
             /* End here*/
         }
     }
 }
Example #3
0
        // Update is called once per frame
        void Update()
        {
            if (cMenu.GetCurrentMenu() == CurrentMenu.Menu.Statistics)
            {
                if (!StatisticsCanvas.enabled)
                {
                    // Enables the canvas
                    StatisticsCanvas.enabled = !StatisticsCanvas.enabled;

                    //Loads and displays the general statistics
                    pointCount        = pointCloud.GetLoadedPointsCount();
                    GeneralStats.text = "NUMBER OF POINTS : " + pointCount + "\n \n ";

                    //Loads and displays the dynamic statistics
                    volumes            = FindObjectsOfType <MeshDeformerMove>();
                    GeneralStats.text += "NUMBER OF MESHES : " + volumes.Length + "\n";
                    DynamicStats.text  = "THESE ARE THE MESHES YOU HAVE CREATED SO FAR :\n \n \n";
                    BoolStats.text     = "THESE ARE THE OPERATIONS YOU HAVE MADE SO FAR : \n \n \n";
                    List <List <DataPoint> > selectionSets = new List <List <DataPoint> >();
                    List <List <DataPoint> > boolSets      = new List <List <DataPoint> >();


                    for (int i = 0; i < volumes.Length; i++)
                    {
                        selectionSets.Add(ScatterPlot.GetSelectedPoints(volumes[i]));
                        DynamicStats.text += (" - Set number " + i + " contains : " + selectionSets[i].Count + " points \n");
                        DynamicStats.text += (" Average position of the points : " + AveragePosition(selectionSets[i]) + "\n");
                        DynamicStats.text += (" Position of the Mesh : " + volumes[i].transform.position + "\n");
                        DynamicStats.text += (" Dominant color : " + DominantColor(selectionSets[i]) + "\n \n");

                        //Saves a csv file
                        toCSV(selectionSets[i], "selection", i);
                    }

                    boolSets = boolOperation.GetOperationData();
                    for (int i = 0; i < boolSets.Count; i++)
                    {
                        BoolStats.text += (" - Operation number " + i + " contains : " + boolSets[i].Count + " points \n");
                        BoolStats.text += (" Average position of the points : " + AveragePosition(boolSets[i]) + "\n");
                        BoolStats.text += (" Dominant color : " + DominantColor(boolSets[i]) + "\n \n");

                        toCSV(boolSets[i], "booloperation", i);
                    }
                }
            }
            else
            {
                //Disables the canvas
                if (StatisticsCanvas.enabled)
                {
                    StatisticsCanvas.enabled = !StatisticsCanvas.enabled;
                }
            }
        }
Example #4
0
        //Update function with the Menu
        private void Update()
        {
            if (CurrentMenu.Menu.Selection == cMenu.GetCurrentMenu() && currentVolume != null)
            {
                if (CurrentMenu.Selection.SetOperation == cMenu.GetCurrentMenuSelection())
                {
                    switch (cMenu.GetCurrentMenuSetOperation())
                    {
                    case CurrentMenu.SetOperation.SetUnion:
                        if (test != 0)
                        {
                            BoolUpdate(OrBoolOperation);
                            test = 0;
                        }
                        break;

                    case CurrentMenu.SetOperation.SetIntersection:
                        if (test != 1)
                        {
                            BoolUpdate(AndBoolOperation);
                            test = 1;
                        }
                        break;

                    case CurrentMenu.SetOperation.SetRelativeComplement:
                        if (test != 2)
                        {
                            BoolUpdate(NotInBoolOperation);
                            test = 2;
                        }
                        break;

                    default:
                        if (cMenu.SetOperationIsConfirmed() && test != 3)
                        {
                            currentSelectedDataPoints = ScatterPlot.GetSelectedPoints(currentVolume);
                            currentSelectedDataPoints = BoolOperationMain(currentSelectedDataPoints);
                            OperationData.Add(new List <DataPoint>(currentSelectedDataPoints));
                            Coloration(currentSelectedDataPoints);
                            cMenu.ResetSetOperation();
                            test = 3;
                        }
                        break;
                    }
                }
            }
        }
Example #5
0
 // Update is called once per frame
 void Update()
 {
     if (cMenu.GetCurrentMenu() == CurrentMenu.Menu.Help_Options)
     {
         if (!helpOptionsCanvas.enabled)
         {
             helpOptionsCanvas.enabled = !helpOptionsCanvas.enabled;
         }
     }
     else
     {
         if (helpOptionsCanvas.enabled)
         {
             helpOptionsCanvas.enabled = !helpOptionsCanvas.enabled;
         }
     }
 }
Example #6
0
 //Update function that able/enable the display of axis
 public void Update()
 {
     if (cMenu.GetCurrentMenu() == CurrentMenu.Menu.Hide_Show)
     {
         if (!HS)
         {
             HS = !HS;
             Show();
             cMenu.SetMenu(CurrentMenu.Menu.NoMenuSelected);
         }
         else
         {
             HS = !HS;
             Hide();
             cMenu.SetMenu(CurrentMenu.Menu.NoMenuSelected);
         }
     }
     else
     {
     }
 }
Example #7
0
        private bool MenuManager() // MenuManager returns true if it changed a page
        {
            // Checks whether a button is pressed

            switch (cMenu.GetCurrentMenu())
            {
            case CurrentMenu.Menu.Selection:
            {
                switch (cMenu.GetCurrentMenuSelection())
                {
                case CurrentMenu.Selection.SetOperation:             // Set Operation Menu behavior
                {
                    if (ButtonCreation.isPressed || Input.GetKey("c"))
                    {
                        cMenu.ResetSetOperation();
                        cMenu.SetSetOperation(CurrentMenu.SetOperation.SetIntersection);
                        return(true);
                    }


                    if (ButtonSelection.isPressed || Input.GetKey("e"))
                    {
                        cMenu.ResetSetOperation();
                        cMenu.SetSetOperation(CurrentMenu.SetOperation.SetUnion);
                        return(true);
                    }

                    if (ButtonStatistics.isPressed || Input.GetKey("t"))
                    {
                        cMenu.ResetSetOperation();
                        cMenu.SetSetOperation(CurrentMenu.SetOperation.SetRelativeComplement);
                        return(true);
                    }

                    if (ButtonHide_Show.isPressed || Input.GetKey("h"))
                    {
                        cMenu.ConfirmSetOperation();
                        cMenu.SetSetOperation(CurrentMenu.SetOperation.NoOperation);
                        return(true);
                    }


                    if (ButtonHelp_Options.isPressed || Input.GetKey("o"))
                    {
                        cMenu.ResetSetOperation();
                        cMenu.SetSetOperation(CurrentMenu.SetOperation.Return);
                        cMenu.SetSelection(CurrentMenu.Selection.NoSelection);
                        cMenu.SetSetOperation(CurrentMenu.SetOperation.NoOperation);
                        return(true);
                    }

                    break;
                }

                default:             //Selection Menu behavior
                {
                    if (ButtonCreation.isPressed || Input.GetKey("c"))
                    {
                        cMenu.SetSelection(CurrentMenu.Selection.Modification);
                        return(true);
                    }

                    if (ButtonSelection.isPressed || Input.GetKey("e"))
                    {
                        cMenu.SetSelection(CurrentMenu.Selection.Erase);
                        return(true);
                    }


                    if (ButtonStatistics.isPressed || Input.GetKey("t"))
                    {
                        cMenu.SetSelection(CurrentMenu.Selection.SetOperation);
                        return(true);
                    }

                    if (ButtonHide_Show.isPressed || Input.GetKey("h"))
                    {
                        cMenu.SetSelection(CurrentMenu.Selection.Return);
                        cMenu.SetMenu(CurrentMenu.Menu.NoMenuSelected);
                        cMenu.SetSelection(CurrentMenu.Selection.NoSelection);
                        return(true);
                    }

                    break;
                }
                }
                break;
            }

            default:     // General Menu Behavior
            {
                if (ButtonCreation.isPressed || Input.GetKeyDown("c"))
                {
                    cMenu.SetMenu(CurrentMenu.Menu.Creation);
                    return(true);
                }

                if (ButtonSelection.isPressed || Input.GetKeyDown("e"))
                {
                    cMenu.SetMenu(CurrentMenu.Menu.Selection);
                    return(true);
                }

                if (ButtonStatistics.isPressed || Input.GetKeyDown("t"))
                {
                    /* For the statistics, press once the button to show the stats.
                     * Press it again to hide the stats
                     */

                    if (cMenu.GetCurrentMenu() == CurrentMenu.Menu.Statistics)
                    {
                        cMenu.SetMenu(CurrentMenu.Menu.NoMenuSelected);
                    }
                    else
                    {
                        cMenu.SetMenu(CurrentMenu.Menu.Statistics);
                    }
                    return(true);
                }

                if (ButtonHide_Show.isPressed || Input.GetKeyDown("h"))
                {
                    if (cMenu.GetCurrentMenu() == CurrentMenu.Menu.Hide_Show)
                    {
                        cMenu.SetMenu(CurrentMenu.Menu.NoMenuSelected);
                    }
                    else
                    {
                        cMenu.SetMenu(CurrentMenu.Menu.Hide_Show);
                    }
                    return(true);
                }

                if (ButtonHelp_Options.isPressed || Input.GetKeyDown("o"))
                {
                    /* For the help, press once the button to show the them.
                     * Press it again to hide the stats
                     */

                    if (cMenu.GetCurrentMenu() == CurrentMenu.Menu.Help_Options)
                    {
                        cMenu.SetMenu(CurrentMenu.Menu.NoMenuSelected);
                    }
                    else
                    {
                        cMenu.SetMenu(CurrentMenu.Menu.Help_Options);
                    }
                    return(true);
                }

                if (ButtonQuit.isPressed || Input.GetKeyDown("escape"))
                {
                    cMenu.SetMenu(CurrentMenu.Menu.Quit);
                    Application.Quit();
                    UnityEditor.EditorApplication.isPlaying = false;
                }

                break;
            }
            }

            return(false);
        }