Exemplo n.º 1
0
    public Spline()
    {
        AnchorPoints.Add(new Vector2(-1, 0));
        ControlPoints.Add(new ControlPointPair(NULL, new Vector2(-0.5f, -0.5f)));

        AnchorPoints.Add(new Vector2(1, 0));
        ControlPoints.Add(new ControlPointPair(new Vector2(0.5f, 0.5f), NULL));
    }
Exemplo n.º 2
0
    public void AddPoint(Vector2 newPoint)
    {
        Vector2          lastAnchorPoint  = AnchorPoints[AnchorPoints.Count - 1];
        ControlPointPair lastControlPoint = ControlPoints[ControlPoints.Count - 1];
        Vector2          distance         = lastAnchorPoint - lastControlPoint.leftControlPoint;

        lastControlPoint.rightControlPoint     = lastAnchorPoint + distance;
        ControlPoints[ControlPoints.Count - 1] = lastControlPoint;

        AnchorPoints.Add(newPoint);
        ControlPointPair newLastControlPointPair =
            new ControlPointPair(newPoint - distance, NULL);

        ControlPoints.Add(newLastControlPointPair);
    }