Random Tree/Fractalise question

Post questions on how to use or achieve an effect in Inkscape.
User avatar
z3z
Posts: 36
Joined: Wed Jul 22, 2015 5:03 pm
Location: Scotland

Random Tree/Fractalise question

Postby z3z » Mon Sep 21, 2015 1:12 am

Hi guys, wonder if anyone can help with this. I've tried to google around and I have a feeling what I want may not be possible, but no harm in asking, right?

Basically, what I'm trying to do is create rivers for a map. I can draw a simple river system with a few tributaries and the fractalise tool will give me a nice random effect that works beautifully.

But, since I'm a lazy sod, I like to save time if it's at all possible. The 'Random Tree' tool creates a structure that's absolutely perfect for a river system, and I'd love to be able to use that. My problem is that what it generates isn't the one line it appears to be. Although it is one path overall, there are lines sitting on top of each other and, if you grab a node and drag, there's another path underneath. I guess it's just the way the tool works to generate the tree, but it causes havoc with the Fractalise tool.

My question is: is there any way to convert the result of Random Tree into only one simple line (or a series of segments), so that I can use the Fractalise extension on it? I'm hoping for some simple way to delete all overlapping lines, rather than having to manually break paths and delete segments. There's no point in doing it manually, as I'd be quicker creating the river system from scratch with the bezier tool. Or am I missing something perhaps, and there's a better way to do the whole thing?

I've uploaded a little png that explains exactly what's going on.

Thanks in advance for any insights!
Attachments
rivers.png
rivers.png (48.87 KiB) Viewed 4425 times

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Random Tree/Fractalise question

Postby brynn » Mon Sep 21, 2015 3:09 am

I understand exactly what you're talking about. Even using the Random Tree extension to make trees, if you want more than just stick trees, you have a lot of editing to do, with those overlapping paths and nodes.

One step you can take, to shorten the process, would be to select all the nodes of a tree and break them all at once. But then you still have to delete segments and join nodes individually.

At the moment, I can't think of a good solution. Probably just clicking out a path with the Pen tool would be the best. But I'll ponder on it, maybe I'll have an idea....

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Random Tree/Fractalise question

Postby Lazur » Mon Sep 21, 2015 4:04 am

You can convert stroke to path (Ctrl+Alt+C), press Ctrl++ and have a quite good filled path.
Then use fractalise? Would look a bit different -not exactly as on the example on the right.


The L-system, with some manual editing was handy in a similar problem.

Image

User avatar
z3z
Posts: 36
Joined: Wed Jul 22, 2015 5:03 pm
Location: Scotland

Re: Random Tree/Fractalise question

Postby z3z » Mon Sep 21, 2015 6:11 am

Thanks for your comments, Brynn & Lazur. :)

Brynn, I did think it was probably a long shot and I'm not sure there's any easy solution. I tried breaking apart the nodes all at once, but it's a pain having to delete all the individual segments and, of course, you always miss one. It ends up a mess and it's generally simpler just to do it manually. I wasn't sure if maybe there was some sort of uber union-type tool that would do it all for me, but still leave the object as a stroke so that Fractalise works the way I want.

Lazur, I tried converting stroke to path, then fractalising, but it's not the result I want. (Not sure if you got mixed up in your comment, but it's actually the result at the bottom left of my original pic that I want, not the one on the right.) The L-System looks incredibly complicated! :o I can sorta see from the pic you posted how you could get a river effect, but again that's not exactly what I'm looking for. I think in the time it would take to figure out how to create the look I want in L-System, I could create the river system manually (probably a dozen times LOL!) Thanks anyway. :)

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Random Tree/Fractalise question

Postby brynn » Mon Sep 21, 2015 11:16 am

Although I don't know exactly what variables you're using in Fractalize dialog, I got a pretty close result with: create tree > stroke to path > Fractalize.

Of course, you end up with a different kind of object. Instead of an open, stroked path, you'll have a filled, closed path. Maybe you can adjust the variables in the dialog, and make it work? Or maybe adjust the stroke width on the tree, before you do stroke to path -- maybe starting with a thinner stroke would help??

Yes, my experience with L-System, is that you need to understand the math behind it, to be able to use it effectively. Sometimes with extensions I don't understand, I can figure it out by trial and error. But there's nothing very logical...at least not my simple logic....about that one.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Random Tree/Fractalise question

Postby ~suv » Mon Sep 21, 2015 9:15 pm

Worth a try (IMvHO):
  1. Prerequisite: Install the custom extension described in this earlier forum topic:
    Subject: Re: How to remove double lines? [1]
  2. Relaunch Inkscape
  3. Create path with 'Extensions > Render > Random Tree'
  4. Apply 'Extensions > Modify Path > Remove redundant edges'
  5. Apply 'Path > Break apart'
  6. Apply 'Extensions > Modify Path > Fractalize'

[1] The custom extension is from Bug #521988 “Patch: Eliminate duplicate path segments” - it might not be "the" perfect solution (miss some segments, or create single-node sub-paths in some cases) and has not seen an updates for quite a while. A quick test run on a random tree created with Inkscape 0.91 seemed to work though.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Random Tree/Fractalise question

Postby ~suv » Tue Sep 22, 2015 2:20 am

~suv wrote:Worth a try (IMvHO):
  • Prerequisite: Install the custom extension described in this earlier forum topic:
    Subject: Re: How to remove double lines? [1]
  • Relaunch Inkscape
  • Create path with 'Extensions > Render > Random Tree'

I seem to get consistently best results if 'Remove redundant edges' is applied immediately after creating the random tree (i.e. at its original location - without any in-between modifications like moving the path to a different position, or resizing it).

  • Apply 'Extensions > Modify Path > Remove redundant edges'

To get rid of the (invisible) 1-node sub-paths created by 'Remove redundant edges', use these steps in the node tool:
  • Select path and switch to the node tool (N)
  • Select all nodes (Ctrl+A)
  • Break path at selected nodes (Shift+B)
  • Proceed with ... (see below)
  • Apply 'Path > Break apart' (Shift+Ctrl+K)
  • Apply 'Extensions > Modify Path > Fractalize'

User avatar
z3z
Posts: 36
Joined: Wed Jul 22, 2015 5:03 pm
Location: Scotland

Re: Random Tree/Fractalise question

Postby z3z » Tue Sep 22, 2015 10:10 am

Oh wow, this is fantastic! Thank you, suv!

Almost every time I tried it, it did a perfect job and gave me exactly what I needed. There were one or two occasions where there was an extra path, but it was trivially easy to clean up, or I could simply delete it and generate a new random tree and start again. It only takes seconds. You've given me exactly what I was looking for with just a few clicks.

Here's a small version of something that I knocked up really quickly, just to show you all what I was aiming for. The smallest tributaries have a thinner stroke, and the stroke gets thicker as they get towards the central 'trunk'. It gives a really natural effect and it can all be created in a few minutes.

rivers.png
rivers.png (178.8 KiB) Viewed 4252 times


Thank you so much. I am thrilled! :D

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Random Tree/Fractalise question

Postby brynn » Tue Sep 22, 2015 11:33 am

Nice!

(And that could be used to illustrate blood vessels too.)

User avatar
z3z
Posts: 36
Joined: Wed Jul 22, 2015 5:03 pm
Location: Scotland

Re: Random Tree/Fractalise question

Postby z3z » Tue Sep 22, 2015 9:10 pm

Thanks! And yeah, it does look a lot like blood vessels, now you mention it. I hope that might be useful to someone else.

Now if I can just figure out a one-click solution to drawing realistic mountains, I'll be sorted! :lol:

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Random Tree/Fractalise question

Postby ~suv » Thu Sep 24, 2015 12:26 pm

An alternative solution (not for mountains, this is still about the rivers): download a modified version of the 'Random Tree' extension from here (filename: rtree-debug.zip) - it has a new option to 'Lift pen for backward steps' (an attempt to prevent that the redundant segments are drawn at all). Break the resulting tree apart (Shift+Ctrl+K), and apply 'Modify Path > Fractalize' directly (without intermediary steps).

The modified version installs as 'Extensions > Render (Debug) > Random Tree (Debug)'. If feedback about the minor change is positive, the additional option might get added to the version shipped with Inkscape (for 0.92).

User avatar
z3z
Posts: 36
Joined: Wed Jul 22, 2015 5:03 pm
Location: Scotland

Re: Random Tree/Fractalise question

Postby z3z » Fri Oct 09, 2015 7:25 am

Hi ~suv, sorry for the late response to this, but I was stymied by the site's login problem.

I've been using the newer version of Random Tree that you linked to above for a couple of weeks now. I've ran it numerous times with the 'lift pen for backward steps' enabled and it works beautifully. I haven't had any overlapping paths, and it's been so easy to break the tree shape apart to do what I want with it. It would be fantastic if this update were added to the new version of Inkscape!

Thanks for suggesting this! :)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Random Tree/Fractalise question

Postby ~suv » Sun Oct 11, 2015 4:50 pm

@z3z - the new option will be available in the next major release:

User avatar
z3z
Posts: 36
Joined: Wed Jul 22, 2015 5:03 pm
Location: Scotland

Re: Random Tree/Fractalise question

Postby z3z » Mon Oct 12, 2015 1:18 am

This is fantastic! Thank you so much.

Inkscape has the best devs!! :D

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Random Tree/Fractalise question

Postby brynn » Mon Oct 12, 2015 1:23 am

"woo-hoo" as they say :D


Return to “Help with using Inkscape”