The way connect all points?

The way connect all points?

Anonymous
Not applicable
1,746 Views
9 Replies
Message 1 of 10

The way connect all points?

Anonymous
Not applicable

How to connect the all points on a plane in the shortest and non cross way?

For example,i want to connect the points below in the shortest and non cross way.Does anyone can give me a solution?

Thanks a lot.

thepoints.jpg

0 Likes
1,747 Views
9 Replies
Replies (9)
Message 2 of 10

3wood
Advisor
Advisor

Create a triangle from leftmost 3 points. Then search towards right for the closest point and form the second triangle. You will link all points with triangles at the end. Then the outmost boundary is the result.

0 Likes
Message 3 of 10

Anonymous
Not applicable

Hi, 

I believe the algorythm you are looking for is "convex hull".

You can add GeoNet API via nuget and use its whole bunch of geoprocessing algorythms, you just need to pass geometry from cad entities to API methods then return the results to the autocad world.

 

0 Likes
Message 4 of 10

_gile
Consultant
Consultant

kacarikalen a écrit :

Hi, 

I believe the algorythm you are looking for is "convex hull".

You can add GeoNet API via nuget and use its whole bunch of geoprocessing algorythms, you just need to pass geometry from cad entities to API methods then return the results to the autocad world.

 


Hi,

 

A convex hull won't connect all points, precisely because it's convex:

 

convex hull.png

 

You can find an AutoCAD .NEt implementation of Convex Hull here.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 10

Anonymous
Not applicable

Yes, it needs sweeping line method like graham scan, like the form of creating delaunay triangulation then deleting the innermost edges.

Some of them can be found here:

 

https://gis.stackexchange.com/questions/5426/finding-boundary-co-ordinates-from-given-set-of-point-c...

0 Likes
Message 6 of 10

hgasty1001
Advisor
Advisor

Hi,

 

I think you may find the paper in the following link very useful;Beta-Skeleton that paper explain two algorithms to solve the "follow the points" puzzles. As other mentioned this is a kind of concave hull, but it's not as easy as convex hull (Graham scan can be coded in no more than 200 lines o so) . Beta-Skeleton and Crust algorithms relays on Voronoi diagram or Delaunay triangulation in order to find the border of a concave shape. Voronoi is usually implemented using Fortune's algorithm, it's a complicated algorithm based on properties of the parabola curve, but there are some good C# code you can find, for example this: Fortune's Algorithm, so you only need to understand and code for the Beta-Skeleton or Crust as the hardest part it's Voronoi/Delaunay.

 

Gaston Nunez

0 Likes
Message 7 of 10

vaughan.giles7AGEV
Advocate
Advocate

I appreciate your post @_gile , thank you.

I do not however understand how to correctly load your customization(s) into Civil 3D - is there a proper help file somewhere that describes the process?

 

Thanks!

0 Likes
Message 8 of 10

norman.yuan
Mentor
Mentor

The code @_gile referred to his post is AutoCAD .NET API code. If you want to use/try it, you need to create a AutoCAD plugin project with Visual Studio, which is a .NET Framework, or .NET 8 class library (depending on your AutoCAD being 2025, or prior to 2025), and build the project as AutoCAD .NET plugin DLL. Then you load the DLL into AutoCAD (via command "NETLOAD", or other loading means of your choice). After all these are done, you can run the command defined in the code "Test". So, if you do not know how to write code and create AutoCAD plugin, it is tall task to do😂. and you may need someone to do it for you, or you can get started to learn the basic to just get this code built as DLL, which may only take you a day or two to learn the very basic and get started (then you probably would not want to stop any more!).

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 9 of 10

_gile
Consultant
Consultant

@vaughan.giles7AGEV 

I replied the same question in Github and TheSwamp.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 10 of 10

vaughan.giles7AGEV
Advocate
Advocate

Thank you @_gile - for those of you interested, here is a link to the AutoLISP version of the routine http://www.theswamp.org/index.php?topic=31865.new;topicseen#new 

0 Likes