Using a Linux script to generate dotted lines at various angles in real time
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Using a Linux script to generate dotted lines at various angles in real time
2017-10-15
Long ago I was able to use BASIC to generate dotted lines at various angles to form different symbols and shapes in real time. Is there a simple way in Linux which will enable me to achieve the same objective by writing a bash script?
It can be done. It is not particularly simple.
Your constraints for pure shell and speed are: integer math, character output, terminal screen dimensions in characters.
If you want graphics (pixel) resolution and better speed, this is nicely solved by using C, C++, Pascal, TCL/TK, or even basic. I have never investigated basic graphic functions under Rust, Python, or Perl but those are also interesting options. Shell can DO almost anything, but this is not something it is designed to do WELL.
Why do you want to use shell, and would using tcl/tk functions from the shell interest you?
It can be done. It is not particularly simple.
Your constraints for pure shell and speed are: integer math, character output, terminal screen dimensions in characters.
If you want graphics (pixel) resolution and better speed, this is nicely solved by using C, C++, Pascal, TCL/TK, or even basic. I have never investigated basic graphic functions under Rust, Python, or Perl but those are also interesting options. Shell can DO almost anything, but this is not something it is designed to do WELL.
Why do you want to use shell, and would using tcl/tk functions from the shell interest you?
Hi, wpeckham,
Thanks very much for your good suggestions.
This is just a random thought on my part. I wrote a conventional mortgage-loan program in C++ about 7 years ago in a couple of days after I became dissatisfied with a banker's answers. I wish to make this task as simple as possible as I am a retiree busy with daily household chores and yard work. I'll look into tcl/tk shell functions next as you suggest.
To be exact, tck and tk are not shell functions or built into the shell. They are, however, easily integrated into applications and can be called for window and graphic control and are suitable for some kinds of light programming.
There may be other ways to do pixel mapping and graphics or line drawing from the shell, but I have not played with that often.
An option I HAVE played with is generating data sets using a shell or perl script and then calling gnuplot or ploticus to then draw the plot in a window, generate a web page with the image, or create and graphic file containing the plot. These applications give you very extensive and precise control over the appearance of the output, and I find them fun to play with.
Something to investigate, if you have some time.
Learning how to do this with a shell script is probably going to cause a lot more headaches than it solves compared to the alternatives.
If you are already familiar with C++ coding, then using C++ is probably the best option. However, if your C++ skills are rusty, then it's possible you could get up and running more easily with python or javascript.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.