Ejemplo n.º 1
0
 public RageSplinePreviewData(RageSpline spline)
 {
     _points = new List <RageSplinePreviewPointData>();
     for (int i = 0; i <= spline.GetPointCount() - 1; i++)
     {
         var pointPosition = spline.GetPosition(i);
         if (i == 0)
         {
             _boundary = new Rect(pointPosition.x, pointPosition.y, 0, 0);
         }
         else
         {
             if (_boundary.xMin > pointPosition.x)
             {
                 _boundary.xMin = pointPosition.x;
             }
             if (_boundary.xMax < pointPosition.x)
             {
                 _boundary.xMax = pointPosition.x;
             }
             if (_boundary.yMin > pointPosition.y)
             {
                 _boundary.yMin = pointPosition.y;
             }
             if (_boundary.yMax < pointPosition.y)
             {
                 _boundary.yMax = pointPosition.y;
             }
         }
         _points.Add(new RageSplinePreviewPointData {
             Position     = pointPosition,
             StartTangent = spline.GetInControlPosition(i),
             EndTangent   = spline.GetOutControlPosition(i)
         });
     }
 }