//Circle public static void DisplayCircleMesh(MyVector2 center, float radius, int resolution, Color color) { HashSet <Triangle2> triangles = GenerateMesh.Circle(center, radius, resolution); Mesh mesh = _TransformBetweenDataStructures.Triangles2ToMesh(triangles, false); TestAlgorithmsHelpMethods.DisplayMesh(mesh, color); }
//Arrow public static void DisplayArrowMesh(MyVector2 a, MyVector2 b, float width, float arrowSize, Color color) { HashSet <Triangle2> triangles = GenerateMesh.Arrow(a, b, width, arrowSize); Mesh mesh = _TransformBetweenDataStructures.Triangles2ToMesh(triangles, false); TestAlgorithmsHelpMethods.DisplayMesh(mesh, color); }
//Connected list of points public static void DisplayConnectedLinesMesh(List <MyVector2> points, float lineWidth, Color color) { HashSet <Triangle2> triangles = GenerateMesh.ConnectedLineSegments(points, lineWidth, isConnected: true); Mesh mesh = _TransformBetweenDataStructures.Triangles2ToMesh(triangles, false); TestAlgorithmsHelpMethods.DisplayMesh(mesh, color); }
private void CircleMeshHollow(MyVector2 pA) { HashSet <Triangle2> triangles = _GenerateMesh.CircleHollow(pA, innerRadius: 3f, resolution: 30, width: 1f); Mesh mesh = _TransformBetweenDataStructures.Triangles2ToMesh(triangles, useCompressedMesh: false); //Display //TestAlgorithmsHelpMethods.DisplayMeshWithRandomColors(mesh, 0); TestAlgorithmsHelpMethods.DisplayMesh(mesh, Color.white); }
//Triangle public static void DisplayTriangleMesh(MyVector2 a, MyVector2 b, MyVector2 c, Color color) { Triangle2 t = new Triangle2(a, b, c); HashSet <Triangle2> triangles = new HashSet <Triangle2>(); triangles.Add(t); triangles = HelpMethods.OrientTrianglesClockwise(triangles); Mesh mesh = _TransformBetweenDataStructures.Triangles2ToMesh(triangles, false); TestAlgorithmsHelpMethods.DisplayMesh(mesh, color); }
private void Arrow(MyVector2 pA, MyVector2 pB) { HashSet <Triangle2> triangles = _GenerateMesh.Arrow(pA, pB, lineWidth: 0.2f, arrowSize: 0.6f); if (triangles == null) { return; } Mesh mesh = _TransformBetweenDataStructures.Triangles2ToMesh(triangles, useCompressedMesh: false); //Display TestAlgorithmsHelpMethods.DisplayMesh(mesh, Color.white); }
private void ConnectedLines(MyVector2 pA, MyVector2 pB, MyVector2 pC, MyVector2 pD) { List <MyVector2> lines = new List <MyVector2>(); lines.Add(pA); lines.Add(pB); lines.Add(pC); lines.Add(pD); HashSet <Triangle2> triangles = _GenerateMesh.ConnectedLineSegments(lines, 0.5f, isConnected: true); Mesh mesh = _TransformBetweenDataStructures.Triangles2ToMesh(triangles, useCompressedMesh: false); //Display TestAlgorithmsHelpMethods.DisplayMesh(mesh, Color.white); }
//Plane public static void DisplayPlaneMesh(MyVector2 pos, MyVector2 normal, float width, Color color) { MyVector2 planeDir = new MyVector2(normal.y, -normal.x); //Draw the plane which is just a long line float infinite = 100f; //Draw a loooong line to show an infinite plane MyVector2 a = pos + planeDir * infinite; MyVector2 b = pos - planeDir * infinite; HashSet <Triangle2> triangles = GenerateMesh.LineSegment(a, b, width); Mesh mesh = _TransformBetweenDataStructures.Triangles2ToMesh(triangles, false); TestAlgorithmsHelpMethods.DisplayMesh(mesh, color); //Display the normal with an arrow float arrowLength = 4f; float arrowSize = width + 0.5f; DisplayArrowMesh(pos, pos + normal * arrowLength, width, arrowSize, color); }