示例#1
0
        private bool checkForPointsInNodeList(NodeList <string> nodeList)
        {
            List <AbstractGeoObj> childGeoObjList = new List <AbstractGeoObj>();

            childGeoObjList.AddRange(bases.Cast <AbstractGeoObj>().ToList());
            childGeoObjList.AddRange(vertexPoints.Cast <AbstractGeoObj>().ToList());
            childGeoObjList.AddRange(sides.Cast <AbstractGeoObj>().ToList());

            return(nodeList.checkForMGOmatch(childGeoObjList));
        }
示例#2
0
        private bool checkForPointsInNodeList(NodeList <string> nodeList)
        {
            List <MasterGeoObj> masterList = new List <MasterGeoObj>();

            masterList.AddRange(bases.Cast <MasterGeoObj>().ToList());
            masterList.AddRange(vertexPoints.Cast <MasterGeoObj>().ToList());
            masterList.AddRange(sides.Cast <MasterGeoObj>().ToList());

            return(nodeList.checkForMGOmatch(masterList));
        }
示例#3
0
        internal override bool RMotion(NodeList <string> inputNodeList)
        {
            bool tempValue = false;

            foreach (AbstractPoint point in pointList)
            {
                if (point.GetComponent <StaticPoint>())
                {
                    tempValue = true;
                }
            }
            if (tempValue)
            {
                return(false);
            }

            if (thisIBehave.isGrasped)
            {
                Vector3 center = this.Position3;

                int pointNum = pointList.Count;

                MeshFilter mf   = GetComponent <MeshFilter>();
                Mesh       mesh = mf.mesh;

                int i = 0;
                foreach (AbstractPoint point in pointList)
                {
                    point.Position3 = this.transform.localPosition + vertices[i];
                    vertices[i]     = point.Position3 - center;
                    i++;
                }
                return(true);
            }
            else if (inputNodeList.checkForMGOmatch(pointListMGO))
            {
                int pointNum = pointList.Count;

                MeshFilter mf   = GetComponent <MeshFilter>();
                Mesh       mesh = mf.mesh;

                Quaternion angle = Quaternion.identity;


                if (!skewable && CheckSkewPolygon())
                {
                    Debug.LogWarning("This polygon " + figName + " is a skew polygon.");
                    AbstractGeoObj firstHit = inputNodeList.findMGOmatch(pointList.Cast <AbstractGeoObj>().ToList());

                    switch (firstHit.figType)
                    {
                    case GeoObjType.point:
                        //need to rotate every other point based ont the angle from the old point position and the center.
                        angle = angleAroundCenter(firstHit.Position3, vertices[pointList.FindIndex(x => x == firstHit.GetComponent <AbstractPoint>())]);
                        break;

                    case GeoObjType.line:
                        //need to rotate every other point based on the angle from the midpoint of the line segment and the center.
                        //need to address this case in the future.
                        break;

                    default:
                        break;
                    }
                }

                int i = 0;

                this.Position3 = center;
                foreach (AbstractPoint point in pointList)
                {
                    //move points with a rotation around the center.
                    if (inputNodeList.checkForMGOmatch(point))
                    {
                        vertices[i] = angle * (point.Position3 - center);
                    }
                    else
                    {
                        vertices[i] = (point.Position3 - center);
                        //don't rotate the point around the angle that has already moved.
                    }
                    i++;
                }

                bool isTrue = mesh.vertices == vertices;
                mesh.vertices = vertices;
                return(isTrue);
            }
            return(false);
        }