devNotes 5-20-16 lines, fills and fibonacci

Survey – Painting Code Base

stuff

Paint:

paintdfgdfg

Unity Project: Argos_Sphere_Networking – in AR_Dev/Archives

    public void OnPaintButtonDown()
    {
        if (userMovement.isCursorValid())
        {
            bPaintOn = true;
            iStartPaint = 0;

            currPE_Idx++;
            txtNumPaintElements.text = currPE_Idx.ToString();

            paintList.Add(Instantiate(paintElement));
            paintList[currPE_Idx].transform.SetParent(argos_Sphere.transform);
            paintList[currPE_Idx].transform.localPosition = Vector3.zero;

            Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);

            vLastLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            Vector3 vRotated = LocalRotation * vLastLoc;
            vLastLoc = vRotated;

            myPaintRotation = argos_Sphere.transform.rotation;
        }
    }
            if (bPaintOn)
            {
                vCurrLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
                Quaternion LocalRotation = myPaintRotation*Quaternion.Inverse(argos_Sphere.transform.rotation);
                vCurrLoc = LocalRotation *  vCurrLoc;

                if (vCurrLoc != vLastLoc)
                {
                    Vector3 len = vCurrLoc - vLastLoc;

                    if (len.magnitude > minPaintLen || iStartPaint<2)
                    {
                        Vector3 vFwd = userMovement.cursorTran.screenProjTrans.forward;

                        Vector3 vFwdRtd = LocalRotation * vFwd;

                        Vector3 vUp = Vector3.Cross(vFwdRtd, len );
                        vUp.Normalize();

                        v1curr = vCurrLoc + (lineWidth / 2f) * vUp;
                        v2curr = vCurrLoc - (lineWidth / 2f) * vUp;

                        //sWrite.WriteLine("len =" + v2last.ToString("F3") + " vFwdRtd =" + vFwdRtd.ToString("F3") + " vUp =" + vUp.ToString("F3") + " vLastLoc =" + vLastLoc.ToString("F3") + " vCurrLoc =" + vCurrLoc.ToString("F3"));

                        if (++iStartPaint > 2) //don't write 2 times though
                        {
                            paintList[currPE_Idx].AddQuad(v2last, v1last, v1curr, v2curr,selColor);
                            //sWrite.WriteLine("v0 =" + v2last.ToString("F3") + "v1 =" + v1last.ToString("F3") + "v2 =" + v1curr.ToString("F3") + "v3 =" + v2curr.ToString("F3"));
                        }
                        vLastLoc = vCurrLoc;

                        v1last = v1curr;
                        v2last = v2curr;

                        //if (currPE_Idx > -1 && paintList[currPE_Idx].Mdraft != null)
                        //    InfoLineTxt.text = " Pn = " + (paintList[currPE_Idx].Mdraft.triangles.Count / 2).ToString();
                    }
                }
            }

Quad

gfhdfghgfhfg

    public void OnLLQuadButtonDown()
    {
        if (userMovement.isCursorValid())
        {
            bLLQuadOn = true;
            txtButtonState.text = "LLQuad On";
            currQE_Idx++;
            txtNumLLQuadElements.text = currQE_Idx.ToString();

            PaintElement rectLLQuads = Instantiate(LLQuadElement);
            rectLLQuads.transform.SetParent(argos_Sphere.transform);
            rectLLQuads.transform.localPosition = Vector3.zero;
            LLQuadList.Add(rectLLQuads);

            Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);

            vLastLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            Vector3 vRotated = LocalRotation * vLastLoc;
            vLastLoc = vRotated;

            myQuadRotation = argos_Sphere.transform.rotation;
        }
    }
            if (bLLQuadOn)
            {
                vCurrLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
                Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);
                vCurrLoc = LocalRotation * vCurrLoc;

                if (vCurrLoc != vLastLoc)
                {
                    int currLatLong_Idx = argos_Sphere.getLLQuadIdx(vCurrLoc);
                    if (currLatLong_Idx != nDrawnLLQuadIdx)
                    {
                        mdScratch.Copy_MeshDraft(argos_Sphere.LLQuads[currLatLong_Idx].mdQuad);
                        mdScratch.Rotate(myQuadRotation);
                        mdScratch.Paint(selColor);
                        LLQuadList[currQE_Idx].AddMeshDraft(mdScratch);
                        nDrawnLLQuadIdx = currLatLong_Idx;
                    }
                }
                vLastLoc = vCurrLoc;

                //if (currQE_Idx > -1 && LLQuadList[currQE_Idx].Mdraft != null)
                    //InfoLineTxt.text = " Qn = " + (LLQuadList[currQE_Idx].Mdraft.triangles.Count / 2).ToString();
            }

Hex

fgddhgfhdh

    public void OnHexButtonDown()
    {
        if (userMovement.isCursorValid())
        {
            bHexOn = true;
            txtButtonState.text = "Hexagonal On";
            currHE_Idx++;
            txtHexElements.text = currHE_Idx.ToString();

            PaintElement HObj = Instantiate(HexElement);
            HObj.transform.SetParent(argos_Sphere.transform);
            HObj.transform.localPosition = Vector3.zero;
            HexQuadList.Add(HObj);

            Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);

            vLastLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            Vector3 vRotated = LocalRotation * vLastLoc;
            vLastLoc = vRotated;

            myHexRotation = argos_Sphere.transform.rotation;
        }
    }
            if (bHexOn)
            {
                vCurrLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
                Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);
                vCurrLoc = LocalRotation * vCurrLoc;

                if (vCurrLoc != vLastLoc)
                {
                    int cHIdx = argos_Sphere.getHexIdx(vCurrLoc);
                    if (cHIdx != nDrawnHexQuadIdx)
                    {
                        mdScratch.Copy_MeshDraft(argos_Sphere.HexQuads[cHIdx].mdH);
                        mdScratch.Rotate(myHexRotation);
                        mdScratch.Paint(selColor);
                        HexQuadList[currHE_Idx].AddMeshDraft(mdScratch);
                        nDrawnHexQuadIdx = cHIdx;

                        //if (currHE_Idx > -1 && HexQuadList[currHE_Idx].Mdraft != null)
                            //InfoLineTxt.text = " Hn = " + (HexQuadList[currHE_Idx].Mdraft.triangles.Count / 2).ToString();
                    }
                    vLastLoc = vCurrLoc;
                }
            }

Spawn

josdjofjodf3

uses – texture atlas

    public void onSpawnButtonDown()
    {
        if (userMovement.isCursorValid())
        {
            currSpn_Idx++;
            txtNumSpawnElements.text = currSpn_Idx.ToString();
            SpawnElement SObj = Instantiate(spawnElement);
            SObj.transform.SetParent(argos_Sphere.transform);
            SObj.transform.localPosition = Vector3.zero;
            SpawnList.Add(SObj);

            vCurrLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);
            Vector3 vRotated = LocalRotation * vCurrLoc;
            int cSpnHexGridIdxStart = argos_Sphere.getHexIdx(vRotated);

            mdScratch.Copy_MeshDraft(argos_Sphere.HexQuads[cSpnHexGridIdxStart].mdH);
            Quaternion snapRotation;
            snapRotation = argos_Sphere.transform.rotation;
            mdScratch.Rotate(snapRotation);
            SpawnList[currSpn_Idx].AddMeshDraft(mdScratch, cSpnHexGridIdxStart, currSpn_Idx % 6, snapRotation);
            txtButtonState.text = "Spawned at Reticle";
        }
    }
    void Update()
    {
        if (userMovement.isCursorValid())
        {
            //Update for Spawn Elements
            Vector3 v = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            int H = argos_Sphere.getHexIdx(v);

            if(currSpn_Idx > -1)//
            {
                foreach(SpawnElement s in SpawnList)
                {
                    s.update_from_PaintCtrl(v,H);
                }
            }

            if (bPaintOn)
            {
using UnityEngine;
using System.Collections;
using ProceduralToolkit;
using UnityEngine.UI;

using System.Collections.Generic;

public class SpawnElement : MonoBehaviour
{
    public ArgosSphere_Indexing Argos_Sphere;

    private Mesh mesh;

    MeshDraft mdSpawnQuads;
    Quaternion myStartRotation;

    public class Quad_Track
    {
        public float timer;
        public int type;
        public int iHAddess;
        public int xInc;
        public int yInc;
        public int currDirection;
    }

    public List<Quad_Track> qtSpawnList = new List<Quad_Track>();

    MeshDraft mdScratch; //Watch out for stepping on template Hex Quads

    float tAccum, tAccumPaintCtrl;

    int xInc, yInc;
    int xDiv;
    int yDiv;
    float dx;
    float dy;

    int currDirection;

    public MeshDraft Mdraft
    {
        get { return mdSpawnQuads; }
    }

    void Start ()
    {
        Argos_Sphere = (ArgosSphere_Indexing)FindObjectOfType(typeof(ArgosSphere_Indexing));

        tAccum = 0f;
        xInc = 0;
        yInc = 0;

        xDiv = 4;
        yDiv = 4;
        dx = 1f / xDiv;
        dy = 1f / yDiv;

        mdScratch = new MeshDraft();
    }

    // Update is called once per frame
    void Update ()
    {

    }

    public void update_from_PaintCtrl(Vector3 vReticleLoc, int iRetHexIdx)
    {
        tAccumPaintCtrl += Time.deltaTime;
        Vector2 v0, v1, v2, v3;

        for(int i = 0; i< qtSpawnList.Count; i++)
        {
            qtSpawnList[i].timer += Time.deltaTime;
            //Update Textures
            if (qtSpawnList[i].timer > .3f)
            {
                if (++qtSpawnList[i].xInc > xDiv - 1)
                {
                    qtSpawnList[i].xInc = 0;
                    if (++qtSpawnList[i].yInc > yDiv - 1)
                    {
                        qtSpawnList[i].yInc = 0;
                    }
                }
                v0.x = dx * qtSpawnList[i].xInc;            v0.y = 1f - (dy * qtSpawnList[i].yInc);
                v1.x = dx * qtSpawnList[i].xInc;            v1.y = 1f - (dy * (qtSpawnList[i].yInc + 1f));
                v2.x = dx * (qtSpawnList[i].xInc + 1f);     v2.y = 1f - (dy * qtSpawnList[i].yInc);
                v3.x = dx * (qtSpawnList[i].xInc + 1f);     v3.y = 1f - (dy * (qtSpawnList[i].yInc + 1));

                mdSpawnQuads.uv[i * 4 + 0] = v0;
                mdSpawnQuads.uv[i * 4 + 1] = v1;
                mdSpawnQuads.uv[i * 4 + 2] = v2;
                mdSpawnQuads.uv[i * 4 + 3] = v3;

                GetComponent<MeshFilter>().mesh = mdSpawnQuads.ToMesh();

                qtSpawnList[i].timer = 0f;
            }
        }
        if (tAccumPaintCtrl > .02f)
        {

            if (qtSpawnList.Count > 100) return;

            int currDir = qtSpawnList[qtSpawnList.Count - 1].currDirection;
            int hI = Argos_Sphere.getSpawnLoc(qtSpawnList[qtSpawnList.Count - 1].iHAddess, currDir);

            if (hI != -1)
            {
                mdScratch.Copy_MeshDraft(Argos_Sphere.HexQuads[hI].mdH);
                mdScratch.Rotate(myStartRotation);
                mdSpawnQuads.Add(mdScratch);

                v0.x = 0f;      v0.y = 1f;
                v1.x = 0f;      v1.y = 1f - dy;
                v2.x = dx;      v2.y = 1f;
                v3.x = dx;      v3.y = 1f - dy;

                int c = mdSpawnQuads.vertices.Count-4;
                mdSpawnQuads.uv = v0;
                mdSpawnQuads.uv = v1;
                mdSpawnQuads.uv = v2;
                mdSpawnQuads.uv = v3;

                GetComponent<MeshFilter>().mesh = mdSpawnQuads.ToMesh();

                Quad_Track qt = new Quad_Track();
                qt.iHAddess = hI;
                qt.type = 0;
                qt.timer = 0f;
                qt.xInc = 0;
                qt.yInc = 0;
                qt.currDirection = currDir;
                int rand;
                if(qtSpawnList.Count % 3 == 0)
                {
                    rand = Random.Range(0, 5);
                    if(rand != 3)
                        qt.currDirection += rand;
                    if (qt.currDirection > 5) qt.currDirection = 0;
                }
                qtSpawnList.Add(qt);
            }
            tAccumPaintCtrl = 0f;
        }
    }

    public void AddHexQuad(ArgosSphere_Indexing.H_Element H)
    {

    }

    public void AddMeshDraft(MeshDraft md, int hAddress,int direction,Quaternion snapRotation)
    {
        MeshFilter mf = GetComponent<MeshFilter>();
        if (mf.mesh == null)
            mf.mesh = new Mesh();
        mesh = mf.mesh;

        xDiv = 4;
        yDiv = 4;
        dx = 1f / xDiv;
        dy = 1f / yDiv;

        mdSpawnQuads = new MeshDraft();
        if (mdSpawnQuads != null)
        {
            myStartRotation =  snapRotation;
            mdSpawnQuads.Add(md);
            mdSpawnQuads.uv[0] = new Vector2(0f, 1f);
            mdSpawnQuads.uv[1] = new Vector2(0f, 1f-dy);
            mdSpawnQuads.uv[2] = new Vector2(dx, 1f);
            mdSpawnQuads.uv[3] = new Vector2(dx, 1f-dy);

            GetComponent<MeshFilter>().mesh = mdSpawnQuads.ToMesh();
            Quad_Track qt = new Quad_Track();
            qt.iHAddess = hAddress;
            qt.type = 0;
            qt.timer = 0f;
            qt.xInc = 0;
            qt.yInc = 0;
            qt.currDirection = direction;

            qtSpawnList.Add(qt);
        }
    }

    public void AddQuad(Vector3 v0, Vector3 v1, Vector3 v2, Vector3 v3)
    {

        if (mdSpawnQuads != null)
        {
            mdSpawnQuads.Add(MeshDraft.Quad(v0, v1, v2, v3));
            GetComponent<MeshFilter>().mesh = mdSpawnQuads.ToMesh();
            //mesh.RecalculateBounds();
        }        
    }
}

Slerp SpergsBurg

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;

public class ArgosHexLighter : MonoBehaviour
{
    public Slider sld_Variance;
    public Slider sld_PauseTime;
    public Slider sld_MoverTime;
    public Slider sld_NeighborSeeks;

    public Text VarianceText;
    public Text PauseTimeText;
    public Text MoverTimeText;
    public Text NeighborSeeksText;

    public float moveTime = 4.0f;
    public float pauseTime = 2.0f;
    public float variance = 0.1f;
    public int neighborSeeks = 10;
    ArgSphereUtility asu;
    public GameObject hexPrefab;
    public GameObject quadPrefab;
    GameObject ArgosSphere;
    ArgosSphere_Indexing asi;

    public Color quadColor;

    void Start ()
    {
        asu = GetComponent<ArgSphereUtility>();

        ArgosSphere = GameObject.Find("Argos_Sphere");
        asi = ArgosSphere.GetComponent<ArgosSphere_Indexing>();


        asu.init();
        init_mover();
    }

    //Slider sld_Variance;
    //Slider sld_PauseTime;
    //Slider sld_MoverTime;

    //Text VarianceText;
    //Text PauseTimeText;
    //Text MoverTimeText;

    public void onSliderVariance()
    {
        variance = sld_Variance.value;
        VarianceText.text = "Variance = " + variance.ToString("F2");
    }

    public void onSliderPauseTime()
    {
        pauseTime = sld_PauseTime.value;
        PauseTimeText.text = "PauseTime = " + pauseTime.ToString("F1");
    }

    public void onSliderMoveTime()
    {
        moveTime = sld_MoverTime.value;
        MoverTimeText.text = "MoveTime = " + moveTime.ToString("F1");
    }

    public void onSliderNeighborSeeks()
    {
        if(sld_NeighborSeeks.value < 15)
        {
            neighborSeeks = (int)sld_NeighborSeeks.value;
        }
        else
        {
            neighborSeeks = 15 + (int)(sld_NeighborSeeks.value*40f);
        }

        
        NeighborSeeksText.text = "Neighbor Seeks = " + neighborSeeks.ToString();
    }


    public enum moverStates
    {
        Paused,
        Moving,
    };

    class ToFroms
    {
        public int hIdx;
        public Quaternion q0;
        public Quaternion q1;
        public int aIdx;
        public moverStates state;
        public float timer;
        public float pauseTime;
        public float movetime;
    }

    List<ToFroms> toFromList = new List<ToFroms>();

    void init_mover()
    {
        int idxStart;
        int idxEnd;
        Color col;
        Quaternion q0, q1;

        for (int i = 0; i < 300; i++)
        {
            idxStart = 4096 + Random.Range(-1000, 1000);

            int idx = idxStart;
            for (int j = 0; j < 5; j++)
            {
                idx = asi.HexQuads[idx].neighborLoc[Random.Range(0, 5)];
            }

            idxEnd = idx;
            col = getRandColor();
            asu.lightHex(idxStart, hexPrefab, col);

            ToFroms tf = new ToFroms();

            q0 = asi.HexQuads[idxStart].GetQuat();
            q1 = asi.HexQuads[idxEnd].GetQuat();
            tf.q1 = q1 * Quaternion.Inverse(q0);
            tf.q0 = Quaternion.identity;

            tf.aIdx = i;
            tf.hIdx = idxEnd;

            tf.state = moverStates.Paused;
            tf.timer = 0.0f;
            tf.pauseTime = pauseTime + Random.Range(-pauseTime * variance / 2, pauseTime * variance / 2);
            tf.movetime = moveTime + Random.Range(-moveTime * variance / 2, moveTime * variance / 2);

            toFromList.Add(tf);

        }
    }


    void Update()
    {
        Quaternion q0, q1;

        for (int i = 0; i < 300; i++)
        {
            toFromList[i].timer += Time.deltaTime;

            if (toFromList[i].state == moverStates.Paused)
            {
                toFromList[i].timer += Time.deltaTime;

                if (toFromList[i].timer > toFromList[i].pauseTime)
                {
                    toFromList[i].state = moverStates.Moving;
                    toFromList[i].timer = 0.0f;
                }
            }
            else //(toFromList[i].state == moverStates.Moveing)
            {
                float sTime = ElasticEaseInOut(toFromList[i].timer, 0.0f, 1.0f, toFromList[i].movetime);

                asu.aQuads[toFromList[i].aIdx].go.transform.rotation = Quaternion.LerpUnclamped(toFromList[i].q0, toFromList[i].q1, sTime);

                if (toFromList[i].timer > toFromList[i].movetime)
                {
                    asu.aQuads[toFromList[i].aIdx].go.transform.rotation = Quaternion.LerpUnclamped(toFromList[i].q0, toFromList[i].q1, 1.0f);
                    toFromList[i].state = moverStates.Paused;
                    toFromList[i].timer = 0.0f;

                    int idx = toFromList[i].hIdx;
                    int idxTest;
                    int idxStart, idxEnd;

                    int seeks = neighborSeeks + Random.Range((int)(-(float)(variance/2)*neighborSeeks), (int)((float)(variance / 2) * neighborSeeks)) ;

                    for (int j = 0; j < seeks; j++)//Let it randomly find the next point by searching through "seeks" neighbors
                    {
                        idxTest = asi.HexQuads[idx].neighborLoc[Random.Range(0, 6)];
                        if (idxTest > 1000 && idxTest < 7000) idx = idxTest;
                        else idx = toFromList[i].hIdx; 
                    }
                    idxStart = toFromList[i].hIdx;
                    idxEnd = idx;
                    toFromList[i].hIdx = idx;
                    q1 = asi.HexQuads[idxEnd].GetQuat();
                    q0 = asi.HexQuads[idxStart].GetQuat();
                    toFromList[i].q1 = q1 * Quaternion.Inverse(q0) * asu.aQuads[toFromList[i].aIdx].go.transform.rotation;
                    toFromList[i].q0 = asu.aQuads[toFromList[i].aIdx].go.transform.rotation;

                    toFromList[i].state = moverStates.Paused;
                    toFromList[i].timer = 0.0f;
                    toFromList[i].pauseTime = pauseTime + Random.Range(-pauseTime * variance / 2, pauseTime * variance / 2);
                    toFromList[i].movetime = moveTime + Random.Range(-moveTime * variance / 2, moveTime * variance / 2);
                }
            }
        }
    }

    //q0 = asi.HexQuads[3060].GetQuat();
    //q1 = asi.HexQuads[4064].GetQuat();
    //q2 =  q1* Quaternion.Inverse(q0);
    //q0 = Quaternion.identity;
    void init_OneOFF()
    {
        int idxStart;
        int idxEnd;
        Color col;
        Quaternion q0,q1;

        for (int i = 0; i < 30; i++)
        {
            idxStart = 4096 + Random.Range(-1000, 1000);

            int idx = idxStart;
            for (int j = 0; j<20; j++)
            {
                idx = asi.HexQuads[idx].neighborLoc[Random.Range(0, 5)];
            }
            idxEnd = idx;
            col = getRandColor();
            asu.lightHex(idxStart, hexPrefab, col);

            asu.lightHex(idxStart, hexPrefab, col);

            asu.lightHex(idxEnd, hexPrefab, col);

            ToFroms tf = new ToFroms();

            q0 = asi.HexQuads[idxStart].GetQuat();
            q1 = asi.HexQuads[idxEnd].GetQuat();
            tf.q0 = Quaternion.identity;
            tf.q1 = q1 * Quaternion.Inverse(q0);

            tf.aIdx = i * 3 + 1;
            tf.hIdx = idxStart;

            toFromList.Add(tf);
        }
    }

    float accumTime = 0.0f; 
    //void Update_OneOff()
    //{
    //    accumTime += Time.deltaTime;
    //    float linTime;
    //    float sTime;

    //    if(accumTime>2f)
    //    {
    //        linTime = (accumTime - 2f);

    //        for (int i = 0; i < 30; i++)
    //        {
    //            sTime = ElasticEaseInOut(linTime, 0.0f, 1.0f, durr);

    //            if (linTime > durr) sTime = 1.0f;

    //            asu.aQuads[toFromList[i].aIdx].go.transform.rotation = Quaternion.SlerpUnclamped(toFromList[i].q0, toFromList[i].q1, sTime);
    //        }
    //        if (accumTime > 2+durr) accumTime = 0;
    //    }    
    //}


    /// <summary>
    /// Easing equation function for an elastic (exponentially decaying sine wave) easing out: 
    /// decelerating from zero velocity.
    /// </summary>
    /// <param name="t">Current time in seconds.</param>
    /// <param name="b">Starting value.</param>
    /// <param name="c">Final value.</param>
    /// <param name="d">Duration of animation.</param>
    /// <returns>The correct value.</returns>
    public static float ElasticEaseOut(float t, float b, float c, float d)
    {
        if ((t /= d) == 1)
            return b + c;

        float p = d * 0.3f;
        float s = p / 4;

        return (c * Mathf.Pow(2, -10 * t) * Mathf.Sin((t * d - s) * (2 * Mathf.PI) / p) + c + b);
    }

    /// <summary>
    /// Easing equation function for an elastic (exponentially decaying sine wave) easing in: 
    /// accelerating from zero velocity.
    /// </summary>
    /// <param name="t">Current time in seconds.</param>
    /// <param name="b">Starting value.</param>
    /// <param name="c">Final value.</param>
    /// <param name="d">Duration of animation.</param>
    /// <returns>The correct value.</returns>
    public static float ElasticEaseIn(float t, float b, float c, float d)
    {
        if ((t /= d) == 1)
            return b + c;

        float p = d * 0.3f;
        float s = p / 4;

        return -(c * Mathf.Pow(2, 10 * (t -= 1)) * Mathf.Sin((t * d - s) * (2f * Mathf.PI) / p)) + b;
    }

    /// <summary>
    /// Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: 
    /// acceleration until halfway, then deceleration.
    /// </summary>
    /// <param name="t">Current time in seconds.</param>
    /// <param name="b">Starting value.</param>
    /// <param name="c">Final value.</param>
    /// <param name="d">Duration of animation.</param>
    /// <returns>The correct value.</returns>
    public static float ElasticEaseInOut(float t, float b, float c, float d)
    {
        if ((t /= d / 2) == 2)
            return b + c;

        float p = d * (0.3f * 1.5f);
        float s = p / 4;

        if (t < 1)
            return -0.5f * (c * Mathf.Pow(2, 10 * (t -= 1)) * Mathf.Sin((t * d - s) * (2 * Mathf.PI) / p)) + b;
        return c * Mathf.Pow(2, -10 * (t -= 1)) * Mathf.Sin((t * d - s) * (2 * Mathf.PI) / p) * 0.5f + c + b;
    }

    /// <summary>
    /// Easing equation function for an elastic (exponentially decaying sine wave) easing out/in: 
    /// deceleration until halfway, then acceleration.
    /// </summary>
    /// <param name="t">Current time in seconds.</param>
    /// <param name="b">Starting value.</param>
    /// <param name="c">Final value.</param>
    /// <param name="d">Duration of animation.</param>
    /// <returns>The correct value.</returns>
    public static float ElasticEaseOutIn(float t, float b, float c, float d)
    {
        if (t < d / 2)
            return ElasticEaseOut(t * 2, b, c / 2, d);
        return ElasticEaseIn((t * 2) - d, b + c / 2, c / 2, d);
    }

    Color getRandColor()
    {
        Color col;

        col.r = 0.4f + Random.Range(0.0f, 0.6f);
        col.g = 0.5f + Random.Range(0.0f, 0.5f);
        col.b = 0.1f + Random.Range(0.0f, 0.9f);
        col.a = 0.8f + Random.Range(0.0f, 0.2f);
        return col;
    }

    bool drawn = false;
    float numSpawned = 0;
    int quadIdx = 1536;

	void Update_Org ()
    {
        accumTime += Time.deltaTime;
        Color col;
        if (accumTime>1.0f && !drawn)
        {
            //HEX Quads
            //Draw 3 sets until done - (50 times ~ 1 second)
            for (int i = 0; i < 3; i++)
            {        
                int centerIdx = 4096 + Random.Range(-2048, 2048);
                asu.lightHexDuration(centerIdx, hexPrefab, getRandColor(), 4.0f + Random.Range(0f,2.5f));

                col = getRandColor();
                for(int j = 0; j<6; j++)
                {   
                    asu.lightHexDuration(asi.HexQuads[centerIdx].neighborLoc[j], hexPrefab, col,  8.0f + Random.Range(0f, .25f));
                }  
            }
            if (++numSpawned > 150)
            {
                drawn = true;
            }
        }
        //Quad Quads

        for (int i = 0; i < 2; i++)
        {
            asu.lightQuadDuration(quadIdx, quadPrefab, quadColor, 1.0f);
            if (++quadIdx > 2560) quadIdx = 1536;
        }

        if (drawn && accumTime > 14.0f)
        {
            drawn = false;
            accumTime = 0.0f;
            numSpawned = 0;
        }
    }
}
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using ProceduralToolkit;

public class ArgSphereUtility : MonoBehaviour
{
    GameObject argosSphere;
    ArgosSphere_Indexing asi;

    public class AqHold
    {
        public GameObject go;
        public MeshDraft md;
        public MeshFilter mf;
        public float lifeTime;
        public bool isTimed = false;
        public int id;
    }
    public List<AqHold> aQuads = new List<AqHold>();

    void Update()
    {
        for(int i = 0; i<aQuads.Count; i++)
        {
            if (aQuads[i].isTimed)
            {
                aQuads[i].lifeTime -= Time.deltaTime;
                if (aQuads[i].lifeTime < 0.0f)
                {
                    GameObject.Destroy(aQuads[i].go);
                    aQuads.RemoveAt(i);
                    i--;
                }
            }
        } 
    }

    public void init()
    {
        argosSphere = GameObject.Find("Argos_Sphere");
        asi = argosSphere.GetComponent<ArgosSphere_Indexing>();
    }
	
    public void initAqHold(AqHold aq)
    {
        MeshFilter mf = aq.go.GetComponent<MeshFilter>();
        if (mf.mesh == null)
            mf.mesh = new Mesh();
        aq.md = new MeshDraft();
    }

    public void lightHex(int hHaddress, GameObject hexPrefab)
    {
        GameObject aQuad = Instantiate(hexPrefab);
        aQuad.transform.SetParent(argosSphere.transform);
        aQuad.transform.position = argosSphere.transform.position;

        AqHold aQuadHold = new AqHold();
        aQuadHold.go = aQuad;

        initAqHold(aQuadHold);
        aQuadHold.md.Copy_MeshDraft(asi.HexQuads[hHaddress].mdH);
        aQuadHold.md.Rotate(argosSphere.transform.rotation);
        aQuadHold.go.GetComponent<MeshFilter>().mesh =  aQuadHold.md.ToMesh();

        aQuads.Add(aQuadHold);
    }

    public void lightHex(int hHaddress, GameObject hexPrefab, Color col)
    {
        GameObject aQuad = Instantiate(hexPrefab);
        aQuad.transform.SetParent(argosSphere.transform);
        aQuad.transform.position = argosSphere.transform.position;

        AqHold aQuadHold = new AqHold();
        aQuadHold.go = aQuad;

        initAqHold(aQuadHold);
        aQuadHold.md.Copy_MeshDraft(asi.HexQuads[hHaddress].mdH);
        aQuadHold.md.Rotate(argosSphere.transform.rotation);
        aQuadHold.md.Paint(col);
        aQuadHold.go.GetComponent<MeshFilter>().mesh = aQuadHold.md.ToMesh();

        aQuads.Add(aQuadHold);
    }

    public void lightHexDuration(int hHaddress, GameObject hexPrefab, Color col, float duration)
    {
        GameObject aQuad = Instantiate(hexPrefab);
        aQuad.transform.SetParent(argosSphere.transform);
        aQuad.transform.position = argosSphere.transform.position;

        AqHold aQuadHold = new AqHold();
        aQuadHold.go = aQuad;

        initAqHold(aQuadHold);
        aQuadHold.md.Copy_MeshDraft(asi.HexQuads[hHaddress].mdH);
        aQuadHold.md.Rotate(argosSphere.transform.rotation);
        aQuadHold.md.Paint(col);
        aQuadHold.go.GetComponent<MeshFilter>().mesh = aQuadHold.md.ToMesh();

        aQuadHold.lifeTime = duration;
        aQuadHold.isTimed = true;

        aQuads.Add(aQuadHold);
    }

    public void lightQuadDuration(int LLAdress, GameObject quadPrefab, Color col, float duration)
    {
        GameObject aQuad = Instantiate(quadPrefab);
        aQuad.transform.SetParent(argosSphere.transform);
        aQuad.transform.position = argosSphere.transform.position;

        AqHold aQuadHold = new AqHold();
        aQuadHold.go = aQuad;

        initAqHold(aQuadHold);
        aQuadHold.md.Copy_MeshDraft(asi.LLQuads[LLAdress].mdQuad);
        aQuadHold.md.Rotate(argosSphere.transform.rotation);
        aQuadHold.md.Paint(col);
        aQuadHold.go.GetComponent<MeshFilter>().mesh = aQuadHold.md.ToMesh();

        aQuadHold.lifeTime = duration;
        aQuadHold.isTimed = true;

        aQuads.Add(aQuadHold);
    }

}

UV Remapping

Particle Systems

Fibo_Rider

dfghdfghdfgh5

In UnityProject Argos_Sphere_Mapping.argos_fibonacci.unity

using UnityEngine;
using System.Collections;
using ProceduralToolkit;
using System.Collections.Generic;
using System.IO;


public class Fibo_Rider : MonoBehaviour
{
    StreamWriter sWrite;

    public ArgosMeshDraft_Fibonacci AMD_Base;

    List<GameObject> gO_List = new List<GameObject>();

    GameObject goMyPivot;
    GameObject goTweenFollower;

    Quaternion qStart;
    Quaternion qEnd;

    int m_startLoc;
    int m_toLoc;
    int m_deltLoc;
    int m_numPoints;
    float m_pathTime;

    public void initFromSpawner(int FibLoc, int delt, int numPoints, float pathTime )
    {
        //sWrite = new StreamWriter("Fibo_Rider4.csv");
        m_startLoc = FibLoc;
        m_deltLoc = delt;
        m_toLoc = FibLoc + delt;
        m_pathTime = pathTime;
        m_numPoints = numPoints;

        GameObject gFibSphere = GameObject.Find("Fibonacci_Sphere");
        ArgosFibonacci aF = gFibSphere.GetComponent<ArgosFibonacci>();
        AMD_Base = aF.aMF_Base;

        Quaternion q0, q1;

        q0 = Quaternion.LookRotation(AMD_Base.funcVerts[m_startLoc].vPos.normalized);
        q1 = Quaternion.LookRotation(AMD_Base.funcVerts[m_toLoc].vPos.normalized);
        transform.rotation = q0;
        transform.position = AMD_Base.funcVerts[FibLoc].vPos;

        goTweenFollower = transform.Find("TweenFollower").gameObject;

        goMyPivot = new GameObject();
        goMyPivot.transform.position = new Vector3(0, 0, 0);
        goMyPivot.transform.rotation = Quaternion.identity;

        transform.SetParent(goMyPivot.transform);
        goTweenFollower.transform.SetParent(transform);//this
        goTweenFollower.transform.position = Vector3.zero;

        qEnd = q1 * Quaternion.Inverse(q0);
        qStart = Quaternion.identity;

        iTween.MoveTo(goTweenFollower, iTween.Hash("x", 1, "time", m_pathTime, "easetype", "easeInOutBack", "onstart", "fibTweenStarted", "onstartparams", "FIB Rider Started...", "onupdate", "fibTweenUpdate", "onupdateparams", FibLoc.ToString(), "oncomplete", "fibTweenComplete", "oncompleteparams", "fib Tween DONE", "onCompleteTarget", gameObject, "onStartTarget", gameObject, "onUpdateTarget", gameObject));

        m_numPoints--;
    }

    void fibTweenStarted(string textToDisplay)
    {
        print("fibTween on Start " + textToDisplay);
    }

    int CBcount = 0;
    float fAccumTime = 0.0f;
    void fibTweenUpdate(string textToDisplay)
    {
        //print("fibTweenUpdate " + textToDisplay + " call count = " + CBcount.ToString() + " pos = " + goTweenFollower.transform.position.x.ToString("F3") + " deltaTime = " + Time.deltaTime.ToString("F3"));

        float sTime = goTweenFollower.transform.position.x;
        goMyPivot.transform.rotation = Quaternion.LerpUnclamped(qStart, qEnd, sTime);

        CBcount++;
    }

    void fibTweenComplete(string textToDisplay)
    {
        Quaternion q0, q1;

        goMyPivot.transform.rotation = Quaternion.LerpUnclamped(qStart, qEnd, 1.0f);

        if (--m_numPoints > 0)
        {
            q0 = Quaternion.LookRotation(AMD_Base.funcVerts[m_toLoc].vPos.normalized); 
            m_toLoc += m_deltLoc;
            q1 = Quaternion.LookRotation(AMD_Base.funcVerts[m_toLoc].vPos.normalized);

            qEnd = q1 * Quaternion.Inverse(q0) * goMyPivot.transform.rotation;
            qStart = goMyPivot.transform.rotation;

            goTweenFollower.transform.position = Vector3.zero;

            iTween.MoveTo(goTweenFollower, iTween.Hash("x", 1, "time", m_pathTime, "easetype", "easeInOutBack", "onstart", "fibTweenStarted", "onstartparams", "FIB Rider Started...", "onupdate", "fibTweenUpdate", "onupdateparams", m_toLoc.ToString(), "oncomplete", "fibTweenComplete", "oncompleteparams", "fib Tween DONE", "onCompleteTarget", gameObject, "onStartTarget", gameObject, "onUpdateTarget", gameObject));
        }
    }

	void Update ()
    {
	
	}
}

//public enum EaseType
//{
//    easeInQuad,
//    easeOutQuad,
//    easeInOutQuad,
//    easeInCubic,
//    easeOutCubic,
//    easeInOutCubic,
//    easeInQuart,
//    easeOutQuart,
//    easeInOutQuart,
//    easeInQuint,
//    easeOutQuint,
//    easeInOutQuint,
//    easeInSine,
//    easeOutSine,
//    easeInOutSine,
//    easeInExpo,
//    easeOutExpo,
//    easeInOutExpo,
//    easeInCirc,
//    easeOutCirc,
//    easeInOutCirc,
//    linear,
//    spring,
//    /* GFX47 MOD START */
//    //bounce,
//    easeInBounce,
//    easeOutBounce,
//    easeInOutBounce,
//    /* GFX47 MOD END */
//    easeInBack,
//    easeOutBack,
//    easeInOutBack,
//    /* GFX47 MOD START */
//    //elastic,
//    easeInElastic,
//    easeOutElastic,
//    easeInOutElastic,
//    /* GFX47 MOD END */
//    punch
//}

UI_Color

Allows queries to texture

    public void onColorSelected()
    {
        Color Color;
        Color = colorPicker.GetComponent<ColorPickerUnityUI>().value;
        selColor = Color;

        if (argosNetCam_Local != null)
        {
            argosNetCam_Local.CmdSetColor(Color);
        }

        colPanelSelectedColor.GetComponent<Image>().color = Color;
        txtButtonState.text = Color.ToString();
    }

Classic animation methodology

The “12 Laws” or 12 Basic Principles of Animation

Classic 2d Animation Process

 

 

popfghf

fibonacci-sunflower

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
using ProceduralToolkit;
using System.IO;

public class Paint_Controller : MonoBehaviour
{
    StreamWriter sWrite;

    public float minPaintLen = 0.01f;

    public Toggle togPaint;
    public Toggle togQuad;
    public Toggle togHex;

    public GameObject colorPicker;
    public GameObject colPanelSelectedColor;
    public Color selColor;

    public Text txtButtonState;

    public Text txtNumPaintElements;
    public Text txtNumLLQuadElements;
    public Text txtHexElements;
    public Text txtNumSpawnElements;

    public Text InfoLineTxt;

    public Slider widthSlide;
    public Text   SlideVal;

    //PreFabs for Types of Mesh Instancing
    public PaintElement paintElement; 
    public PaintElement LLQuadElement;
    public PaintElement HexElement;
    public SpawnElement spawnElement;

    public UserMovement userMovement;
    public ArgosSphere_Indexing argos_Sphere;

    private bool bPaintOn = false;
    private int iStartPaint = 0;
    private bool bLLQuadOn = false;
    private bool bHexOn = false;
    //spawn on not needed - instanced

    private int nDrawnLLQuadIdx = -1;
    private int nDrawnHexQuadIdx = -1;

    List<PaintElement> paintList   = new List<PaintElement>();
    List<PaintElement> LLQuadList  = new List<PaintElement>();
    List<PaintElement> HexQuadList = new List<PaintElement>();
    List<SpawnElement> SpawnList   = new List<SpawnElement>();

    int currPE_Idx = -1;
    int currQE_Idx = -1;
    int currHE_Idx = -1;
    int currSpn_Idx = -1;

    Vector3 vLastLoc;
    Vector3 vCurrLoc;

    Vector3 v1curr;
    Vector3 v2curr;

    Vector3 v1last;
    Vector3 v2last;

    float lineWidth = 0.025f;

    Quaternion myPaintRotation;
    Quaternion myQuadRotation;
    Quaternion myHexRotation;

    MeshDraft mdScratch; //Watch out for stepping on template Hex Quads

    GameObject goANC_Local;
    netCamMove argosNetCam_Local;

    // Use this for initialization
    void Start ()
    {
        mdScratch = new MeshDraft();
        selColor = Color.white;

        //sWrite = new StreamWriter("Argos_Cursor_Paint.txt");
    }

    void OnApplicationQuit()
    {
        //sWrite.Close();
    }

    public void Find_ArgosNet_Local_Inst()
    {
        goANC_Local = GameObject.Find("ArgosNet_Local");

        if (goANC_Local != null)
        {
            argosNetCam_Local = goANC_Local.GetComponent<netCamMove>();
            argosNetCam_Local.CmdSetLineWidth(widthSlide.value);
            argosNetCam_Local.CmdSetColor(selColor);
        }
    }

    public Vector3 getCursorPostiion()
    {
        return userMovement.cursorTran.pos;

    }

    public void OnSliderChanged()
    {
        if (argosNetCam_Local != null)
        {
            argosNetCam_Local.CmdSetLineWidth(widthSlide.value);
        }
        lineWidth = widthSlide.value;
        SlideVal.text = (100f*lineWidth).ToString("F1");
    }

    public void onColorSelected()
    {
        //Color Color;
        //Color = colorPicker.GetComponent<ColorPickerUnityUI>().value;
        //selColor = Color;

        //if (argosNetCam_Local != null)
        //{
        //    argosNetCam_Local.CmdSetColor(Color);
        //}

        //colPanelSelectedColor.GetComponent<Image>().color = Color;
        //txtButtonState.text = Color.ToString();
    }

    public void onPaintTogSwitched()
    {
        if(argosNetCam_Local != null)
        {
            argosNetCam_Local.CmdPaintRemote(togPaint.isOn);
        }
        if (togPaint.isOn == true)
        {
            OnPaintButtonDown();
        }
        else
        {
            OnPaintButtonUp();
        }
    }

    public void onQuadTogSwitched()
    {
        if (argosNetCam_Local != null)
        {
            argosNetCam_Local.CmdQuadRemote(togQuad.isOn);
        }

        if (togQuad.isOn == true)
        {
            OnLLQuadButtonDown();
        }
        else
        {
            OnLLQuadButtonUp();
        }
    }

    public void onHexTogSwitched()
    {
        if (argosNetCam_Local != null)
        {
            argosNetCam_Local.CmdHexRemote(togHex.isOn);
        }

        if (togHex.isOn == true)
        {
            OnHexButtonDown();
        }
        else
        {
            OnHexButtonUp();
        }
    }

    public void OnPaintButtonDown()
    {
        if (userMovement.isCursorValid())
        {
            bPaintOn = true;
            iStartPaint = 0;

            currPE_Idx++;
            txtNumPaintElements.text = currPE_Idx.ToString();

            paintList.Add(Instantiate(paintElement));
            paintList[currPE_Idx].transform.SetParent(argos_Sphere.transform);
            paintList[currPE_Idx].transform.localPosition = Vector3.zero;

            Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);

            vLastLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            Vector3 vRotated = LocalRotation * vLastLoc;
            vLastLoc = vRotated;

            myPaintRotation = argos_Sphere.transform.rotation;
        }
    }

    public void OnPaintButtonUp()
    {
        bPaintOn = false;
        txtButtonState.text = "Paint Off";
    }

    public void OnLLQuadButtonDown()
    {
        if (userMovement.isCursorValid())
        {
            bLLQuadOn = true;
            txtButtonState.text = "LLQuad On";
            currQE_Idx++;
            txtNumLLQuadElements.text = currQE_Idx.ToString();

            PaintElement rectLLQuads = Instantiate(LLQuadElement);
            rectLLQuads.transform.SetParent(argos_Sphere.transform);
            rectLLQuads.transform.localPosition = Vector3.zero;
            LLQuadList.Add(rectLLQuads);

            Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);

            vLastLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            Vector3 vRotated = LocalRotation * vLastLoc;
            vLastLoc = vRotated;

            myQuadRotation = argos_Sphere.transform.rotation;
        }
    }

    public void OnLLQuadButtonUp()
    {
        bLLQuadOn = false;
        txtButtonState.text = "LLQuad Off";
    }

    public void OnHexButtonDown()
    {
        if (userMovement.isCursorValid())
        {
            bHexOn = true;
            txtButtonState.text = "Hexagonal On";
            currHE_Idx++;
            txtHexElements.text = currHE_Idx.ToString();

            PaintElement HObj = Instantiate(HexElement);
            HObj.transform.SetParent(argos_Sphere.transform);
            HObj.transform.localPosition = Vector3.zero;
            HexQuadList.Add(HObj);

            Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);

            vLastLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            Vector3 vRotated = LocalRotation * vLastLoc;
            vLastLoc = vRotated;

            myHexRotation = argos_Sphere.transform.rotation;
        }
    }

    public void OnHexButtonUp()
    {
        bHexOn = false;
        txtButtonState.text = "Hexagonal Off";
    }

    public void onSpawnButtonDown()
    {
        if (userMovement.isCursorValid())
        {
            currSpn_Idx++;
            txtNumSpawnElements.text = currSpn_Idx.ToString();
            SpawnElement SObj = Instantiate(spawnElement);
            SObj.transform.SetParent(argos_Sphere.transform);
            SObj.transform.localPosition = Vector3.zero;
            SpawnList.Add(SObj);

            vCurrLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);
            Vector3 vRotated = LocalRotation * vCurrLoc;
            int cSpnHexGridIdxStart = argos_Sphere.getHexIdx(vRotated);

            mdScratch.Copy_MeshDraft(argos_Sphere.HexQuads[cSpnHexGridIdxStart].mdH);
            Quaternion snapRotation;
            snapRotation = argos_Sphere.transform.rotation;
            mdScratch.Rotate(snapRotation);
            SpawnList[currSpn_Idx].AddMeshDraft(mdScratch, cSpnHexGridIdxStart, currSpn_Idx % 6, snapRotation);
            txtButtonState.text = "Spawned at Reticle";
        }
    }

    // Update is called once per frame

    void Update()
    {
        if (userMovement.isCursorValid())
        {
            //Update for Spawn Elements
            Vector3 v = userMovement.cursorTran.pos - argos_Sphere.transform.position;
            int H = argos_Sphere.getHexIdx(v);

            if(currSpn_Idx > -1)//
            {
                foreach(SpawnElement s in SpawnList)
                {
                    s.update_from_PaintCtrl(v,H);
                }
            }

            if (bPaintOn)
            {
                vCurrLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
                Quaternion LocalRotation = myPaintRotation*Quaternion.Inverse(argos_Sphere.transform.rotation);
                vCurrLoc = LocalRotation *  vCurrLoc;

                if (vCurrLoc != vLastLoc)
                {
                    Vector3 len = vCurrLoc - vLastLoc;

                    if (len.magnitude > minPaintLen || iStartPaint<2)
                    {
                        Vector3 vFwd = userMovement.cursorTran.screenProjTrans.forward;

                        Vector3 vFwdRtd = LocalRotation * vFwd;

                        Vector3 vUp = Vector3.Cross(vFwdRtd, len );
                        vUp.Normalize();

                        v1curr = vCurrLoc + (lineWidth / 2f) * vUp;
                        v2curr = vCurrLoc - (lineWidth / 2f) * vUp;

                        //sWrite.WriteLine("len =" + v2last.ToString("F3") + " vFwdRtd =" + vFwdRtd.ToString("F3") + " vUp =" + vUp.ToString("F3") + " vLastLoc =" + vLastLoc.ToString("F3") + " vCurrLoc =" + vCurrLoc.ToString("F3"));

                        if (++iStartPaint > 2) //don't write 2 times though
                        {
                            paintList[currPE_Idx].AddQuad(v2last, v1last, v1curr, v2curr,selColor);
                            //sWrite.WriteLine("v0 =" + v2last.ToString("F3") + "v1 =" + v1last.ToString("F3") + "v2 =" + v1curr.ToString("F3") + "v3 =" + v2curr.ToString("F3"));
                        }
                        vLastLoc = vCurrLoc;

                        v1last = v1curr;
                        v2last = v2curr;

                        //if (currPE_Idx > -1 && paintList[currPE_Idx].Mdraft != null)
                        //    InfoLineTxt.text = " Pn = " + (paintList[currPE_Idx].Mdraft.triangles.Count / 2).ToString();
                    }
                }
            }
            if (bLLQuadOn)
            {
                vCurrLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
                Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);
                vCurrLoc = LocalRotation * vCurrLoc;

                if (vCurrLoc != vLastLoc)
                {
                    int currLatLong_Idx = argos_Sphere.getLLQuadIdx(vCurrLoc);
                    if (currLatLong_Idx != nDrawnLLQuadIdx)
                    {
                        mdScratch.Copy_MeshDraft(argos_Sphere.LLQuads[currLatLong_Idx].mdQuad);
                        mdScratch.Rotate(myQuadRotation);
                        mdScratch.Paint(selColor);
                        LLQuadList[currQE_Idx].AddMeshDraft(mdScratch);
                        nDrawnLLQuadIdx = currLatLong_Idx;
                    }
                }
                vLastLoc = vCurrLoc;

                //if (currQE_Idx > -1 && LLQuadList[currQE_Idx].Mdraft != null)
                //    InfoLineTxt.text = " Qn = " + (LLQuadList[currQE_Idx].Mdraft.triangles.Count / 2).ToString();
            }
            if (bHexOn)
            {
                vCurrLoc = userMovement.cursorTran.pos - argos_Sphere.transform.position;
                Quaternion LocalRotation = Quaternion.Inverse(argos_Sphere.transform.rotation);
                vCurrLoc = LocalRotation * vCurrLoc;

                if (vCurrLoc != vLastLoc)
                {
                    int cHIdx = argos_Sphere.getHexIdx(vCurrLoc);
                    if (cHIdx != nDrawnHexQuadIdx)
                    {
                        mdScratch.Copy_MeshDraft(argos_Sphere.HexQuads[cHIdx].mdH);
                        mdScratch.Rotate(myHexRotation);
                        mdScratch.Paint(selColor);
                        HexQuadList[currHE_Idx].AddMeshDraft(mdScratch);
                        nDrawnHexQuadIdx = cHIdx;

                        //if (currHE_Idx > -1 && HexQuadList[currHE_Idx].Mdraft != null)
                        //    InfoLineTxt.text = " Hn = " + (HexQuadList[currHE_Idx].Mdraft.triangles.Count / 2).ToString();
                    }
                    vLastLoc = vCurrLoc;
                }
            }
        }
    }
}