public static float calcGuideDistance(this Vector3 v3, guideDistance GD, Vector3 startVect3, Vector3 currVector3, Vector3 endVector3)
 {
     return(lerpHelper.calcGuideDistance(startVect3, currVector3, endVector3, GD));
 }
 public static float calcGuideDistance(this Vector4 v4, guideDistance GD, Vector4 startVect4, Vector4 currVector4, Vector4 endVector4)
 {
     return(lerpHelper.calcGuideDistance(startVect4, currVector4, endVector4, GD));
 }
    //-----FUNCTION VERSIONS that use a dummy (non used) instance of 'whatever type you are lerping between'

    #region Calculate Guide Distance

    public static float calcGuideDistance(this float f, guideDistance GD, float startValue, float currValue, float endValue)
    {
        return(lerpHelper.calcGuideDistance(startValue, currValue, endValue, GD));
    }
 public static float calcGuideDistance(this Vector2 v2, guideDistance GD, Vector2 startVect2, Vector2 currVector2, Vector2 endVector2)
 {
     return(lerpHelper.calcGuideDistance(startVect2, currVector2, endVector2, GD));
 }
Beispiel #5
0
 /// <summary>
 /// You only need to fill in the values that guide distance is asking for
 /// the other parameter must be filled in but will not affect the result
 /// NOTE: guideDistance.other has no definition for anything but color
 /// EX: IF (your passed GD == guideDistance.distBetween_StartAndEnd) -> currValue(s) will not be used
 ///     because GD is only asking for a startValue(s) and endValue(s)
 /// </summary>
 public static float calcGuideDistance(Vector4 startVect4, Vector4 currVector4, Vector4 endVector4, guideDistance GD)
 {
     if (GD == guideDistance.distBetween_StartAndCurr)
     {
         return(Vector4.Distance(startVect4, currVector4));
     }
     else if (GD == guideDistance.distBetween_StartAndEnd)
     {
         return(Vector4.Distance(startVect4, endVector4));
     }
     else //guideDistance.distBetween_CurrAndEnd
     {
         return(Vector4.Distance(currVector4, endVector4));
     }
 }
        public static float calcGuideDistance(Color startColor, Color currColor, Color endColor, colorSpace CS, guideDistance GD)
        {
            switch (CS)
            {
            case colorSpace.RGB:

                if (GD == guideDistance.distBetween_StartAndCurr)
                {
                    return(colorDistances.distBetweenColors(startColor, currColor, colorSpace.RGB));
                }
                else if (GD == guideDistance.distBetween_StartAndEnd)
                {
                    return(colorDistances.distBetweenColors(startColor, endColor, colorSpace.RGB));
                }
                else if (GD == guideDistance.distBetween_CurrAndEnd)
                {
                    return(colorDistances.distBetweenColors(currColor, endColor, colorSpace.RGB));
                }
                else
                {
                    return(441.672956f);    // maxDistanceInRGBColorSpace
                }

            case colorSpace.RYB:

                if (GD == guideDistance.distBetween_StartAndCurr)
                {
                    return(colorDistances.distBetweenColors(startColor, currColor, colorSpace.RYB));
                }
                else if (GD == guideDistance.distBetween_StartAndEnd)
                {
                    return(colorDistances.distBetweenColors(startColor, endColor, colorSpace.RYB));
                }
                else if (GD == guideDistance.distBetween_CurrAndEnd)
                {
                    return(colorDistances.distBetweenColors(currColor, endColor, colorSpace.RYB));
                }
                else
                {
                    return(441.672956f);    //maxDistanceInRYBColorSpace
                }

            default:

                if (GD == guideDistance.distBetween_StartAndCurr)
                {
                    return(colorDistances.distBetweenColors(startColor, currColor, colorSpace.CMYK));
                }
                else if (GD == guideDistance.distBetween_StartAndEnd)
                {
                    return(colorDistances.distBetweenColors(startColor, endColor, colorSpace.CMYK));
                }
                else if (GD == guideDistance.distBetween_CurrAndEnd)
                {
                    return(colorDistances.distBetweenColors(currColor, endColor, colorSpace.CMYK));
                }
                else
                {
                    return(255);    //maxDistanceInCMYKColorSpace (because we have no accurate representation for 4D distance)
                }
            }
        }
Beispiel #7
0
 /// <summary>
 /// You only need to fill in the values that guide distance is asking for
 /// the other parameter must be filled in but will not affect the result
 /// NOTE: guideDistance.other has no definition for anything but color
 /// EX: IF (your passed GD == guideDistance.distBetween_StartAndEnd) -> currValue(s) will not be used
 ///     because GD is only asking for a startValue(s) and endValue(s)
 /// </summary>
 public static float calcGuideDistance(Vector2 startVect2, Vector2 currVector2, Vector2 endVector2, guideDistance GD)
 {
     if (GD == guideDistance.distBetween_StartAndCurr)
     {
         return(Vector2.Distance(startVect2, currVector2));
     }
     else if (GD == guideDistance.distBetween_StartAndEnd)
     {
         return(Vector2.Distance(startVect2, endVector2));
     }
     else //guideDistance.distBetween_CurrAndEnd
     {
         return(Vector2.Distance(currVector2, endVector2));
     }
 }
 public static float calcGuideDistanceAngle(this float f, float startAngle, float currAngle, float endAngle, guideDistance GD, wrapType wT)
 {
     return(lerpHelper.calcGuideDistanceAngle(startAngle, currAngle, endAngle, GD, wT));
 }
Beispiel #9
0
 /// <summary>
 /// You only need to fill in the values that guide distance is asking for
 /// the other parameter must be filled in but will not affect the result
 /// NOTE: guideDistance.other has no definition for anything but color
 /// EX: IF (your passed GD == guideDistance.distBetween_StartAndEnd) -> currValue(s) will not be used
 ///     because GD is only asking for a startValue(s) and endValue(s)
 /// </summary>
 public static float calcGuideDistance(Color startColor, Color currColor, Color endColor, guideDistance GD)
 {
     if (GD == guideDistance.distBetween_StartAndCurr)
     {
         return(distance(startColor, currColor));
     }
     else if (GD == guideDistance.distBetween_StartAndEnd)
     {
         return(distance(startColor, endColor));
     }
     else if (GD == guideDistance.distBetween_CurrAndEnd)
     {
         return(distance(currColor, endColor));
     }
     else
     {
         return(441.672956f); // maxDistanceInRGBColorSpace
     }
 }
Beispiel #10
0
        //-------------------------CALCULATE GUIDE DISTANCE-------------------------

        /// <summary>
        /// You only need to fill in the values that guide distance is asking for
        /// the other parameter must be filled in but will not affect the result
        /// NOTE: guideDistance.other has no definition for anything but color
        /// EX: IF (your passed GD == guideDistance.distBetween_StartAndEnd) -> currValue(s) will not be used
        ///     because GD is only asking for a startValue(s) and endValue(s)
        /// </summary>
        public static float calcGuideDistance(float startValue, float currValue, float endValue, guideDistance GD)
        {
            if (GD == guideDistance.distBetween_StartAndCurr)
            {
                return(Mathf.Abs(startValue - currValue));
            }
            else if (GD == guideDistance.distBetween_StartAndEnd)
            {
                return(Mathf.Abs(startValue - endValue));
            }
            else //guideDistance.distBetween_CurrAndEnd
            {
                return(Mathf.Abs(currValue - endValue));
            }
        }
Beispiel #11
0
 /// <summary>
 /// You only need to fill in the values that guide distance is asking for
 /// the other parameter must be filled in but will not affect the result
 /// NOTE: guideDistance.other has no definition for anything but color
 /// EX: IF (your passed GD == guideDistance.distBetween_StartAndEnd) -> currValue(s) will not be used
 ///     because GD is only asking for a startValue(s) and endValue(s)
 /// </summary>
 public static float calcGuideDistance(float[] startValues, float[] currValues, float[] endValues, guideDistance GD)
 {
     if (GD == guideDistance.distBetween_StartAndCurr)
     {
         return(euclideanDistance(startValues, currValues));
     }
     else if (GD == guideDistance.distBetween_StartAndEnd)
     {
         return(euclideanDistance(startValues, endValues));
     }
     else //guideDistance.distBetween_CurrAndEnd
     {
         return(euclideanDistance(currValues, endValues));
     }
 }
 public static float calcGuideDistance(this Color startColor, Color currColor, Color endColor, colorSpace CS, guideDistance GD)
 {
     return(colorLerpHelper.calcGuideDistance(startColor, currColor, endColor, CS, GD));
 }
Beispiel #13
0
    void lerpColors() //TODO... this must be repaired...
    {
        //----------Update The Colors programatically

        guideDistance GD = (largestDistanceLerp) ? guideDistance.distBetween_Other : guideDistance.distBetween_StartAndEnd;

        //-----RGB

        float guideDistRGB = colorLerpHelper.calcGuideDistance(startColor_RGB, currColor_RGB, endColor_RGB, colorSpace.RGB, GD);
        float lerpValueRGB = colorLerpHelper.calcLerpValue(startColor_RGB, currColor_RGB, endColor_RGB,
                                                           guideDistRGB,
                                                           timeToLerpDistance,
                                                           (timeTypeSecond) ? unitOfTime.seconds : unitOfTime.frames,
                                                           (fixedUpdateLerp) ? updateLocation.fixedUpdate : updateLocation.update,
                                                           colorSpace.RGB
                                                           );

        currColor_RGB = colorLerping.colorLerp(currColor_RGB, endColor_RGB, lerpValueRGB, colorSpace.RGB);

        //-----RYB

        float guideDistRYB = colorLerpHelper.calcGuideDistance(startColor_RYB, currColor_RYB, endColor_RYB, colorSpace.RYB, GD);
        float lerpValueRYB = colorLerpHelper.calcLerpValue(startColor_RYB, currColor_RYB, endColor_RYB,
                                                           guideDistRYB, //calculate guide distance [(largestDistanceLerp) ? guideDistance.distBetween_Other : guideDistance.distBetween_StartAndEnd]
                                                           timeToLerpDistance,
                                                           (timeTypeSecond) ? unitOfTime.seconds : unitOfTime.frames,
                                                           (fixedUpdateLerp) ? updateLocation.fixedUpdate : updateLocation.update,
                                                           colorSpace.RYB
                                                           );

        currColor_RYB = colorLerping.colorLerp(currColor_RYB, endColor_RYB, lerpValueRYB, colorSpace.RYB);

        //-----CMYK

        float guideDistCMYK = colorLerpHelper.calcGuideDistance(startColor_CMYK, currColor_CMYK, endColor_CMYK, colorSpace.CMYK, GD);
        float lerpValueCMYK = colorLerpHelper.calcLerpValue(startColor_CMYK, currColor_CMYK, endColor_CMYK,
                                                            guideDistCMYK, //calculate guide distance [(largestDistanceLerp) ? guideDistance.distBetween_Other : guideDistance.distBetween_StartAndEnd]
                                                            timeToLerpDistance,
                                                            (timeTypeSecond) ? unitOfTime.seconds : unitOfTime.frames,
                                                            (fixedUpdateLerp) ? updateLocation.fixedUpdate : updateLocation.update,
                                                            colorSpace.CMYK
                                                            );

        currColor_CMYK = colorLerping.colorLerp(currColor_CMYK, endColor_CMYK, lerpValueCMYK, colorSpace.CMYK);

        //----------Update The Colors Visually

        rgbLerpSampleGO.GetComponent <thickRefs>().updateColor(currColor_RGB);
        rybLerpSampleGO.GetComponent <thickRefs>().updateColor(currColor_RYB);
        cmykLerpSampleGO.GetComponent <thickRefs>().updateColor(currColor_CMYK);

        //---------Start and End Inversion because different color lerps will lerp at different paces

        if (Mathf.Approximately(1, lerpValueRGB) || lerpValueRGB > 1) //oscilate back to our other color
        {
            Color startColorCopy = startColor_RGB;
            startColor_RGB = endColor_RGB;
            endColor_RGB   = startColorCopy;
        }

        if (Mathf.Approximately(1, lerpValueRYB) || lerpValueRYB > 1) //oscilate back to our other color
        {
            Color startColorCopy = startColor_RYB;
            startColor_RYB = endColor_RYB;
            endColor_RYB   = startColorCopy;
        }

        if (Mathf.Approximately(1, lerpValueCMYK) || lerpValueCMYK > 1) //oscilate back to our other color
        {
            Color startColorCopy = startColor_CMYK;
            startColor_CMYK = endColor_CMYK;
            endColor_CMYK   = startColorCopy;
        }
    }
 public static float calcGuideDistance(this float[] fa, guideDistance GD, float[] startValues, float[] currValues, float[] endValues)
 {
     return(lerpHelper.calcGuideDistance(startValues, currValues, endValues, GD));
 }
Beispiel #15
0
 /// <summary>
 /// You only need to fill in the values that guide distance is asking for
 /// the other parameter must be filled in but will not affect the result
 /// NOTE: guideDistance.other has no definition for anything but color
 /// EX: IF (your passed GD == guideDistance.distBetween_StartAndEnd) -> currValue(s) will not be used
 ///     because GD is only asking for a startValue(s) and endValue(s)
 /// </summary>
 public static float calcGuideDistance(Vector3 startVect3, Vector3 currVector3, Vector3 endVector3, guideDistance GD)
 {
     if (GD == guideDistance.distBetween_StartAndCurr)
     {
         return(Vector3.Distance(startVect3, currVector3));
     }
     else if (GD == guideDistance.distBetween_StartAndEnd)
     {
         return(Vector3.Distance(startVect3, endVector3));
     }
     else //guideDistance.distBetween_CurrAndEnd
     {
         return(Vector3.Distance(currVector3, endVector3));
     }
 }
 public static float calcGuideDistance(this Color c, Color startColor, Color currColor, Color endColor, guideDistance GD)
 {
     return(lerpHelper.calcGuideDistance(startColor, currColor, endColor, GD));
 }
        /// <summary>
        /// You only need to fill in the values that guide distance is asking for
        /// the other parameter must be filled in but will not affect the result
        /// NOTE: guideDistance.other has no definition for anything but color
        /// EX: IF (your passed GD == guideDistance.distBetween_StartAndEnd) -> currValue(s) will not be used
        ///     because GD is only asking for a startValue(s) and endValue(s)
        /// </summary>
        public static float calcGuideDistanceAngle(float startAngle, float currAngle, float endAngle, guideDistance GD, wrapType wT)
        {
            float shortestDist;

            if (GD == guideDistance.distBetween_StartAndCurr)
            {
                shortestDist = Mathf.Abs(Mathf.DeltaAngle(startAngle, currAngle));
            }
            else if (GD == guideDistance.distBetween_StartAndEnd)
            {
                shortestDist = Mathf.Abs(Mathf.DeltaAngle(startAngle, endAngle));
            }
            else
            {
                shortestDist = Mathf.Abs(Mathf.DeltaAngle(currAngle, endAngle));
            }
            shortestDist = shortestDist % 360;
            return((wT == wrapType.shortest) ? shortestDist : 360 - shortestDist); //this should only return a value between 0 -> 360
        }