using System.Collections; using System.Collections.Generic; using UnityEngine; using ProceduralToolkit; using VRTK; using System.IO; using System; public class TetraHedron_4 : MonoBehaviour { public GameObject tetra_Prefab; public float radius = 2; public float beam_length = 2; private VRTK_InteractableObject interact; private HMD_Ctrl_Tracking hmd_Ctrl_Tracking; private GameObject tetra1; private GameObject tetra2; private GameObject tetra3; private GameObject tetra4; private GameObject tetra5; private List<GameObject> tetra_List = new List<GameObject>(); public float rotation = 0; List<Vector3> beam_List = new List<Vector3>(4); public bool bGenNext = false; public bool bRemoveLast = false; public int next_FB_Index = 0; public int next_face_Axis = 0; public float next_axis_angle = 0; StreamWriter sSequence; public class sequ_element { public int fb_Idx; public int face_axis; public float axis_angle; public void set(int idx,int fa, float aa) { fb_Idx = idx; face_axis = fa; axis_angle = aa; } } public List<sequ_element> sequence = new List<sequ_element>(); public int cIdx =0; void Start () { hmd_Ctrl_Tracking = HMD_Ctrl_Tracking.Instance; Vector3 position = new Vector3(0, 0, 0); Quaternion q = Quaternion.identity;//Quaternion.Euler(new Vector3(0, 1, 0)); tetra_List.Add(Instantiate(tetra_Prefab, position, q, transform)); sequ_element sequence_el = new sequ_element(); sequence_el.set(12, 12, 12); sequence.Add(sequence_el); setBeams(); sSequence = new StreamWriter("TOT_SEQUENCE_001.txt"); sSequence.WriteLine("// "); sSequence.WriteLine("// TOT_SEQUENCE - " + DateTime.Now.ToString("yyyy_MMdd_HHmmss")); sSequence.WriteLine("// "); } void Update () { if (bGenNext) { Quaternion q; GameObject go = Instantiate(tetra_Prefab); go.transform.parent = tetra_List[cIdx].transform; q = Quaternion.FromToRotation(Vector3.up, beam_List[next_FB_Index]); if (next_FB_Index == 0) { q *= Quaternion.Euler(new Vector3(0, 180, 0)); } q *= Quaternion.AngleAxis(rotation, beam_List[next_face_Axis]); go.transform.localRotation = q; go.transform.localPosition = beam_List[next_FB_Index] * beam_length; tetra_List.Add(go); sequ_element sequence_el = new sequ_element(); sequence_el.set(next_FB_Index, next_face_Axis, rotation); sequence.Add(sequence_el); cIdx++; bGenNext = false; } if(bRemoveLast) { GameObject go = tetra_List[cIdx]; tetra_List.RemoveAt(cIdx); sequence.RemoveAt(cIdx); Destroy(go); cIdx--; bRemoveLast = false; } } private void OnApplicationQuit() { sSequence.WriteLine("/////////////////////////////////////// "); sSequence.WriteLine("// "); for (int i = 0; i <= cIdx; i++) { sSequence.WriteLine(i.ToString() + "\t FB_IDX = " + sequence[i].fb_Idx.ToString() + "\t FACE_AXIS = " + sequence[i].face_axis.ToString() + "\t Rotation = " + sequence[i].axis_angle.ToString("F3")); } sSequence.WriteLine("// "); sSequence.WriteLine("/////////////////////////////////////// "); sSequence.Close(); } private void setBeams() { float tetrahedralAngle = Mathf.PI * -19.471220333f / 180; float segmentAngle = Mathf.PI * 2 / 3; float currentAngle = 0f; List<Vector3> vertices = new List<Vector3>(4) { new Vector3(0, radius, 0) }; for (var i = 1; i < 4; i++) { vertices.Add(PTUtils.PointOnSphere(radius, currentAngle, tetrahedralAngle)); currentAngle += segmentAngle; } beam_List.Add((vertices[1] + vertices[3] + vertices[2]) / 3); beam_List.Add((vertices[0] + vertices[2] + vertices[3]) / 3); beam_List.Add((vertices[0] + vertices[1] + vertices[2]) / 3); beam_List.Add((vertices[0] + vertices[3] + vertices[1]) / 3); } private void DoObjectTouched(object sender, InteractableObjectEventArgs e) { VU_UI_MANAGER.Instance.Report_Touched(this.gameObject, e.interactingObject); } private void DoObjectUntouched(object sender, InteractableObjectEventArgs e) { VU_UI_MANAGER.Instance.Report_UnTouched(this.gameObject, e.interactingObject); } private void DoObjectGrabbed(object sender, InteractableObjectEventArgs e) { } private void DoObjectUnGrabbed(object sender, InteractableObjectEventArgs e) { } }
Hopf fibration
PolyChronic vs MonoChronic
Interesting Dual
Convergent Energy – Expansive Mind
Divergent Energy – Contractive Mind
http://www.meru.org/Newsletter/eTORUS66.pdf