cwangdk
Members-
Content Count
15 -
Joined
-
Last visited
Community Reputation
1 NeutralAbout cwangdk
- Birthday 12/24/1950
Technical Information
-
Delphi-Version
Delphi 10.4 Sydney
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Admire this web-app: https://voronoi-editor.web.app/ 🙂 /cwang -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Thanks !! I've also used the "rosettagit" Delphi-code. The alogrithm works, but no direct polygon-coordinates, as far as I can see. You have to traverse the image pixels to identify them. I can live with the "rosetta" solution for some time, but I still want a faster and direct solution - similar to these: Look for the "Voronoi Diagrams" pargraph on this site: https://doc.cgal.org/latest/Manual/packages.html#PartVoronoiDiagrams And this Delphi version: Fast Voronoi v.0.9: https://torry.net/authorsmore.php?id=2322 -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Oh, yes - correct .. -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
xstrider: ok, but if 2 polygons have the same color we have a problem - right? its far better for me to be able to use the coordinates and not be depentant of the pixel-based intermediate output. thanks anyway ... toms: (right now) ChatGPT stucks if no ref to units or libraies can be used ... af far as I have tried ... -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
I ask Chat-GPT: Delphi code that generates texfile with coordinates for voronoi polygons Chat-GPT answers: ==================================================== To create a Voronoi diagram with polygon coordinates output to a text file in Delphi, you can use the open-source library PolyVoronoi (https://github.com/tkoolen/polyvoronoi). The library provides functions to compute the Voronoi diagram of a set of points and to output the resulting polygons to a file in various formats. Here is an example of how you can use the library to compute the Voronoi diagram of a set of points and output the resulting polygons to a text file in Delphi: <Copy code> uses PolyVoronoi; var points: TArrayOfArrayOfFloat; polygons: TArrayOfArrayOfArrayOfFloat; i, j, k: Integer; fileName: string; f: TextFile; begin // Define the set of points for which to compute the Voronoi diagram SetLength(points, 3, 2); points[0][0] := 0; points[0][1] := 0; points[1][0] := 1; points[1][1] := 1; points[2][0] := 2; points[2][1] := 2; // Compute the Voronoi diagram polygons := VoronoiDiagram(points); // Output the resulting polygons to a text file fileName := 'voronoi.txt'; AssignFile(f, fileName); Rewrite(f); for i := 0 to High(polygons) do begin WriteLn(f, 'Polygon ', i, ':'); for j := 0 to High(polygons) do begin WriteLn(f, ' Vertex ', j, ':'); for k := 0 to High(polygons[j]) do WriteLn(f, ' ', polygons[j][k]); end; end; CloseFile(f); end; This is a basic example and you can customize it as per your requirement. ==================================================== But I can't finde the mentioned library ... -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Ok. My DELPHI application (under development) has nonfigurative graphic "art"-work as output, in various patterns, various sizes/width-height formats and using different color-palettes. So no need for precision data - and any simple text-file-format/syntax will do for output. But I need to have access to the soucecode to make my own changes underway .. The enclosed triangle tesselation data could also be intereseting to have in the textfile 🙂 brgds /cwangdk -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Artwork posters up to size A0 🙂 -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
A bit more structured: Output tekst-file structure: [plane] width=w height=h cells=c [cells] num=c 1=seed(rx1,ry1) 1=poly(1,2,3) 2=seed(rx2,ry2) 2=poly(1,2,3,4) 3=seed(rx3,ry3) 3=poly(4,2,3) 4=seed(rx4,ry4) 4=poly… . . . [vertices] num=4 1=point(x,y) 2=point(a,b) 3=point(i,j) 4=point(s,t) . . . -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
And the random seeds could well be included in the outputfile as well: [plane] width=w height=h cells=c [seeds] num=c 1=point(r1x,r1y) 2=points(r2x,r2y) 3=points(r3x,r3y) 4=points(r4x,r4y) . . . [vertices] num=4 1=point(x,y) 2=points(a,b) 3=points(i,j) 4=points(s,t) . . . [polygons] num=c 1=poly(1,2,3) 2=poly(1,2,3,4) 3=poly(4,2,3) . . . -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Correct David 🙂 I need the following output, in one simple text file per Voronoi diagram: 1: Width and length of the plane, as well as number of random points/cells (= number of polygons to fill the entire plane). 2: An indexed list of all polygons' vertices (the union set of the vertices) - including vertices of polygons along the edges of the plane. 3: An indexed list with each polygon's corner points referencing to the points in list 2. Moreover: - Must be able to edit and run in the Delphi RAD environment (I use Delphi 10.4 Community Edition). - No need for graphical output. - No need for precision calculations. - No use of 3rd party components or units. - No special requirements for the user interface. [plane] width=w height=h cells=c [vertices] num=4 1=point(x,y) 2=points(a,b) 3=points(i,j) 4=points(s,t) [polygons] num=3 1=poly(1,2,3) 2=poly(1,2,3,4) 3=poly(4,2,3) -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Thanks David!! I do understand the algorithms, Also how to identify the polygon coordinates. My problem is the math and how to code it. Just hoping that somebody will convert this Python code ( https://github.com/Yatoom/foronoi ) to a small Delphi Pascal projekt - including a list of polygon coordinates 🙂 -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Thanks .. -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
And to Rollo: I'm not capable of Python ... rgds cwang -
Vonoroi / Fortunes algorithm
cwangdk replied to cwangdk's topic in Algorithms, Data Structures and Class Design
Correct - thanks Stefan. Only my delphi code (ref: https://rosettacode.org/wiki/Voronoi_diagram ) paints by drawing pixel-line-by-pixel-line iteratating the whole canvas - the coordinates of the polygons are simply not present in the code (as far as I can see) - and furthermore this algorithm will create a massive number of SVG-code lines. And I do have (my own) routines for SVG output. Thanks anyway 🙂 -
Im' looking for a unit/code that generates a Voronoi diagram (from a 2D image with random points) pref. with Fortunes algorithm, including (!) outputting a list of the coordinates for all Voronoi polygons created in the plane - border polygons fittning the edges of the sourrounding rectangle. Ref: https://en.wikipedia.org/wiki/Fortune's_algorithm I do have the code for a solution that cannot output polygon coordinates 😞 Polygon/coordinates is needed for export to i.e. SVG scalable big print "art"-work. Thanks a lot !! 🙂 BRGDS from retired programmer in Denmark /cwang.dk voronoi01.bmp