public void Initialise(List<HeadPoint> baseDots, bool isNew) { defaultDots = baseDots; var shapePoints = new List<Vector2>(); Rects.Clear(); dotsDictionary.Clear(); //ear var lEar = new AutodotsShapeRect { A = 47, B = 48, Type = MeshPartType.LEar }.Initialise(new[] { baseDots[47].Value, ShapeDots[42], ShapeDots[43], baseDots[48].Value }, ref shapePoints, true); //temp dotsDictionary.Add(42, lEar.ShapeIndices[1]); dotsDictionary.Add(43, lEar.ShapeIndices[2]); //temp Rects.Add(lEar); var rEar = new AutodotsShapeRect { A = 50, B = 49, Type = MeshPartType.REar }.Initialise(new[] { baseDots[50].Value, GetMirrored(43), GetMirrored(42), baseDots[49].Value }, ref shapePoints, true); Rects.Add(rEar); //head Rects.Add(new AutodotsShapeRect { A = 0, B = 3, Type = MeshPartType.Head }.Initialise(new[] { baseDots[0].Value, ShapeDots[0], ShapeDots[1], baseDots[3].Value }, ref shapePoints)); //temp dotsDictionary.Add(0, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(1, Rects.Last().ShapeIndices[2]); //temp Rects.Add(new AutodotsShapeRect { A = 3, B = 4, Type = MeshPartType.Head }.Initialise(new[] { baseDots[3].Value, ShapeDots[2], ShapeDots[3], ShapeDots[4], baseDots[4].Value }, ref shapePoints)); //temp dotsDictionary.Add(2, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(3, Rects.Last().ShapeIndices[2]); dotsDictionary.Add(4, Rects.Last().ShapeIndices[3]); //temp Rects.Add(new AutodotsShapeRect { A = 4, B = 5, Type = MeshPartType.Head }.Initialise(new[] { baseDots[4].Value, ShapeDots[5], ShapeDots[6], baseDots[5].Value }, ref shapePoints)); //temp dotsDictionary.Add(5, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(6, Rects.Last().ShapeIndices[2]); //temp Rects.Add(new AutodotsShapeRect { A = 5, B = 6, Type = MeshPartType.Head }.Initialise(new[] { baseDots[5].Value, ShapeDots[7], ShapeDots[8], baseDots[6].Value }, ref shapePoints)); //temp dotsDictionary.Add(7, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(8, Rects.Last().ShapeIndices[2]); //temp Rects.Add(new AutodotsShapeRect { A = 6, B = 7, Type = MeshPartType.Head }.Initialise(new[] { baseDots[6].Value, ShapeDots[9], ShapeDots[10], ShapeDots[11], baseDots[7].Value }, ref shapePoints)); //temp dotsDictionary.Add(9, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(10, Rects.Last().ShapeIndices[2]); dotsDictionary.Add(11, Rects.Last().ShapeIndices[3]); //temp Rects.Add(new AutodotsShapeRect { A = 7, B = 8, Type = MeshPartType.Head, LinkedShapeRect = lEar }.Initialise(new[] { baseDots[7].Value, ShapeDots[12], ShapeDots[13], ShapeDots[14], ShapeDots[15], baseDots[8].Value }, ref shapePoints)); //temp dotsDictionary.Add(12, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(13, Rects.Last().ShapeIndices[2]); dotsDictionary.Add(14, Rects.Last().ShapeIndices[3]); dotsDictionary.Add(15, Rects.Last().ShapeIndices[4]); //temp Rects.Add(new AutodotsShapeRect { A = 8, B = 9, Type = MeshPartType.Head }.Initialise(new[] { baseDots[8].Value, ShapeDots[16], ShapeDots[17], ShapeDots[18], ShapeDots[19], baseDots[9].Value }, ref shapePoints)); //temp dotsDictionary.Add(16, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(17, Rects.Last().ShapeIndices[2]); dotsDictionary.Add(18, Rects.Last().ShapeIndices[3]); dotsDictionary.Add(19, Rects.Last().ShapeIndices[4]); //temp Rects.Add(new AutodotsShapeRect { A = 9, B = 10, Type = MeshPartType.Head }.Initialise(new[] { baseDots[9].Value, ShapeDots[20], baseDots[10].Value }, ref shapePoints)); //temp dotsDictionary.Add(20, Rects.Last().ShapeIndices[1]); //temp Rects.Add(new AutodotsShapeRect { A = 10, B = 11, Type = MeshPartType.Head }.Initialise(new[] { baseDots[10].Value, ShapeDots[21], ShapeDots[22], ShapeDots[23], baseDots[11].Value }, ref shapePoints)); //temp dotsDictionary.Add(21, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(22, Rects.Last().ShapeIndices[2]); dotsDictionary.Add(23, Rects.Last().ShapeIndices[3]); //temp Rects.Add(new AutodotsShapeRect { A = 11, B = 33, Type = MeshPartType.Head }.Initialise(new[] { baseDots[11].Value, ShapeDots[24], GetMirrored(24), baseDots[33].Value }, ref shapePoints)); //temp dotsDictionary.Add(24, Rects.Last().ShapeIndices[1]); //temp Rects.Add(new AutodotsShapeRect { A = 33, B = 32, Type = MeshPartType.Head }.Initialise(new[] { baseDots[33].Value, GetMirrored(23), GetMirrored(22), GetMirrored(21), baseDots[32].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 32, B = 31, Type = MeshPartType.Head }.Initialise(new[] { baseDots[32].Value, GetMirrored(20), baseDots[31].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 31, B = 30, Type = MeshPartType.Head }.Initialise(new[] { baseDots[31].Value, GetMirrored(19), GetMirrored(18), GetMirrored(17), GetMirrored(16), baseDots[30].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 30, B = 29, Type = MeshPartType.Head, LinkedShapeRect = rEar }.Initialise(new[] { baseDots[30].Value, GetMirrored(15), GetMirrored(14), GetMirrored(13), GetMirrored(12), baseDots[29].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 29, B = 28, Type = MeshPartType.Head }.Initialise(new[] { baseDots[29].Value, GetMirrored(11), GetMirrored(10), GetMirrored(9), baseDots[28].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 28, B = 27, Type = MeshPartType.Head }.Initialise(new[] { baseDots[28].Value, GetMirrored(8), GetMirrored(7), baseDots[27].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 27, B = 26, Type = MeshPartType.Head }.Initialise(new[] { baseDots[27].Value, GetMirrored(6), GetMirrored(5), baseDots[26].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 26, B = 25, Type = MeshPartType.Head }.Initialise(new[] { baseDots[26].Value, GetMirrored(4), GetMirrored(3), GetMirrored(2), baseDots[25].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 25, B = 0, Type = MeshPartType.Head }.Initialise(new[] { baseDots[25].Value, GetMirrored(1), GetMirrored(0), baseDots[0].Value }, ref shapePoints, true, true)); //nose Rects.Add(new AutodotsShapeRect { A = 18, B = 19, }.Initialise(new[] { baseDots[18].Value, ShapeDots[31], ShapeDots[32], baseDots[19].Value }, ref shapePoints)); //temp dotsDictionary.Add(31, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(32, Rects.Last().ShapeIndices[2]); //temp Rects.Add(new AutodotsShapeRect { A = 19, B = 20, Type = MeshPartType.Nose }.Initialise(new[] { baseDots[19].Value, baseDots[20].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 20, B = 2, Type = MeshPartType.Nose }.Initialise(new[] { baseDots[20].Value, ShapeDots[33], baseDots[2].Value }, ref shapePoints)); //temp dotsDictionary.Add(33, Rects.Last().ShapeIndices[1]); //temp Rects.Add(new AutodotsShapeRect { A = 2, B = 42, Type = MeshPartType.Nose }.Initialise(new[] { baseDots[2].Value, GetMirrored(33), baseDots[42].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 42, B = 41, Type = MeshPartType.Nose }.Initialise(new[] { baseDots[42].Value, baseDots[41].Value }, ref shapePoints)); //nose pimp //Rects.Add(new AutodotsShapeRect //{ // A = 40, // B = 52, // //Type = MeshPartType.Nose //}.Initialise(new[] { baseDots[40].Value, baseDots[18].Value, baseDots[52].Value }, ref shapePoints)); //Rects.Add(new AutodotsShapeRect //{ // A = 52, // B = 2, // //Type = MeshPartType.Nose //}.Initialise(new[] { baseDots[52].Value, baseDots[20].Value, baseDots[42].Value, baseDots[2].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 41, B = 40, }.Initialise(new[] { baseDots[41].Value, GetMirrored(32), GetMirrored(31), baseDots[40].Value }, ref shapePoints, true)); //left eye Rects.Add(new AutodotsShapeRect { A = 22, B = 21, Type = MeshPartType.LEye }.Initialise(new[] { baseDots[22].Value, ShapeDots[34], ShapeDots[35], baseDots[21].Value }, ref shapePoints)); //temp dotsDictionary.Add(34, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(35, Rects.Last().ShapeIndices[2]); //temp Rects.Add(new AutodotsShapeRect { A = 21, B = 24, Type = MeshPartType.LEye }.Initialise(new[] { baseDots[21].Value, ShapeDots[36], ShapeDots[37], baseDots[24].Value }, ref shapePoints)); //temp dotsDictionary.Add(36, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(37, Rects.Last().ShapeIndices[2]); //temp Rects.Add(new AutodotsShapeRect { A = 24, B = 23, Type = MeshPartType.LEye }.Initialise(new[] { baseDots[24].Value, ShapeDots[38], ShapeDots[39], baseDots[23].Value }, ref shapePoints)); //temp dotsDictionary.Add(38, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(39, Rects.Last().ShapeIndices[2]); //temp Rects.Add(new AutodotsShapeRect { A = 23, B = 22, Type = MeshPartType.LEye }.Initialise(new[] { baseDots[23].Value, ShapeDots[40], ShapeDots[41], baseDots[22].Value }, ref shapePoints, true, true)); //temp dotsDictionary.Add(40, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(41, Rects.Last().ShapeIndices[2]); //temp //right eye Rects.Add(new AutodotsShapeRect { A = 44, B = 43, Type = MeshPartType.REye }.Initialise(new[] { baseDots[44].Value, GetMirrored(34), GetMirrored(35), baseDots[43].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 43, B = 46, Type = MeshPartType.REye }.Initialise(new[] { baseDots[43].Value, GetMirrored(36), GetMirrored(37), baseDots[46].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 46, B = 45, Type = MeshPartType.REye }.Initialise(new[] { baseDots[46].Value, GetMirrored(38), GetMirrored(39), baseDots[45].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 45, B = 44, Type = MeshPartType.REye }.Initialise(new[] { baseDots[45].Value, GetMirrored(40), GetMirrored(41), baseDots[44].Value }, ref shapePoints, true, true)); //lip top Rects.Add(new AutodotsShapeRect { A = 37, B = 38, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[37].Value, GetMirrored(28), GetMirrored(27), baseDots[38].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 38, B = 16, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[38].Value, GetMirrored(26), ShapeDots[25], ShapeDots[26], baseDots[16].Value }, ref shapePoints)); //temp dotsDictionary.Add(25, Rects.Last().ShapeIndices[2]); dotsDictionary.Add(26, Rects.Last().ShapeIndices[3]); //temp Rects.Add(new AutodotsShapeRect { A = 16, B = 15, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[16].Value, ShapeDots[27], ShapeDots[28], baseDots[15].Value }, ref shapePoints)); //temp dotsDictionary.Add(27, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(28, Rects.Last().ShapeIndices[2]); //temp //lip bottom Rects.Add(new AutodotsShapeRect { A = 15, B = 17, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[15].Value, ShapeDots[29], baseDots[17].Value }, ref shapePoints)); //temp dotsDictionary.Add(29, Rects.Last().ShapeIndices[1]); //temp Rects.Add(new AutodotsShapeRect { A = 17, B = 1, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[17].Value, ShapeDots[30], baseDots[1].Value }, ref shapePoints)); //temp dotsDictionary.Add(30, Rects.Last().ShapeIndices[1]); //temp Rects.Add(new AutodotsShapeRect { A = 1, B = 39, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[1].Value, GetMirrored(30), baseDots[39].Value }, ref shapePoints)); Rects.Add(new AutodotsShapeRect { A = 39, B = 37, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[39].Value, GetMirrored(29), baseDots[37].Value }, ref shapePoints, true, true)); //lip center Rects.Add(new AutodotsShapeRect { A = 15, B = 51, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[15].Value, ShapeDots[44], ShapeDots[45], baseDots[51].Value }, ref shapePoints)); //temp dotsDictionary.Add(44, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(45, Rects.Last().ShapeIndices[2]); //temp Rects.Add(new AutodotsShapeRect { A = 51, B = 37, Type = MeshPartType.Lip }.Initialise(new[] { baseDots[51].Value, GetMirrored(45), GetMirrored(44), baseDots[37].Value }, ref shapePoints, true)); dotsDictionary.Add(46, Rects.Last().ShapeIndices[1]); dotsDictionary.Add(47, Rects.Last().ShapeIndices[2]); Rects.Add(new AutodotsShapeRect { A = 52, B = 52, Type = MeshPartType.None }.Initialise(new[] { baseDots[52].Value }, ref shapePoints, true)); if (isNew) { ShapeInfo.Points = new HeadPoints<HeadPoint>(); ShapeInfo.Points.AddRange(shapePoints.Select(p => new HeadPoint(p)).ToArray()); ShapeInfo.Indices = ShapeIndices.ToArray(); } }
public List<int> InitializeProfile(List<Vector2> baseDots, bool isNew) { var result = new List<int>(); ProfileRects.Clear(); linkedPoints.Clear(); //var indices = new List<int>(); var shapePoints = new List<Vector2>(); var tmpLinks = new Dictionary<int, int> { {0, -1},//верх головы {18, -1},//верх носа {40, -1}, {19, -1},//нос {41, -1}, {16, -1},//верх рта {38, -1}, {51, -1},//цетр рта {1, -1},//низ рта {11, -1},//низ головы {33, -1}, }; foreach (var r in Rects) { if (tmpLinks.ContainsKey(r.A)) tmpLinks[r.A] = r.ShapeIndices[0]; if (tmpLinks.ContainsKey(r.B)) tmpLinks[r.B] = r.ShapeIndices.Last(); } if (tmpLinks.ContainsValue(-1)) return result; linkedPoints.Add(0, new List<int> { tmpLinks[0] }); linkedPoints.Add(1, new List<int> { tmpLinks[18], tmpLinks[40] }); linkedPoints.Add(2, new List<int> { tmpLinks[19], tmpLinks[41] }); linkedPoints.Add(3, new List<int> { tmpLinks[16], tmpLinks[38] }); linkedPoints.Add(4, new List<int> { tmpLinks[51] }); linkedPoints.Add(5, new List<int> { tmpLinks[1] }); linkedPoints.Add(6, new List<int> { tmpLinks[11], tmpLinks[33] }); //лоб var rect = new AutodotsShapeRect { A = 0, B = 1, Type = MeshPartType.ProfileTop }.Initialise(new[] { baseDots[0], new Vector2(0.0f, baseDots[1].Y) }, ref shapePoints); ProfileRects.Add(rect); var index1 = rect.ShapeIndices.Last(); //profileDotsDictionary rect = new AutodotsShapeRect { A = 0, B = 1, Type = MeshPartType.ProfileTop, LinkedShapeRect = rect }.Initialise(new[] { baseDots[0], ShapeProfileDots[0], ShapeProfileDots[1], ShapeProfileDots[2], ShapeProfileDots[3], ShapeProfileDots[4], ShapeProfileDots[5], ShapeProfileDots[6], ShapeProfileDots[7], ShapeProfileDots[8], ShapeProfileDots[9], ShapeProfileDots[10], ShapeProfileDots[11], ShapeProfileDots[12], baseDots[1] }, ref shapePoints); ProfileRects.Add(rect); if (!result.Contains(rect.ShapeIndices.First())) result.Add(rect.ShapeIndices.First()); if (!result.Contains(rect.ShapeIndices.Last())) result.Add(rect.ShapeIndices.Last()); //temp profileDotsDictionary.Clear(); profileDotsDictionary.Add(0, rect.ShapeIndices[1]); profileDotsDictionary.Add(1, rect.ShapeIndices[2]); profileDotsDictionary.Add(2, rect.ShapeIndices[3]); profileDotsDictionary.Add(3, rect.ShapeIndices[4]); profileDotsDictionary.Add(4, rect.ShapeIndices[5]); profileDotsDictionary.Add(5, rect.ShapeIndices[6]); profileDotsDictionary.Add(6, rect.ShapeIndices[7]); profileDotsDictionary.Add(7, rect.ShapeIndices[8]); profileDotsDictionary.Add(8, rect.ShapeIndices[9]); profileDotsDictionary.Add(9, rect.ShapeIndices[10]); profileDotsDictionary.Add(10, rect.ShapeIndices[11]); profileDotsDictionary.Add(11, rect.ShapeIndices[12]); profileDotsDictionary.Add(12, rect.ShapeIndices[13]); //temp /* for (var i = 0; i < rect.ShapeIndices.Length - 1; i++) indices.AddRange(new[] { index1, rect.ShapeIndices[i], rect.ShapeIndices[i + 1] });*/ //верх носа rect = new AutodotsShapeRect { A = 1, B = 2, Type = MeshPartType.ProfileTop }.Initialise(new[] { new Vector2(0.0f, baseDots[1].Y), new Vector2(0.0f, baseDots[2].Y) }, ref shapePoints); ProfileRects.Add(rect); var index0 = rect.ShapeIndices[0]; index1 = rect.ShapeIndices.Last(); rect = new AutodotsShapeRect { A = 1, B = 2, Type = MeshPartType.ProfileTop, LinkedShapeRect = rect }.Initialise(new[] { baseDots[1], ShapeProfileDots[13], ShapeProfileDots[14], ShapeProfileDots[15], ShapeProfileDots[16], ShapeProfileDots[17], ShapeProfileDots[18], ShapeProfileDots[19], baseDots[2] }, ref shapePoints); ProfileRects.Add(rect); if (!result.Contains(rect.ShapeIndices.First())) result.Add(rect.ShapeIndices.First()); if (!result.Contains(rect.ShapeIndices.Last())) result.Add(rect.ShapeIndices.Last()); //temp profileDotsDictionary.Add(13, rect.ShapeIndices[1]); profileDotsDictionary.Add(14, rect.ShapeIndices[2]); profileDotsDictionary.Add(15, rect.ShapeIndices[3]); profileDotsDictionary.Add(16, rect.ShapeIndices[4]); profileDotsDictionary.Add(17, rect.ShapeIndices[5]); profileDotsDictionary.Add(18, rect.ShapeIndices[6]); profileDotsDictionary.Add(19, rect.ShapeIndices[7]); //temp /*indices.AddRange(new[] { index1, index0, rect.ShapeIndices[0] }); for (var i = 0; i < rect.ShapeIndices.Length - 1; i++) indices.AddRange(new[] { index1, rect.ShapeIndices[i], rect.ShapeIndices[i + 1] });*/ //низ носа rect = new AutodotsShapeRect { A = 2, B = 3, Type = MeshPartType.ProfileTop }.Initialise(new[] { new Vector2(0.0f, baseDots[2].Y), new Vector2(0.0f, baseDots[3].Y) }, ref shapePoints); ProfileRects.Add(rect); index0 = rect.ShapeIndices[0]; index1 = rect.ShapeIndices.Last(); rect = new AutodotsShapeRect { A = 2, B = 3, Type = MeshPartType.ProfileTop, LinkedShapeRect = rect }.Initialise(new[] { baseDots[2], ShapeProfileDots[20], ShapeProfileDots[21], ShapeProfileDots[22], ShapeProfileDots[23], ShapeProfileDots[24], baseDots[3] }, ref shapePoints, true); ProfileRects.Add(rect); if (!result.Contains(rect.ShapeIndices.First())) result.Add(rect.ShapeIndices.First()); if (!result.Contains(rect.ShapeIndices.Last())) result.Add(rect.ShapeIndices.Last()); //temp profileDotsDictionary.Add(20, rect.ShapeIndices[1]); profileDotsDictionary.Add(21, rect.ShapeIndices[2]); profileDotsDictionary.Add(22, rect.ShapeIndices[3]); profileDotsDictionary.Add(23, rect.ShapeIndices[4]); profileDotsDictionary.Add(24, rect.ShapeIndices[5]); //temp /*indices.AddRange(new[] { index1, index0, rect.ShapeIndices[0] }); for (var i = 0; i < rect.ShapeIndices.Length - 1; i++) indices.AddRange(new[] { index1, rect.ShapeIndices[i], rect.ShapeIndices[i + 1] });*/ //верх губы rect = new AutodotsShapeRect { A = 3, B = 4, Type = MeshPartType.ProfileBottom }.Initialise(new[] { new Vector2(0.0f, baseDots[3].Y), new Vector2(0.0f, baseDots[4].Y) }, ref shapePoints); ProfileRects.Add(rect); index0 = rect.ShapeIndices[0]; index1 = rect.ShapeIndices.Last(); rect = new AutodotsShapeRect { A = 3, B = 4, Type = MeshPartType.ProfileBottom, LinkedShapeRect = rect }.Initialise(new[] { baseDots[3], ShapeProfileDots[25], ShapeProfileDots[26], ShapeProfileDots[27], baseDots[4] }, ref shapePoints); ProfileRects.Add(rect); if (!result.Contains(rect.ShapeIndices.First())) result.Add(rect.ShapeIndices.First()); if (!result.Contains(rect.ShapeIndices.Last())) result.Add(rect.ShapeIndices.Last()); //temp profileDotsDictionary.Add(25, rect.ShapeIndices[1]); profileDotsDictionary.Add(26, rect.ShapeIndices[2]); profileDotsDictionary.Add(27, rect.ShapeIndices[3]); //temp /*indices.AddRange(new[] { index1, index0, rect.ShapeIndices[0] }); for (var i = 0; i < rect.ShapeIndices.Length - 1; i++) indices.AddRange(new[] { index1, rect.ShapeIndices[i], rect.ShapeIndices[i + 1] });*/ //низ губы rect = new AutodotsShapeRect { A = 4, B = 5, Type = MeshPartType.ProfileBottom }.Initialise(new[] { new Vector2(0.0f, baseDots[4].Y), new Vector2(0.0f, baseDots[5].Y) }, ref shapePoints); ProfileRects.Add(rect); index0 = rect.ShapeIndices[0]; index1 = rect.ShapeIndices.Last(); rect = new AutodotsShapeRect { A = 4, B = 5, Type = MeshPartType.ProfileBottom, LinkedShapeRect = rect }.Initialise(new[] { baseDots[4], ShapeProfileDots[28], ShapeProfileDots[29], ShapeProfileDots[30], baseDots[5] }, ref shapePoints); ProfileRects.Add(rect); if (!result.Contains(rect.ShapeIndices.First())) result.Add(rect.ShapeIndices.First()); if (!result.Contains(rect.ShapeIndices.Last())) result.Add(rect.ShapeIndices.Last()); //temp profileDotsDictionary.Add(28, rect.ShapeIndices[1]); profileDotsDictionary.Add(29, rect.ShapeIndices[2]); profileDotsDictionary.Add(30, rect.ShapeIndices[3]); //temp /*indices.AddRange(new[] { index1, index0, rect.ShapeIndices[0] }); for (var i = 0; i < rect.ShapeIndices.Length - 1; i++) indices.AddRange(new[] { index1, rect.ShapeIndices[i], rect.ShapeIndices[i + 1] });*/ //подбородок rect = new AutodotsShapeRect { A = 5, B = 6, Type = MeshPartType.ProfileBottom }.Initialise(new[] { new Vector2(0.0f, baseDots[5].Y), baseDots[6] }, ref shapePoints); ProfileRects.Add(rect); index0 = rect.ShapeIndices[0]; index1 = rect.ShapeIndices.Last(); rect = new AutodotsShapeRect { A = 5, B = 6, Type = MeshPartType.ProfileBottom, LinkedShapeRect = rect }.Initialise(new[] { baseDots[5], ShapeProfileDots[31], ShapeProfileDots[32], ShapeProfileDots[33], ShapeProfileDots[34], ShapeProfileDots[35], ShapeProfileDots[36], ShapeProfileDots[37], ShapeProfileDots[38], ShapeProfileDots[39], ShapeProfileDots[40], ShapeProfileDots[41], ShapeProfileDots[42], baseDots[6] }, ref shapePoints, true); ProfileRects.Add(rect); if (!result.Contains(rect.ShapeIndices.First())) result.Add(rect.ShapeIndices.First()); if (!result.Contains(rect.ShapeIndices.Last())) result.Add(rect.ShapeIndices.Last()); //temp profileDotsDictionary.Add(31, rect.ShapeIndices[1]); profileDotsDictionary.Add(32, rect.ShapeIndices[2]); profileDotsDictionary.Add(33, rect.ShapeIndices[3]); profileDotsDictionary.Add(34, rect.ShapeIndices[4]); profileDotsDictionary.Add(35, rect.ShapeIndices[5]); profileDotsDictionary.Add(36, rect.ShapeIndices[6]); profileDotsDictionary.Add(37, rect.ShapeIndices[7]); profileDotsDictionary.Add(38, rect.ShapeIndices[8]); profileDotsDictionary.Add(39, rect.ShapeIndices[9]); profileDotsDictionary.Add(40, rect.ShapeIndices[10]); profileDotsDictionary.Add(41, rect.ShapeIndices[11]); profileDotsDictionary.Add(42, rect.ShapeIndices[12]); //temp /*for (var i = 0; i < rect.ShapeIndices.Length - 3; i++) indices.AddRange(new[] { index0, rect.ShapeIndices[i], rect.ShapeIndices[i + 1] }); indices.AddRange(new[] { index0, rect.ShapeIndices[rect.ShapeIndices.Length - 3], index1 }); indices.AddRange(new[] { index1, rect.ShapeIndices[rect.ShapeIndices.Length - 3], rect.ShapeIndices[rect.ShapeIndices.Length - 2] });*/ if (isNew) { ShapeProfileInfo.Points = new HeadPoints<HeadPoint>(); ShapeProfileInfo.Points.AddRange(shapePoints.Select(p => new HeadPoint(p)).ToArray()); var list = ShapeProfileInfo.Points.Select(p => p.Value).ToList(); ShapeProfileInfo.Indices = new[] { //indices.ToArray(); 1, 0, 2, 1, 2, 3, 1, 3, 4, 1, 4, 5, 1, 5, 6, 1, 6, 7, 1, 7, 8, 1, 8, 9, 1, 9, 10, 1, 10, 11, 1, 11, 12, 1, 12, 13, 1, 13, 14, 1, 14, 15, 1, 15, 16, 16, 15, 17, 16, 17, 18, 16, 18, 19, 16, 19, 20, 16, 20, 21, 16, 21, 22, 16, 22, 23, 16, 23, 24, /*1, 15, 17, 1, 17, 18, 1, 18, 19, 1, 19, 20, 1, 20, 21, 1, 21, 22, 1, 22, 23, 1, 23, 24, 1, 24, 16,*/ 16, 24, 26, 16, 26, 27, 16, 27, 28, 16, 28, 29, 16, 29, 30, 16, 30, 31, 16, 31, 25, 25, 31, 33, 25, 33, 34, 25, 34, 35, 25, 35, 32, 35, 36, 32, 32, 36, 38, 32, 38, 37, 37, 38, 39, 37, 39, 40, 37, 40, 41, 37, 41, 43, 37, 43, 44, 37, 44, 45, 37, 45, 46, 37, 46, 47, 37, 47, 48, 37, 48, 49, 37, 49, 50, 37, 50, 51, 37, 51, 52, 37, 52, 53, 37, 53, 42, 42, 53, 54}; } return result; }