Example #1
0
        public void CalculateCurve()
        {
            if (ControlPoints.Count == 0)
            {
                BezierPoints = null;
                return;
            }

            var n = ControlPoints.Count - 1;

            var controlPointArray = ControlPoints.ToArray();

            BezierPoints    = new BezierPoint[Count];
            BezierPoints[0] = controlPointArray[0];

            var calcs = 1;

            for (var t = 1 / (decimal)Count; t <= ((decimal)Count - 1) / Count; t += 1 / (decimal)Count)
            {
                var result = new BezierPoint();

                for (var i = 0; i <= n; i++)
                {
                    result += (CalculateBinomial(n, i) * Math.Pow((double)t, i) * Math.Pow(1 - (double)t, n - i)) * controlPointArray[i];
                }

                BezierPoints[calcs++] = result;
            }

            BezierPoints[Count - 1] = controlPointArray[n];
        }
Example #2
0
 public ProjectorData GetProjectorData()
 {
     return(new ProjectorData
     {
         BlendData = new BlendSettings
         {
             MaxBlend = MaxBlend,
             BlacklevelOffset = BlacklevelOffset,
             Blacklevel2Offset = Blacklevel2Offset,
             CurvePoints = BlendCurve.GetCurvePoints()
         },
         ControlPoints = ControlPoints.ToArray(),
         BlendRegionControlPoints = BlendRegionControlPoints.ToArray(),
         BlacklevelControlPoints = BlacklevelControlPoints.ToArray(),
         Blacklevel2ControlPoints = Blacklevel2ControlPoints.ToArray()
     });
 }
Example #3
0
 public void Draw(Graphics g)
 {
     g.FillClosedCurve(Brush, ControlPoints.ToArray(), FillMode.Alternate, Tension);
 }