Splitting and Joining Polygons

In CC3+, we use polygons a lot. They are used when you draw a landmass, they are used when you draw the floor of your building, they are used for your terrain fills and so on. Basically, when you work with a CC3+ map, there are 3 main types of entities you deal with, your symbols (places, objects, markers and more), your polygons (for filled areas like landmass and floors) and your lines (for walls, roads and similar).

Now, for this article I am going to have a little look at how we can do things like split our polygon up into two pieces, for example if we only need part of it for another map. And, I am also going to look at how to properly join up two polygons into one, as due to various factors, just drawing two partially overlapping polys and leaving them at that doesn’t always work.

In truth, lines and polys are mostly the same thing, the main difference is that polygons are closed (i.e. the programs draws a closing segment between the end node and back to the start node) while lines do not have this closing segment. When we are splitting and joining out polygons, we’ll actually be temporarily turning them into lines, so it is worth noting already now that having the fill apparently disappear while doing this is completely normal, and it will return when we are done. This also means that the procedures described here are the same for both lines and polygons, except you don’t close up lines at the end.

If you’re after extracting part of your map to make a detailed local map from a regional map, you may also wish to check out my Large to Small – Going from Regional Maps to Local Maps article.

Now, I use landmasses for my example here, but this works exactly the same way with floors in dungeon maps and all polys in all other map types as well.

I’ve prepared an example map for this article with some simple shapes. You can download it and try out the steps yourself. It is often better to practice on a simpler map to get a feel for the procedure rather than dive into a complicated setup if you need to this in your own existing map.

Now, before we dive into the process, let us mention a few important things

– Drawing tools edit: Drawing tools have an editing function. Ideally, you should never end up with two polygons you need to merge like I am in my example, but you should be using the editing function of the drawing tool on the first entity to just expand it instead. This is documented on page 58 of the user manual. In many cases, if you have two polygons, just deleting one of them and then edit the other with the drawing tool is quicker, and you don’t need the explanation below.

– Effects: Consider turning off effects when working with polygons. Especially edge effects like fades and glows make it difficult to find where the actual edge is.

– Sheets: It is often helpful hiding sheets that aren’t relevant right now, both to prevent you selecting the wrong thing, and also prevent them from obscuring what you are doing.

– Layers: As with sheets, layers can be hidden for the same reasons, but layers can also be frozen. This has the advantage that you can still see what’s there, but the entities on frozen layers can’t be selected for editing operations, making selecting the right things easier.

Splitting a poly

Let us begin with the landmass on the left. For one reason or another, I need part of this landmass. Perhaps I want to cut off part of it for use in another map, or perhaps I decided that this should really be two landmasses, not one. As mentioned above, you can edit polygons with the drawing tool edit function, and I could easily use that to get rid of the entire bottom half if I just wanted to keep the top half, but for this example, I want to keep both parts, but I want to eliminate the connection in the middle, making it into two islands.

To do this, I need to split the polygon into two pieces. In CC3+, we can either use the Break command which removes a chunk of a line, or the Split command which splits a line at a specific point, but without removing anything, making one line end exactly where the other starts. This makes it visually look like it is still a single line, but if you use command son it, you’ll notice it is two pieces. You’ll find both commands in the left toolbars.

Now, I want to remove that narrow section in the middle, so I am relying on the break command here. When using this command, there are three steps. First step is to pick (select) the entity we want to work on. Second step is to pick the point where the break starts, and third is where it should end. The part between the start and end will then disappear. If you remember what I said above regarding lines and polygons, you’ll remember that polygons are mainly just closed lines. Using either of these commands on a polygon WILL break it open, and turn it into a line. This means that the fill will completely disappear because a line doesn’t fill an area. Since it turns into a thin line, it may even be difficult to spot, giving the impression that it completely disappeared (especially if you have effects on, and there is an edge fade effect enabled) so I recommend working with effects off.

So, to get started, use the break command, then when prompted, select our landmass by clicking anywhere along it’s outline. Assuming you managed to select it properly, you the command line should prompt you for the break staring point (If you didn’t manage to select it, the command will just end instead). Use one of the red X-marks on my image for the starting point, and the other for the ending point. This will remove that section, and turn the landmass into an outline. Note that while you have to click correctly on the outline when selecting it, picking the start and end points aren’t that sensitive, CC3+ automatically uses the point on the entity that is nearest to where you clicked, so it will always accept your input. Of course, the closer you click the more control you have over the exact spot. Also, the start/end clicks aren’t selections, so you don’t need to worry about affecting something else because you click on it, it will only affect the entity you selected as the first step of the command no matter where you click for the start/end.

Another thing to keep in mind when using break is that it keeps the line section where you clicked when selecting the entity originally. That means that if you selected it by clicking anywhere along the small section we wanted to remove, you’ll find that it removed anything BUT that little section. So when selecting the entity, make sure you click somewhere along the outline on a spot you wish to keep.

Now, repeat the command to remove the coastline on the other side of the landmass. I added a strong outer glow to the land sheet to make the line easier to see in these screenshots, but expect the line you see to be much thinner. If you have problems seeing it yourself, a strong outer glow (50%, 0.5 map units) on the LAND sheet will help, but generally it is better to work on this with effects off. Whatever you do however, don’t change the width of the line, as that will affect the landmass when we put it back together. The reason for this is that if the line width is zero, we get a filled polygon, but otherwise it will just be an outline where the thickness of the outline is the lien width.

Once you have used the break command that second time, you should be left with two independent lines, like in my screenshot. All that remains now is to turn them back into landmasses. And this is quite simple. Right click the Explode button and pick the Path to Poly command. Now select the lines and then right click – Do it as usual.

And, that’s all there is to it. You now have two islands instead of a large one. Now, you may not like that rather straight line you ended up with that closed the gaps, but the easiest way to fix them is just using the draw tools editing command as mentioned earlier. It couldn’t do the cut for you, but now that we have two different entities, this command is the easiest way of prettying up the coastlines of our two new entities.

 

Joining two polys

In CC3+, it is recommended that a single entity (like a landmass) is made up from one polygon, not multiple overlapping ones. In some cases, you’ll not notice a difference at all, but in others just simply overlapping them gets problematic. You can see an example of this on my map here, if you look closer at the farmland fill used on the left landmass, you’ll notice that it doesn’t fit together properly along a line near the center of the landmass. This is especially noticeable if you look at the tree lines that border the fields in the texture (the darker green lines), at some points they just stop in the middle instead of being seamless. This happens because it is two different polygons overlapping, and the fill is individually applied to them, not combined. Now, some people may even not notice, and once you start filling the map with additional details, it may be covered up anyway, but, we’ll use this island as an example for how to join two polys.

To illustrate how the two polys overlap, I’ve reduce the polys to outlines in the screenshot to the right. Here you can more clearly see exactly how the landmass is made up. I did this by changing the line width of the polygons in the landmass to 0.1 using Change Properties . This makes it easier to work with for now, but we need to remember to change it back to 0 in the end.

Now, what we really want to get rid of is those two interior lines, and we want to merge the remaining outlines into a single line.

Getting rid of the interior lines is easy with the break command. The procedure is basically exactly the same as we did when splitting our other polygon above. The start/end points would be the exact point where the lines from the two polys cross (You can use the Intersection modifier here, or just eyeball it).

After using break you should end up with what looks like a single outline. It is still two lines though, so we need to join them.

At this point, I prefer to set the line width back to 0 for both lines. After doing this, they will still be a hollow outline, and the lines will be thinner than before, but it makes them easier to work with for the next steps.

Now, right click the Explode button and pick the Combine Paths command. Follow the command line prompts by first selecting one of the lines as the first one, and then selecting the second one. Then right click to finish the command (If the preview looks wrong after selecting the second path, i.e. there seem to be a line connecting across the landmass instead of to the nearby end, you can use the F and S keys to flip the paths to get the right setup before right clicking to finish – More about this command in this article.)

What this did was turning the two lines into one. We still need to close it, so finish up by right clicking explode again, picking Path to Poly and use that one the line, and that should be it. We now have a landmass with the exact same shape as before, but it is a single polygon instead of two.

My entity has a separate outline

Some styles have drawing tools that create two polygons for each landmass, the main filled entity, and then an outline entity that forms the coastline. This coastline entity is usually on it’s own sheet.

The easiest way of dealing with that when editing entities like this is to simply delete it before you begin. It is often difficult to just select the outline and not the landmass, but in most cases you can handle this by hiding the sheet with the landmass (often the LAND sheet) and then you can select and delete the outline just fine before showing the landmass sheet again.

Now, if you want this outline back after finishing editing, the easiest is to use the Change like Draw Tool command. You’ll find this by right clicking the Change Properties button. When activating this command, the first thing it asks for is the tool to use, so just right click to bring up the dialog, pick the landmass tool (or whatever you need) and then select the entity and right click -> Do it. This restores the entity to the original way it would have been drawn by the drawing tool.

 

If you have questions regarding the content of this article, please use the ProFantasy forums. It can take a long time before comments on the blog gets noticed, especially for older articles. The forums on the other hand, I frequent daily.

 

 

Comments are closed.