private Triangle3[] StitchEdge(Triangle3 item, string TopTriTag, string BottomTriTag, string StitchTopVertName1, string StitchTopVertName2, string StitchBottomVertName1, string StitchBottomVertName2, string TopTag, string BottomTag) { System.Collections.Generic.List<Triangle3> ret = new List<Triangle3>(); //Get first tri from top, get first tri from bottom... int i = 0; Triangle3 topTri; Triangle3 bottomTri; i += 1; if (item.Complement != null && item.Complement.Tag == TopTriTag) { bottomTri = item; topTri = item.Complement; Quad3D q3 = new Quad3D(); TVector3 t1 = TVector3.Tzero.Copy(); TVector3 t2 = TVector3.Tzero.Copy(); TVector3 b1 = TVector3.Tzero.Copy(); TVector3 b2 = TVector3.Tzero.Copy(); switch (StitchTopVertName1.ToLower()) { case "a": t1 = topTri.a.Copy(); break; case "b": t1 = topTri.b.Copy(); break; case "c": t1 = topTri.c.Copy(); break; default: break; } switch (StitchTopVertName2.ToLower()) { case "a": t2 = topTri.a.Copy(); break; case "b": t2 = topTri.b.Copy(); break; case "c": t2 = topTri.c.Copy(); break; default: break; } switch (StitchBottomVertName1.ToLower()) { case "a": b1 = bottomTri.a.Copy(); break; case "b": b1 = bottomTri.b.Copy(); break; case "c": b1 = bottomTri.c.Copy(); break; default: break; } switch (StitchBottomVertName2.ToLower()) { case "a": b2 = bottomTri.a.Copy(); break; case "b": b2 = bottomTri.b.Copy(); break; case "c": b2 = bottomTri.c.Copy(); break; default: break; } q3.a = t1; q3.b = b2; q3.c = b1; q3.d = t2; q3.Tag = TopTag; var newtris = q3.GetTris(); newtris[0].SortOrder = _triOrder; _triOrder += 2; newtris[1].SortOrder = _triOrder; _triOrder += 2; newtris[1].Tag = BottomTag; ret.AddRange(newtris); } return ret.ToArray(); }
public Triangle3[] GetStraightSpokePlane (TVector3 origin, float zOffset, string Tag1, string Tag2) { System.Collections.Generic.List<Triangle3> tris = new List<Triangle3> (); //Calc the angle to sweep... float inctheta = 2 * Mathf.PI / ((float)_spokeCount); float theta = 0.0f; float adjAngle = 0.0f; System.Collections.Generic.List<LineSegment2D> spokelines = new System.Collections.Generic.List<LineSegment2D> (); for (int i = 0; i < (_spokeCount + 1); i++) { adjAngle = inctheta; TVector2 pt1; TVector2 pt2; if(_hubRadius !=0){ pt1 = new TVector2((_hubRadius) * Mathf.Cos(theta) + origin.Value.x, (_hubRadius) * Mathf.Sin(theta) + origin.Value.y, VERT_SpokeEdgeTop); }else{ pt1 = new TVector2(origin.Value.x, origin.Value.y, VERT_SpokeEdgeTop); } pt2 = new TVector2(_ringRadius * Mathf.Cos(theta) + origin.Value.x, _ringRadius * Mathf.Sin(theta) + origin.Value.y, VERT_SpokeEdgeTop); LineSegment2D ls = new LineSegment2D (); ls.a = pt1; ls.b = pt2; spokelines.Add (ls); theta += (adjAngle); } theta = 0.0f; for (int i = 0; i < (_spokeCount); i++) { Quad3D q3; var q2 = CreateQuadFromLineSegment (spokelines [i], _spokeWidthInner, _spokeWidthOuter); q3 = new Quad3D().Create(q2, origin.Value.z); q3.Tag = Tag1; var qtris = q3.GetTris (); qtris[0].Tag = q3.Tag; qtris[0].SortOrder = _triOrder; _triOrder += 2; qtris[1].Tag = Tag2; qtris[1].SortOrder = _triOrder; _triOrder += 2; tris.AddRange (qtris); } return tris.ToArray (); }