Пример #1
0
        /// <summary>
        /// Gets all the individual vector3 arrays for all the segments
        /// in the loft
        /// </summary>
        public void GetSegmentsPointsPath()
        {
            totalSegments = myPath.thePoints().Length;

            allSegmentsPoints = new Vector3[totalSegments][];

            Vector3 dir = new Vector3();

            //Get all the points
            for (int i = 0; i < allSegmentsPoints.Length; i++)
            {
                if (i != allSegmentsPoints.Length - 1)
                {
                    dir = Vector3.Normalize(myPath.thePoints()[i + 1] - myPath.thePoints()[i]);
                }
                else
                {
                    dir = Vector3.Normalize(myPath.thePoints()[i] - myPath.thePoints()[i - 1]);
                }
                allSegmentsPoints[i] = GetSegmentPointsAtPos(myPath.thePoints()[i], dir);
            }
        }
Пример #2
0
        /// <summary>
        /// Creates an internal version of the original shape
        /// This version contemplates wheter a segment is being used or not
        /// and also adds holdes whenever necessary
        /// </summary>
        void SetupShapeInterpretation()
        {
            myShapeVersion.Clear();
            //Debug.Log("starting shape interpretation");

            if (theShapeTransform != null)
            {
                //Create an array for each original Segment
                for (int i = 0; i < theShapeTransform.thePoints().Length - 1; i++)
                {
                    //Debug.Log("Adding empty array at index " + i);
                    myShapeVersion.Add(new Vector3[0]);
                }
            }
            else
            {
                //Create an array for each original Segment
                for (int i = 0; i < rectShape.Length; i++)
                {
                    //Debug.Log("Adding empty array at index " + i);
                    myShapeVersion.Add(new Vector3[0]);
                }
            }



            if (theShapeTransform != null)
            {
                //Now fill the point data for the segments that are currently active
                for (int o = 0; o < myShapeVersion.Count; o++)
                {
                    //Debug.Log("Adding points to current segment used index, " + currSegIndex);

                    myShapeVersion[o] = new Vector3[2];

                    //Add the first point
                    myShapeVersion[o][0] = rectShape[o];
                    //Debug.Log("Adding points to current segment used index, " + currSegIndex + " new point " + theShape.ThePoints[CurrSegments[currSegIndex]]);

                    //Add the second point depending on the position of the current point
                    if (o == rectShape.Length - 1)
                    {
                        myShapeVersion[o][1] = rectShape[0];
                        //Debug.Log("Adding points to current segment used index, " + currSegIndex + " new point " + theShape.ThePoints[0]);
                    }
                    else
                    {
                        myShapeVersion[o][1] = rectShape[o + 1];
                        //Debug.Log("Adding points to current segment used index, " + currSegIndex + " new point " + theShape.ThePoints[CurrSegments[currSegIndex] + 1]);
                    }
                }
            }
            else
            {
                //Now fill the point data for the segments that are currently active
                for (int currSegIndex = 0; currSegIndex < CurrSegments.Length; currSegIndex++)
                {
                    //Debug.Log("Adding points to current segment used index, " + currSegIndex);

                    myShapeVersion[CurrSegments[currSegIndex]] = new Vector3[2];

                    //Add the first point
                    myShapeVersion[CurrSegments[currSegIndex]][0] = rectShape[CurrSegments[currSegIndex]];
                    //Debug.Log("Adding points to current segment used index, " + currSegIndex + " new point " + theShape.ThePoints[CurrSegments[currSegIndex]]);

                    //Add the second point depending on the position of the current point
                    if (CurrSegments[currSegIndex] == rectShape.Length - 1)
                    {
                        myShapeVersion[CurrSegments[currSegIndex]][1] = rectShape[0];
                        //Debug.Log("Adding points to current segment used index, " + currSegIndex + " new point " + theShape.ThePoints[0]);
                    }
                    else
                    {
                        myShapeVersion[CurrSegments[currSegIndex]][1] = rectShape[CurrSegments[currSegIndex] + 1];
                        //Debug.Log("Adding points to current segment used index, " + currSegIndex + " new point " + theShape.ThePoints[CurrSegments[currSegIndex] + 1]);
                    }
                }

                //Now we fill the hole information for the

                //  Adding holes to a segment logic
                //
                //  -holes have a dist and a width
                //  -holes can never extend beyond the length of the original segment
                //  -holes can never have a negative start value
                SetupHoles();
            }
        }