示例#1
0
    internal static Vector3 GetDefaultOutTangent(ShapeData shape, int pointId)
    {
        //TODO: fix all this
        if (shape.GetPolyPointCount() < 2)
        {
            return(Vector3.left);
        }

        if (shape.IsStrokeClosed || pointId < shape.GetPolyPointCount() - 1)
        {
            int otherId = MathUtils.CircularModulo(pointId + 1, shape.GetPolyPointCount());

            if (shape.GetPolyPointType(otherId) == ShapePointType.Corner)
            {
                return((shape.GetPolyPosition(otherId) - shape.GetPolyPosition(pointId)) * .333f);
            }
            else
            {
                return((shape.GetPolyPosition(otherId) + shape.GetPolyOutTangent(otherId) - shape.GetPolyPosition(pointId)) * .333f);
            }
        }
        else
        {
            return(-(shape.GetPolyPosition(pointId - 1) - shape.GetPolyPosition(pointId)) * .333f);
        }
    }