How to convert coplanar splines to coplanar polygons?

How to convert coplanar splines to coplanar polygons?

Hiroto's Voronoi Plane.js script divides a plane into a random Voronoi pattern of polygons. His PolygonToSpline.js script converts polygon edges to splines. What I need is similar but different: to import a 2D Inkscape SVG or PDF file into C3D and convert the linear splines to a plane with polygons. I have a little experience importing Illustrator files into C3D to use with the Extrusion Creator Tool, like the "Illustrator to Cheetah 3D" example in Cheetah 3D Help where compound paths are extruded with beveled covers to make a 3D logo.

I am using the Open Source Inkscape program because it has an extension to generate a geometrically precise Voronoi object from a user-made pattern of dots/points. The same extension generates Delaunay patterns, the triangular pattern from which the Voronoi pattern is calculated.

Where I am stuck: I can import a combined/composite SVG or PDF into C3D, but I can only make an extrusion or sweep. I have tried to come up with a work-around starting with an extrusion. Neither a combined/composite path or uncombined group of individual linear splines have made anything useful.

Is there a simple and efficient way to convert the coplanar splines to a 3D plane with points/edges/polygons?
 

Attachments

  • imported_Voronois.jas.zip
    22.5 KB · Views: 387
  • v_to_p.jpg
    v_to_p.jpg
    96.5 KB · Views: 879

Hi Joel, If Inkskape can make closed splines you may have a way to do this.

What is the name of the Inkscape extension? Since the program
is free, I'll download it and play with it, maybe I'll have some luck.

The problem is splines are lines between two points and can't
split or branch, you need closed splines for all the polygons.

 

I can't get Inkscape to run unfortunatly,
XQuartz runs, which is necessary apparently.

I now remember why I don't have this program.

 
Hi Zoo et al,

True 3D Voronoi and Delaunay geometry would be an excellent addition to C3D's functionality. Maybe someday we will get a Creator tool or script, but meanwhile I'm seeking the simplest means of starting them in an outside program.

I only downloaded and experimented with Inkscape last week because of the Voronoi and Delaunay functions. The program has worked fine so far. There are lots of Help files and YouTube tutorials to get up and running. Hard to complain about a powerful program offered for free.

I rarely use Illustrator-type vector graphics, just Photoshop and C3D for 99% of what I do. I have exported .ai paths from Photoshop to C3D using the Illustrator Import.js Macro script, then made sweeps and extrusions.

I was hoping someone with experience with Illustrator or Inkscape would post a response like "just press the big red button" and instantly solve the problem. Since Hiroto made a great script converting edges to splines maybe someone can make one converting splines to edges. That would be perfect.

If it's possible to get a workflow that's easy to use I will make a start-to-finish C3D tutorial, but in case Zoo or any one else wants to try Inkscape out I'm posting what I've got so far. Try it out, maybe discover something you can use in the future.

(Note that I have already attached the C3D file in my first post with both a combined path and a group folder of all the individual splines.)

This page will provide the download links and basic set-up instructions, including Preferences settings. It made it simple and clear:

https://inkscape.org/en/download/mac-os/

Start up XQuartz first, which I think adapts a Windows-native program for Mac OS X. The keyboard shortcuts all use Control ^ instead of Command.

Start Inkscape. (First time is slow, to cache fonts.)

Create some circular dots: copy and paste (control c and v, hover cursor)
Drag-Select all dots
Extensions — Generate from Path — Voronoi Diagram
Voronoi Diagram — Page — check Show the bounding box — Apply
(wait for calculation)
Select just the dots (within the larger Voronoi diagram) — delete
Select the Voronoi Diagram (composed of many individual subpaths)
Path — Combine (= composite path)
Save as ... Plain SVG or PDF

C3D: Import

At this point, I tried sweep, extrude, Boolean, Loft, and Boolean cut.js to somehow adapt a work-around, but failed.

Any suggestions?
 

Hi Joel, XQuarts starts fine but Inkscape does not do anything.

Instructions say Inkscape will ask where
XQuarts is located but I get nothing.

Try posting a request on the script section.

 
Progress

Thanks Zoo for the tip about closed splines. In Inkscape I widened the stroke and then Path — Stroke to path to get closed splines.

Imported into C3D, Extruded, and fiddled around. Still required cell-by-cell Fill Hole but hey, gotta do what you gotta do. Probably possible to tweak the C3D process but out of time for now. More later.
 

Attachments

  • itoc.jpg
    itoc.jpg
    44.3 KB · Views: 514
Why Voronois are useful

Hi again Zoo,

That's a fun image, it makes all my gray pictures look like they are from 1920. I'm curious how you wrapped a Voronoi plane around a cylinder without an apparent seam where the planes edges meet.

Regarding Hiroto's Voronoi plane.js script: I mentioned it in my first post. I think it's great and I have used it a lot. The critical distinction is that the pattern it generates is decorative, based on an algorithm that only considers the number of cells, not their precise arrangement.

2D Voronoi and related Delaunay triangulation patterns are used in maps to connect, for example, cities. So the starting points are essential. The patterns depict real things. The geometry is hard to calculate, so like fractals, they were rarely used until cheap computers came along.

For most C3D purposes, Hiroto's script is sufficient. Sometimes all that's needed is the Voronoi material texture. The model only has to look like a Voronoi. One aesthetic limitation I have run into is when I want to have smaller cells at one end gradually growing into larger cells at the opposite end, without visible squishing.

But the main reason why I think point-derived 2D and 3D Voronois should be added to C3D is that it would make the program valuable for scientists and architects to visualize complex data and organic structures. They are also very popular with 3D printer designs not just because they look good but they are also the optimal internal structure in terms of the ratio of material to strength.

Human structures are typically cube-related. The natural world is typically cellular or crystalline. Voronois and Delaunays. Blender and other high-end 3D programs already have this functionality. Martin has incorporated many features invented by outside programmers, I don't know if they were Open Source or licensed or what. If he could add these features it could attract many new users.

Meanwhile I think I can get the effect I wanted using a "good-enough" process. I will post a tutorial if it seems worthy. I might request a script to see if anyone can automate the process. As I recall. Hiroto made the Voronoi plane script shortly after I discussed it a few years ago.

Thanks again for the tip about closed splines. That was it.
 

Attachments

  • red.jpg
    red.jpg
    112.4 KB · Views: 462
  • hill.jpg
    hill.jpg
    129.4 KB · Views: 449

I like the way Inkscape makes the pattern but is it possible with 300 or 3,000 cells?

I like the idea of greater control in C3D but for now I can show you some
editing techniques you can use after making the pattern with the script.

After making the pattern editable, switch to the front view.

Use the Optimize command first because all the polygons
are separated and they need to be welded together.

In point mode, preset the Transform tool to Move by
clicking one of the arrows, then deselect all points.

Now hold Option/Shift and you can click and drag points directly.
Because you're in the Front view all motion is parallel to the Camera.

To get rid of points use the Weld Tool.

For the column I used these techniques to make a pattern that has the
same number of points on the left and right sides and at the same height.

Then I used a combination of Creases a Subdivision Modifier
the Shell Tool a Bend Modifier and a Twist Modifier.

I'll post more tomorrow.

 

Here's the first gif on how you can make the column.

This shows setting up the Plane and Script.

I did not show all the editing, but as long as you're in the Front
View, you can move and scale the interior points as you need.

Remember when the Transform Tool is set to Move
(arrow selected) you can directly move Points.

Also use Area Select and Scale to bunch up or expand points.

 

Attachments

  • voronoi-column-01.gif
    voronoi-column-01.gif
    285.4 KB · Views: 489
Hey 'ZOO'...
Question:in the front view) How did you get the points on the left & right
on exactly the same horizontal plane/line? Snapping? Or do you just "eye-ball" it, curve the object, and then weld together?

Cool stuff by the way... :icon_thumbup:
 
Hey 'ZOO'...
Question:in the front view) How did you get the points on the left & right
on exactly the same horizontal plane/line? Snapping? Or do you just "eye-ball" it, curve the object, and then weld together?

Cool stuff by the way... :icon_thumbup:

Thanks Al, if you select a point on the right and a point on the left, you
can then use the scale part of the Transform Tool to "Scale them Flat".

Drag towards the center of the Transform Tool to flatten.

 

It gets a little more complicated now so I've added some text instructions.

Tips:

Inner Extrude with Preserve Group off.

Use the Shell Tool to extrude, not the modifier
because we want to be able to edit what we extrude.

Creases are used to keep corners and the top edge sharp.

 

Attachments

  • voronoi-column-02.gif
    voronoi-column-02.gif
    435.6 KB · Views: 726

This part is easy, so no text should be necessary,
just some highlighting of important settings.

At the end of this part, a seam will still be visible, but next
I'll make it editable and use Optimize to weld it all together.

Note: I made a mistake in this part of the tutorial, the Bend Modifier should be set to Unconstrained.

 

Attachments

  • voronoi-column-03.gif
    voronoi-column-03.gif
    401.5 KB · Views: 417
Last edited:
Back
Top