Apply Morse Code onto a Curve

Hey guys,
I’m trying to script a sentence in morse code. The output I want is a line segment in dash and dots following the rules of Morse code.

  • The length of a dot is 1 time unit.
  • A dash is 3 time units.
  • The space between symbols (dots and dashes) of the same letter is 1 time unit.
  • The space between letters is 3 time units.
  • The space between words is 7 time units.

Basically, I want to apply this to a curve and obtain the curve segmented according to morse code.

For example,

‘the quick brown fox’ in morse code is " - … . --.- ..- .. -.-. -.- -… .-. — .-- -. ..-. — -..-"

I want to apply this to a curve and get this in segments.

I hope I have explained the problem. I know it’s a bit geeky, But anyone with suggestions to resolve this would be great.

Thanks,
AM

:rofl: you said it!

The idea is to have a sequence of numbers defining the length of “on” and “off” state.
Make mass addiction > partial results and then evaluate length to get parameters, and shatter with those parameters. Then doing a dispatch will let you keep/see only the “on” state.
This part is actually the simplest, just 4 components.

To achieve your sequence of numbers you can smartly insert characters and then “translate” them using unicode.

Reverse-engineering this will explain more than words.


morse-code to curve.gh (24.5 KB)

Where did you get your Morse Code table?

Here https://morsecode.world/international/morse2.html
I searched for the easiest to copy-paste.
There are errors?

PS1 i wrote brown as BOWN …
PS2 the space character, i’ve translated to ‘_’ but it could have just been translated into itself in the first translation, making it " = " in the first dictionary and " =7" in the second dictionary…

I wasn’t checking you, I was just wondering how you got it into such a nice GH format.

Yes, many morse code tables are shown in 2 or more columns and selecting them mess up the order.
In that page the <div>s are probably in an order which made the selecting easy.
Then removing the spaces with notepad++ is a 30 sec task, using ALT+drag to edit many rows at once:
n++
(I’m saying this just for who don’t know this :upside_down_face: … notepad++ should be built-in on windows!)

Riccardo, You Rockstar!
It’s just perfectly what I wanted.
Reverse-engineering it makes sense of the logic.

I can now complete my tattoo!

Thanks buddy!

whoa!
Please double… triple check if the dictionary i’ve used is correct! (I’ve just copy-pasted from a random google result).
Check that everything is correct and translate back to counter proof the correct-ness of everything.

Absolutely, I cross-checked already.

Will do multiple proof reading before inking!

Thanks anyways, Appreciate it!

Just as an aside, there’s a great book “The Victorian Internet” by Tom Standage that makes the case the telegraph was a more world-shaking development than the WWW. I tend to agree.

https://www.amazon.com/Victorian-Internet-Remarkable-Nineteenth-line/dp/162040592X

This sounded like a fun little problem, so I gave it a go in Python:

Thanks for the inspiration!

Morse Code Curve.gh (11.8 KB) MorseCodeDict.txt (184 Bytes)

Did Key/Value Search and Dash Pattern not exist back then?:


Apply Morse Code onto a Curve VR 1.gh (16.1 KB)

How to do this when the dashed line is given thickness to be turned to circles and obrounds?

I thought about using Flow from a line to the curve, but that would disfigure the circles into non-circles which doesn’t look so clean.

no idea about 6 years ago, but most likely yes, it’s just I did not know all grasshopper components.
And… I still discover new commands in Rhino and new components in Grasshopper…


… can we say dots (circles) radius is equal to half-width of the strokes?
If so, dispatch your dot and dashes:

  • for dots, create a circle from the center of the dot line segment
  • for dashes, shrink the segment ends by radius (negative extend) and then make both-sides offset and cap with half-circle arcs

Yes… but no? If the dots are circles, the radius must be both the half-length of the dot in the chain and the half-width of the stroke. So either the base width unit for the dots/dashes and the spaces inbetween them are decided with the stroke size resultant, or you pick a stroke size and it determines the domain of the target curve used to show the Morse code.

This is a passable solution. It will result in variable spacing between the dots and dashes. I am reminded of this thread, where Divide Distance with semi-circles was discussed, and am considering appoaching this problem as pearls on a thread?

Ok, so help me understand it fully:

  • circles for dots, ok
  • space a dot/dash to another dot/dash have to be exactly the same as a dot/circle diameter, right?
  • about dashes, do the have to be straight lines, or curved as the original path?
  • again about dashes, do they have to be measured internally by length or by 2 chords? (like two dots pattern)

What happened to the solution? :open_mouth:

My previous comment was wrong, I edited it.
2 circles in a high curvature path can result to look like too close each-other. You are right, to solve this you might want to solve this with a chord-based solution.
See my questions above in the edited comment.

Yes.

No, they do not have to be lines, or rather they shouldn’t be lines.

Well, it’s three, but yes, I imagined measuring internally by 3 chords.

So, basically, you find the total number of chord units, use Daniel’s Kangaroo method to spread these chords evenly across the curve. Center points on the chords for circles. Cull circles that are gaps. Somehow merge three circles into a deformed oblong… This is also just an appoximation then though as centerpoint(s) of the figures do not lie on the curve anymore. This doesn’t work.

@laurent_delrieu 's Nautilus has a String of Pearls component, but it doesn’t scale the pearls to the length of the curve:

Mainly, it bothered me that the circles were being deformed to not-circles via Flow

This is what I have so far using String of Pearls,:


Apply Morse Code onto a Curve VR 3.gh (39.6 KB)

but like I say, I do not how to scale the dots and dashes to the curve length, or the curve length to the dots and dashes. Galapagos?