示例#1
0
        private static CurveDot CurveDotFromDots(Vector3 startPoint, Vector3 finalPoint)
        {
            var      angle     = Vector3.Angle(new Vector3(0, 1, 0), (finalPoint - startPoint).normalized);
            Vector3  direction = new Vector3(0, 0, ((startPoint.x < finalPoint.x) ? 90 - angle : angle + 90));
            CurveDot curveDot  = new CurveDot(startPoint, direction);

            return(curveDot);
        }
示例#2
0
        public Curve(Vector3[] curveDots)
        {
            CurveDot[] finalDots = new CurveDot[curveDots.Length];
            for (int i = 0; i < curveDots.Length - 1; i++)
            {
                finalDots[i] = CurveDotFromDots(curveDots[i], curveDots[i + 1]);
            }
            int count = curveDots.Length;

            finalDots[count - 1] = new CurveDot(curveDots[count - 1], finalDots[count - 2].Angle);
            CurveDots            = finalDots;
        }
示例#3
0
        public static Mesh LinesFromDots(Curve curve, float lineFatSize, bool autoRotate = true)
        {
            List <MeshSquare> squares = new List <MeshSquare>();

            if (curve.CurveDots == null)
            {
                return(null);
            }
            CurveDot curveDot     = curve.CurveDots[0];
            CurveDot curveDotNext = curve.CurveDots[1];

            squares.Add(new MeshSquare(curveDot.Point, curveDotNext.Point, curveDot.Angle, lineFatSize));
            for (int i = 1; i < curve.CurveDots.Length; i++)
            {
                curveDot     = curve.CurveDots[i - 1];
                curveDotNext = curve.CurveDots[i];
                squares.Add(new MeshSquare(curveDot.Point, curveDotNext.Point, curveDot.Angle, lineFatSize));
            }

            Mesh joinedSquares = JoinSquers(squares.ToArray(), lineFatSize);

            return(joinedSquares);
        }