Example #1
0
        void SetupPath()
        {
            var tuple = VectorUtility.GetCircumCircle(Points);

            (cx, cy, Radius) = tuple;
            if (VectorUtility.IsLeft(Points))
            {
                Radius *= -1;
            }
        }
Example #2
0
        void CalcPoints()
        {
            if (Position.Count != 0)
            {
                throw new InvalidOperationException("Catmull was calculated twice!");
            }
            for (int i = 0; i < Order - 1; i++)
            {
                var t = 0d;
                while (t < Step - 1)
                {
                    var p1 = i >= 1 ? Points[i - 1] : Points[i];
                    var p2 = Points[i];

                    var p3 = i + 1 < Order ? Points[i + 1] : p2.Calc(1, p2.Calc(-1, p1));

                    var p4 = i + 2 < Order ? Points[i + 2] : p2.Calc(1, p3.Calc(-1, p2));
                    var pixels = new[] { p1, p2, p3, p4 }.ToList();
                    var p = VectorUtility.GetPoint(pixels, t);
                    Position.Add(p);
                    t += Step;
                }
            }
        }
Example #3
0
        public OsuPixel PointAtDistance(double length)
        {
            var radius = length / Radius;

            return(VectorUtility.Rotate(cx, cy, Points[0], radius));
        }