示例#1
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;
                }
            }
        }
示例#2
0
        int test;                                                 //Allow to choose only one menu at once

        //Save the first selection et the operation chosen
        private void BoolUpdate(Operator Method)
        {
            if (currentSelectedDataPoints.Count == 0)
            {
                selectedPoints = ScatterPlot.GetSelectedPoints(currentVolume);
            }
            else
            {
                foreach (DataPoint dp in currentSelectedDataPoints)
                {
                    selectedPoints.Add(dp);
                }
            }
            MethodOperator = Method;
        }
示例#3
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;
                    }
                }
            }
        }
示例#4
0
        /**
         * Unselect all vertices
         */
        public void UnselectVertices()
        {
            //if (DetectSelfIntersection())
            //{
            //    for (int i = 0; i < vertices.Length; i++)
            //    {
            //        if (selectedVertices[i])
            //            vertices[i] = originPos[i];
            //    }
            //    Debug.Log("Self intersection detected");
            //    UpdateMeshVertices();
            //}

            for (int i = 0; i < selectedVertices.Length; i++)
            {
                selectedVertices[i] = false;
            }

            // update collider, update point selected
            meshCollider.enabled = false;
            meshCollider.enabled = true;
            ScatterPlot.GetSelectedPoints(this);
        }