public void OnShow_Differential_Rings() { if (amd == null) { amd = new ArgosMeshDraft(); } else { amd.Clear(); } GetComponent<MeshRenderer>().enabled = true; setColor(orbitColor); List<Vector3> vInnerLower = new List<Vector3>(); List<Vector3> vOuterLower = new List<Vector3>(); List<Vector3> vInnerUpper = new List<Vector3>(); List<Vector3> vOuterUpper = new List<Vector3>(); List<Vector3> vDisk = new List<Vector3>(); float op = Mathf.PI * 2f; float delta_theta = op / 180; float theta = 0; Vector3 vPos_Lower; Vector3 vPos_Upper; Vector3 vNorm; float w_by_2 = cylinder_Width * 0.66666f;//to differentiate from Helix float rad = cylinder_Radius; Vector3 vZero = (cylinder_Offset + cylinder_Height / 2) * Vector3.up; vDisk.Add(vZero); for (int i = 0; i < 180; i++) { vPos_Lower = rad * Mathf.Cos(theta) * Vector3.right + rad * Mathf.Sin(theta) * Vector3.forward; float theta_Mod = theta % (Mathf.PI*2f/3f); float lout = rad; if (theta_Mod < 60) { lout = (1f - 0.5f * theta_Mod / (Mathf.PI/ 3f)); } else { lout = (0.5f + 0.5f * (theta_Mod - (Mathf.PI / 3f)) / (Mathf.PI / 3f)); } vPos_Lower *= lout; vPos_Upper = vPos_Lower; vNorm = vPos_Lower.normalized; vPos_Lower += cylinder_Offset * Vector3.up; vInnerLower.Add(vPos_Lower - w_by_2 * vNorm); vOuterLower.Add(vPos_Lower + w_by_2 * vNorm); vPos_Lower += (cylinder_Height / 2) * Vector3.up; vDisk.Add(vPos_Lower - w_by_2 * vNorm); vPos_Upper += cylinder_Height * Vector3.up + cylinder_Offset * Vector3.up; vInnerUpper.Add(vPos_Upper - w_by_2 * vNorm); vOuterUpper.Add(vPos_Upper + w_by_2 * vNorm); theta += delta_theta; } amd.Add(MeshDraft.Band(vOuterLower, vInnerLower)); amd.Add(MeshDraft.Band(vInnerUpper, vOuterUpper)); amd.Add(MeshDraft.Band(vInnerLower, vInnerUpper)); amd.Add(MeshDraft.Band(vOuterUpper, vOuterLower)); if (bAdd_Disk) { amd.Add(MeshDraft.TriangleFan(vDisk)); } GetComponent<MeshFilter>().mesh = amd.ToMeshInternal(); }