- Home /
how to do a delaunay triangulation for 10 points using c#?
Hi, I'm a noob ,just wanted to know how to triangulate some set of points . also I searched and found as3implementation but I was not able to make anything sensible out of it because I know only the basics of coding and know nothing about importing libraries. Can someone please show me the right way to go about it.
This question will most likely not attract many helpfull answers.
In order to be of any help, we would need this information:
What exactly do you want to achieve (triangulation or delaunay triangulation)
What input data do you have, what assumptions can we make about it (planar vs. pointcloud)
What have you tried so far (example codes, libraries you've looked at, etc.)
What is the exact question you want answered
Your question is to broad as it is.
If you need help finding a suitable library, then ask that.
Or when you need help using a specific library, then ask that.
But if you need a finished implementation of delaunay triangulation with description on how it works, etc. then don't ask it, as nobody will have the time to do that.
If you need a working system, you should take a look at Unity Connect.
Even though I answered, I agree with all of the above :)
require delaunay triangulation
have some points(random) on a unity 2d layer.
was not able to try anything because it was too advanced for me
Answer by Mikael-H · Nov 30, 2016 at 10:02 AM
If you don't know much about coding then an implementation of a triangulating algorithm might be out of your reach. Thus I would recommend importing an existing solution. Actually, that would be my recommendation anyway.
There are several implementations of Delaunay triangulation in c# available.
csDelaunay is one and its use seems to be described in this forum discussion
Triangle.NET is another that I have used previously but should read this before using it. It works great if you just handle the mono 2.0 fix.
EDIT:
Just realized that the first link was actually generating a voronoi diagram, the duality of a delaunay triangulation. For conversion see delaunay from voronoi
or use one of these maybe:
hi , I managed to import the csDelaunay library , but I cant understand how I will use it to make a planar graph using delaunay triangulation. I have 7-10 points in 2d .I require to connect them with line game objects (sprites) using delaunay triangulation. Could you please show me what are the steps I should follow. I will attach the code I used to draw lines if that could be of any use.
void Draw_Line (Transform point1, Transform point2)
{
lines_list.Add(new LINES( (GameObject)Instantiate(line_prefab) , point1 , point2 ));
lines_list[line_count].prefab.name = point1.name+"-"+point2.name;
Line_pos (point1,point2,line_count);
line_count++;
}
void Line_pos (Transform point1, Transform point2,int index)
{
lines_list[index].prefab.transform.position = (point1.position + point2.position) / 2f;
Vector3 moveDirection = point1.transform.position - point2.transform.position;
float angle = $$anonymous$$athf.Atan2 (moveDirection.y, moveDirection.x) * $$anonymous$$athf.Rad2Deg;
lines_list[index].prefab.transform.rotation = Quaternion.AngleAxis (angle, Vector3.forward);
lines_list[index].prefab.transform.localScale = new Vector3 (moveDirection.magnitude / 4f, 1f, 1f);
}
oh, sorry just realized that it produces a voronoi diagram... It can be converted to a triangulation, but if that is too hard maybe you better use one of the alternatives. I added two alternatives that might work. I have only tried Triangle.NET but that requires you to follow the instructions in the link.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Cinemachine follow Player but also focus on trajectory 0 Answers
Brackeys EnemyAi Script 0 Answers