tulio-a-cardinal / slide-rule-scales

Python library for creating completely customisable slide rule scales.
MIT License
5 stars 2 forks source link

Design of a custom slide rule (aviation computer like) #1

Open pascalJakobs opened 3 months ago

pascalJakobs commented 3 months ago

Hello The title of this message is not relevant any more as I realized that I'm just stupid ;( This is a VERY interesting project, I'd like to design my own custom slide rule (aviation computer like) Could you share the source to get ¨visual_example.png" which is not that far from what I like. Is there an easy way for S and T scale? Is something like the time scale in the inner of https://www.flickr.com/photos/johan_g/5515139179 possible? Many thanks for your help looking forward to hearing from you Pascal

tulio-a-cardinal commented 3 months ago

Hello, Pascal.

First of all, thank you for your interest. I have been trying to improve the file system for this program (make it so that one rule is described by one file), but since I am not a programmer, this is difficult for me. Sorry for the mess, with all the folders and files and such.

I am glad you were able to solve the issue of opening the svg files on inkscape, because I tried reproducing the issue here and I could not. Still, I believe it is a good idea to open the generated svg files with Inkscape and save them again, as Inkscape's svg output seems to be a little more well formatted, so it could be more reliable.

Yes, I can share the source for the visual example. I think I will just add it to the repository. The S and T scales are already programmed into the package, so they are as simple as any scale that is programmed (they are: C or D, A or B, K, ST, S, T, P and L or M), i.e. Example.set_scale_type("S", positioning_factor=10) The time scale you showed is possible too, yes, but not entirely automatically. The yellow portion is just a regular C or D scale with a special 60 in place of the 6, that can be achieved with a "one-off" on the package, i.e. a line in the one-offs.csv: "60,6,15,6,0.2,sans-serif,2.4,middle,0,-0.8,180". The inner part of the inner scale is also just a regular C or D scale, but with 2 crucial changes: 1- It is dislocated so that it starts on the 6 position. This is achieved with the positioning factor, i.e. Example.set_scale_type("c", positioning_factor=6) 2- The numbers are shown as minutes:seconds. This would have to be done manually, by creating "one-offs" for all the numbers, i.e. a line in the one-offs.csv: "1:30,1.5,15,6,0.2,sans-serif,2.4,middle,0,-0.8,180".

Feel free to contact me as necessary. I hope this helps, Túlio

On Tue, 2 Apr 2024 at 09:33, pascalJakobs @.***> wrote:

Hello This is a VERY interesting project, I'd like to design my own custom slide rule (aviation computer like) Unfortunately I can't open both straight and circular.svg examples with Inlscape. The preview in firefox is very garbled as well. Could you share the source to get ¨visual_example.png" which is not that far from what I like. Is there an easy way for S and T scale? Is something like the time scale in the inner of https://www.flickr.com/photos/johan_g/5515139179 possible? Many thanks for your help looking forward to hearing from you Pascal

— Reply to this email directly, view it on GitHub https://github.com/tulio-a-cardinal/slide-rule-scales/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4UKXSYYKE2VPFHRH3MBACLY3JUNFAVCNFSM6AAAAABFS5RYQGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYTSOBZG42TEMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

pascalJakobs commented 3 months ago

Hello Túlio, Many thanks for your nice reply, I think the best way to understand is to try. I'm going to make my own tests and read your source and examples when I find time. Then, when I face difficulties I will ask your help again. In any case, I will show you my results and beautiful slide rules. I very existed to start. I'm not a programmer too but I don't care as it gives me satisfaction. Thanks again, I'm sure I'm going to have fun with your tool. Muito obregado

tulio-a-cardinal commented 3 months ago

Hello, Pascal. Just a heads-up: The visual example source is now available. Feel free to contact me in case you need help. I look forward to seeing your results. Bien à vous, Túlio

pascalJakobs commented 3 months ago

Olá Túlio Many thanks, you're just in time. I was about to ask you how to revert the moving C scale. I'm glad to see how to make the S scale too, I wouldn't have found by myself how to adjust the positioning factor. For the moment I started an external C scale that goes sort of well, still ugly but I'm gonna polish a little. I tried to send it to you by mail, did you receive it? I try again to show you via the thread circular I keep you informed Have a nice evening

tulio-a-cardinal commented 3 months ago

Salut, Pascal.

I believe you have already solved this, but in order to revert a scale you should set invert_scale=True. For example, Obverse3.set_scale_type("c", invert_scale=True, positioning_factor=0.1), from VisualExample.py

I was able to see the external C scale on this message only. I find the way you chose to split the scale quite unorthodox. You split it in 4 parts, with a multiplication factor of 1.5, 2, 2 and 5/3≈1.667 among them - the [geometric] mean value is necessarily ⁴√10≈1.778. This shows you are using this library quite well and getting familiarized with the idea of the core.csv and its intervals. I recommend you make different spacing specifications for the 60-100 interval when compared to the 10-15 interval. The 10-15 interval could probably be looser: no marks every 0.5 or 0.1, only marks every 0.2. The 15-30 interval could probably be looser too: marks every 1/3≈0.333333 (you would have to add a lot of "3"s on the specification file for this to work) instead of every 0.2.

In general, I find it is simpler for the C scale to be split in 3, because the mean value is ³√10≈2.1544 and the values of 2, 2 and 2.5 can be used. Either as 10-20-50-100, 10-25-50-100 or 10-20-40-100. This is, in fact, so effective that it is what is used for our decimal currencies nowadays (10, 20, 50, 100 $/€/£/¥/₣ bills, for example).

Now that I have shared the source for the Visual Example, I recommend you take it as a starting point, especially for all the other types of scales (such as S). I look forward to seeing your progress, and feel free to contact me if you need any more help. Túlio

pascalJakobs commented 2 months ago

Olà Túlio, Thanks for taking care of me. I'm going very slow on this, it's #99 in my wife's priorities ;-) I'm not trying to reinvent the wheel, I'm just copying a model that I like, 2 pictures bellow

https://m.media-amazon.com/images/I/71EdKaUiiuL._AC_SL1500_.jpg https://m.media-amazon.com/images/I/71wHnJ4rUWL._AC_SL1500_.jpg

You can see where I am now with the archive linked below (I haven't found any other way to share) http://trafic-ncy.freeboxos.fr:15494/share/0RAyWQ6qXbnkGw_O/PascalBeginning.tar.gz

Could you explain what the following warning does mean please?

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux Type "help", "copyright", "credits" or "license()" for more information.

===== RESTART: /home/pascal/Downloads/slide-rule-scales-main/ExampleINT.py =====

Importing Scale Specs ... -Working from 10 to 15 ... -Working from 15 to 20 ... -Working from 20 to 30 ... -Working from 30 to 60 ... -Working from 60 to 100 ... -Editing one-offs ... -Post processing ...

Setting scale ... -Scale: C or D, Base scale -Log base: 10 -Unexpected lower bound of value 10.1 located under the minimum by 0.9956786262

Drawing circular scale ...

Thanks for your help Have a nice day

pascalJakobs commented 1 month ago

Olá Túlio I'm on the time scale now, could you please tell me where I'm wrong as not all the lines in one-offs.csv are printed?

http://trafic-ncy.freeboxos.fr:15494/share/peSv7wOzgdIpd9rM/slide-rule-scales-TIME.tar.gz

Thanks for your help.

tulio-a-cardinal commented 1 month ago

Salut, Pascal.

I am glad that you were able to progress some more on this, and thank you for contacting me.

First of all, I just noticed you had actually asked me a question on your previous message, so I will address that first.

The first thing to understand is that, in this program, the numbers that are shown on the scale are first converted to a range from 0 to 1 and then converted to a position, for example from 0 to 300mm on a straight scale or from 0° to 360° on a circular scale. However, sometimes, it is desirable to go outside the regular range of the scale, especially on straight scales, see this picture and observe how there is an extension before the number 1 and after the number 10 or 100 on the A, B, C, and D scales. For this reason, the program can deal with and accepts values outside the regular range.

Now, for the case of the C scale (the scale in question, and the most basic one), the first conversion (0 to 1 range) is done simply by taking the base 10 logarithm of the numbers, so number 1 is converted to 0 and number 10 is converted to 1. Sometimes, however, one may want to go from 10 to 100, or 100 to 1000. For these cases, there is the positioning_factor. The numbers are first multiplied by the positioning_factor and then the logarithm is taken. So, for example, if one wants to go from 100 to 1000, the positioning_factor should be 0.01, so that 100×0.01=1 and 1000×0.01=10.

In the case of the last example you shared, you go from 10 to 100, so the positioning factor should be 0.1 instead of 0.01 (this eliminates the unexpected bounds warning). Please understand that, if the positioning factor is x=10ⁿ (with n being an integer), it ends up working fine on a circular scale because the scale would be drawn, for example, from -360° to 0° (which is what happened on your last example). For your time scale, I believe that the numbers represent minutes or hours, so I would encourage you to use the numbers of minutes or hours, in the correct order, even if it means not starting the scale on the 10min at the top and ending at the 100min. You seem to be using a mixture of minutes and 10s of minutes, that, while it works, makes the specs a little harder to understand, edit and create. It seems that starting at 60min and ending at 600min would be the best option. You may use positioning_factor=0.1 to bring the numbers closer to the regular range of 1 to 10, but that is not necessary. The warning about the unexpected bounds would be displayed, because the scale would be drawn from approx. 280.13° to 640.13° instead of 0° to 360°, but that would not be a problem (in fact, this is a very good application for using "unexpected bounds" and ignoring the warning).

As for your last and most important question: not all your one-offs are shown because of an issue on my side. There was a bug with the one_offs when using custom names on positions that are specified by the mould on a circular scale. There was also a related undesirable behaviour where one-offs could be not prioritized sometimes on a circular scale. Now they should be always prioritized. I have altered and the program here on GitHub and it should work as expected now. Thank you for finding these problems and bringing them to my attention.

Just one more thing: There is the option for centring the text on the lines with t_anchor middle, if you prefer. But you seem to be aligning the line with the : to save space, which seems to be a great idea.

Best of luck on this project and please let me know how it goes or if you need any more help. Túlio