Segmenting a Path? (Designing a racetrack)

Post questions on how to use or achieve an effect in Inkscape.
GTAjedi
Posts: 6
Joined: Tue Jan 28, 2014 5:37 am

Segmenting a Path? (Designing a racetrack)

Postby GTAjedi » Tue Jan 28, 2014 5:51 am

Hi there,

I'm hoping I can be pointed in the right direction here..

I have a race track design, done from a Path. I need to be able to split the path up into segments and then do a stroke on top of that, that covers 1/4 of the width of the track.

I want it to look like the example file..only the track doesn't need to have 2 lanes, just one, but the stripes down the side need to be various different colours depending on the section of the track. I know I can do these by copying the path and using the inset or outset tool. However, I don't know how to break my path up into sections like those in the example. It would be super helpful if these segments were easily adjustable too.

The track will be split into 25 segments, most of which have a different colour inset into them.

EDIT: I have attached a better example in In Inkscape of what I want it to look like - only the blue line needs to be different colours per 'zone'. Is there any way to attach the thin white line objects to the path so that they follow its curvature and always stay within its bounds? I could just duplicate them 24 times then and move them around freehand.

I have had a look at pattern along path but the distance between the lines will not always be the same as it needs to denote different areas of the track, like a tight bend, straight, fast corner etc

Any help greatly appreciated!

Rich
Attachments
track2.svg
(32.73 KiB) Downloaded 185 times
example.jpg
example.jpg (245.98 KiB) Viewed 4464 times
Last edited by GTAjedi on Tue Feb 04, 2014 5:39 am, edited 6 times in total.

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

Re: Segmenting a Path? (Designing a racetrack)

Postby Lazur » Fri Jan 31, 2014 1:16 am

Hi.

That track has curves with smaller curve radiuses than half of the stroke width, causing problems.
Resulting in sharp inner corners.
I suggest you to correct them before moving on.

GTAjedi
Posts: 6
Joined: Tue Jan 28, 2014 5:37 am

Re: Segmenting a Path? (Designing a racetrack)

Postby GTAjedi » Sun Feb 02, 2014 11:29 am

Thanks but that isn't really an issue for me (unless you can explain why it prevents me doing what I want to) and doesn't really solve my problem.

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

Re: Segmenting a Path? (Designing a racetrack)

Postby Lazur » Sun Feb 02, 2014 12:37 pm

Thinking of a regular highway: would anyone perform a powerslide in the middle of the road, just to go on the right track?
SVG Image

More so, a path with a stroke is not a precise solution of what you want to achieve.
By drawing the inner edge or the outer edge, you could draw parallel lines with the dynamic offset feature.
Not a precise tool itself, nor would it work with the sharp corners you have -thus made that suggestion.


The other solution I would follow, is to draw each the outer and inner parts of the tracks, and, to use the interpolate extension to generate parallel lines in between. Which again, with sharp corners is not working nice.

Creating lines crossing the road in exact distances- you can do that with the pattern along path live path effect.
But where the track's radius is below it's width, those lines will actually intersect with eachother.

It is not a good starting point I guess.
It was my opinion that the mentioned problem makes it impossible to have a clean design.
If that's not an issue for you, then what is your question?

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Segmenting a Path? (Designing a racetrack)

Postby hulf2012 » Sun Feb 02, 2014 2:11 pm

Hello:

I kind of understand your requirement, more or less.
I think it's related with this topic:

viewtopic.php" onclick="readonly();return false;"postlink" href="http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Paths-LivePathEffects-BendTool.html">http://tavmjong.free.fr/INKSCAPE/MANUAL ... dTool.html

First, you should draw your path as an horizontal path, trying to be the same length of your racetrack, in order to avoid distortions. Next, apply yhe path effect. Last copy an paste the skeleton path (your racetrack path)

I'm attaching a zip file with an inkscape SVG file, to exemplify what I mean. I have to say that when applying the bend tool to a group with a lot of elements, my machine almost hang outs. So I hope your machine were of last generation, it could ease the calculation of the effect.

Greetings
Attachments
track0.zip
(78.23 KiB) Downloaded 183 times
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

GTAjedi
Posts: 6
Joined: Tue Jan 28, 2014 5:37 am

Re: Segmenting a Path? (Designing a racetrack)

Postby GTAjedi » Sun Feb 02, 2014 10:18 pm

Lazur URH wrote:Thinking of a regular highway: would anyone perform a powerslide in the middle of the road, just to go on the right track?
SVG Image

More so, a path with a stroke is not a precise solution of what you want to achieve.
By drawing the inner edge or the outer edge, you could draw parallel lines with the dynamic offset feature.
Not a precise tool itself, nor would it work with the sharp corners you have -thus made that suggestion.


The other solution I would follow, is to draw each the outer and inner parts of the tracks, and, to use the interpolate extension to generate parallel lines in between. Which again, with sharp corners is not working nice.

Creating lines crossing the road in exact distances- you can do that with the pattern along path live path effect.
But where the track's radius is below it's width, those lines will actually intersect with eachother.

It is not a good starting point I guess.
It was my opinion that the mentioned problem makes it impossible to have a clean design.
If that's not an issue for you, then what is your question?



Ah OK. For the final track I was planning to use a fill for the track surface with a thin stroke for the outside (white line). I see what you mean about the tightness of the corners now but there probably won't be any like that - I suppose it was a poor example file and probably didn't explain what I wanted too well.

I have attached a (hopefully) much better example of what I am trying to achieve as track.svg. I can achieve a similar effect with pattern to path but I need the distances between the white lines (which I have just manually placed) to be variable as each section of the track is not equal length.

The other thing I don't quite understand is how I could make the blue line different colours in each section. I tried cutting the path and apply a different stroke but it just applies it to the whole path.

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

Re: Segmenting a Path? (Designing a racetrack)

Postby Lazur » Mon Feb 03, 2014 7:50 pm

Quick modifications here.

The outline was turned to a path (Shift+Alt+C), and nodes added here and there, making it possible to pair inner nodes with outer ones.
Then, a duplicant of it was broken apart (Ctrl+Shift+K), changed the direction of one of them, and the interpolate extension was run twice:
once it was making the yellow paths in parallel to eachother, and once toreproduce the centerline of the track.
Then, on that centerline, the pattern along path live path effect was set, to have an approximation of perpendiculars, that can make up segments.

How to move on: with ungrouping any interpolated parallel paths, you can combine two together -after one being reversed- to have a nice filled path with no outlines.
To draw the segments, draw each's edge with a path intersecting it with the track beneath, then you can edit duplicants of them manually.

If you can give a reference on the divisions, then I could improve on this.


If it was for a slotcar racetrack, a geometrical design would work better?
http://www.slotforum.com/forums/index.php?automodule=blog&blogid=116&showentry=1741

GTAjedi
Posts: 6
Joined: Tue Jan 28, 2014 5:37 am

Re: Segmenting a Path? (Designing a racetrack)

Postby GTAjedi » Tue Feb 04, 2014 5:45 am

Ahh, my apologies! I thought I had uploaded a new file but I've just uploaded the same thing again /doh

The correct file is now uploaded as track2.svg. This is more or less exactly how I want it to look. Obviously all I've done is make some white lines and manually place them. What I want to do is automate somewhat the generate of them. The track is for a board game I am making, so it doesnt need a centre line or any lanes (I may do in future but you guys have covered that pretty well).

The issue I was having with pattern to path is that the sections are of irregular lengths.

I had a look at the quick mods you did to the original file - I can follow you up to a point but then I'm lost. Reading what you've written though, I think the same thing can be applied to the track2.svg file to achieve what I want.

The correct file has the divisions I am looking for (pretty much exactly).

Sorry for the confusion and thanks for the help!

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

Re: Segmenting a Path? (Designing a racetrack)

Postby Lazur » Tue Feb 04, 2014 9:14 am

Cleaned version:
https://dl.dropbox.com/s/asdivrjaxefvaio/hlp115II.svg

To make the originally blue part, used an interpolation with 20 steps and used the one at the right proportion of the track.
Then, converted those white rectangles at the edges of each segment to paths, edited them to be in place, then
used an alteration of it to be subtracted from the blue part.
To adjust the colours of the parts, use the node editor tool to select them.

Can't think of an automated way to make it this clean.

GTAjedi
Posts: 6
Joined: Tue Jan 28, 2014 5:37 am

Re: Segmenting a Path? (Designing a racetrack)

Postby GTAjedi » Wed Feb 05, 2014 7:55 am

That's great! Exactly how I wanted to be able to do it. Unfortunately, I don't understand how you've done it :(

Presumably you started by converting the blue path using Path to Stroke?

Pretty much stuck at the 1st step! I read a bit about the Interpolate function but I don't understand which 2 paths you are interpolating?

Converting the rectangles to paths I can do ;) I think you've moved them so the path points of the white rectangle/paths intersect points on the blue path?

Don't understand the "alteration of it to be subtracted from the blue part" either. What alteration do you make? Do you then use Path > Difference?

The automation isn't so bad :) As long as I can change the colours of the blue line for each individual section.

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

Re: Segmenting a Path? (Designing a racetrack)

Postby Lazur » Wed Feb 05, 2014 9:55 am

All right, let's see if I can break it down to steps.

SVG Image

  1. original path with no fill but stroke given
  2. stroke converted to path (Shift+Alt+C)
  3. path duplicated (Ctrl+D), and a red fill is set with opacity;
    time to clean up the details
    -removing unnecessary nodes, setting segments straight where they should be,
    adjusting handles
  4. cleaned up path
  5. path duplicated (Ctrl+D), blue fill set, and broken apart (Ctrl+Shift+K)
  6. removed the blue paths fills and added outline,
    opened their two straight segments, making sure their start and end nodes will be pair with the later extension run
    one of the paths's direction is reversed
  7. the interpolate extension run with 20 steps
  8. the right path chosen of the 20
  9. ungrouped the extension's result, then deleted unecessary objects
  10. middle path's direction reversed, duplicated and combined with the outer path, then
    unconnected nodes were connected and fill is set with no stroke
  11. the same thing done on the other side
  12. the basic part of the racetrack is ready, time to start making those segments




  1. rectangles showing the segment's edges from the original svg
  2. all converted to path (Ctrl+Shift+C) and combined together (Ctrl+K)
  3. new nodes added to the middle of line segments with the node editor tool's option
  4. stroke given and no fill
  5. segments opened and nodes deleted
  6. nodes deleted, segments straightened
  7. segmenting edge path duplicated (Ctrl+D), set stroke to red, scaled up each proportionally-individually through the transformation panel (Shift+Ctrl+M)
  8. scaled up paths combined back together, thin stroke width given
    and the original's nodes snapped to path intersection points -snapping enabled; changed to outline mode (Ctrl+5 on the numpad twice)
  9. converted stroke to path (Shift+Alt+C), and subtracted from the blue path below (Ctrl+-)
  10. the blue path broken apart (Ctrl+Shift+K), the tweak tool used to add random colours, and objects grouped together

It all went something like this, in a nutshell...



There is no automation to do these.
Though the result could look much better if the original racetrack was constructed in a geometric way.

GTAjedi
Posts: 6
Joined: Tue Jan 28, 2014 5:37 am

Re: Segmenting a Path? (Designing a racetrack)

Postby GTAjedi » Thu Feb 13, 2014 2:15 am

Heya,

Thanks for the help. I am now able to segment the coloured line which allows me to do what I want! :)


Return to “Help with using Inkscape”