Rotate text?
|
01-26-2015, 03:28 PM
Post: #1
|
|||
|
|||
Rotate text?
I want to rotate text placed just outside the circumference of a circle, in order to label radials. I would appreciate some help on how this might be accomplished. Can TEXTOUT_P(), or PIXON_P() be used to rotate text in some fashion?
Thanks, -Dale- |
|||
01-27-2015, 06:57 AM
Post: #2
|
|||
|
|||
RE: Rotate text?
Hello,
Unfortunately no. there is no rotate function in Prime, sorry. If you want a rotation, you will need to draw your text on a transparent bitmap (G1), and then create a rotation function and then blit the result.. What are you working on? Cyrille |
|||
01-27-2015, 07:22 AM
(This post was last modified: 01-29-2015 08:08 PM by Damien.)
Post: #3
|
|||
|
|||
RE: Rotate text?
Something like that may help you ?
(angles are in radian) Code:
I hope it will work, i haven't got the prime with me to verify. Regards, Damien |
|||
01-27-2015, 09:11 AM
Post: #4
|
|||
|
|||
RE: Rotate text?
Hello,
Sorry that we did not have time to create a textured triangle drawing function. It would have solved that issue... cyrille |
|||
01-27-2015, 11:20 AM
Post: #5
|
|||
|
|||
RE: Rotate text?
I have created a Smith chart grob, and want to circumscribe wavelengths to/from, load/generator, around the perimeter of the chart. I use most of the graphics screen for the chart itself, in order to make it most readable. Thus, if I could wrap wavelength labeling around the circle, it would be desirable.
I've thought about rotating each character (bit by bit), but was in hopes that there was an inbuilt way to do text rotation that I hadn't yet discovered. Thank you for your suggestions. -Dale- |
|||
01-27-2015, 12:05 PM
Post: #6
|
|||
|
|||
RE: Rotate text?
(01-27-2015 11:20 AM)DrD Wrote: I have created a Smith chart grob, and want to circumscribe wavelengths to/from, load/generator, around the perimeter of the chart. I use most of the graphics screen for the chart itself, in order to make it most readable. Thus, if I could wrap wavelength labeling around the circle, it would be desirable. Hello Dale, Do you plan to publish your program? In my opinion, there are many interested .. Thomas |
|||
01-27-2015, 01:27 PM
Post: #7
|
|||
|
|||
RE: Rotate text?
I have a few objectives that I want to accomplish, most of which are functional now. If successful, I will look over my code for 'improvements', and write up a brief explanation of the features I've captured, along with related usage examples. No problem with sharing it, but it's not quite presentable yet.
I started with an impedance Smith chart, plotting complex impedance values based on normalized gamma or load impedance. I also wanted to plot matching networks using capacitive, inductive, or transmission line lengths, as needed, to result in 1:1 VSWR, (zero reflection coefficient). I'm sort of stuck at this point, since I want to easily view transmission line length on the chart, hence the need for perimeter wavelength labeling, i.e., rotated text! In the meantime, I've added the inverse impedance chart, for admittance. Thus facilitating series OR parallel matching networks, so much the better. (The so-called "immitance" Smith chart). Trying to get this coded sure makes me appreciate Mr. Smith, and all of his work in creating the original chart design! I began this adventure using a Python program approach. As the program evolved, it seemed like I could do this with the Prime, also. If ever we can communicate with the outside world to a remote terminal unit, it could be useful as a very handy, compact, VNA, (vector network analyzer), for antenna work and such. Most likely, it will just end up as another of those 'things' I do, towards some uncertain end ... -Dale- |
|||
01-27-2015, 08:27 PM
Post: #8
|
|||
|
|||
RE: Rotate text?
Hello Dale,
Many thanks for your detailed explanations. That sounds like a very, very challenging project. I didn't know the different variants of the Smith chart in detail. (The degree in electrical engineering is long gone.) I wish you much persistence and success! Thomas |
|||
02-03-2015, 03:34 PM
Post: #9
|
|||
|
|||
RE: Rotate text?
Below is a condensed program that has resulted from my attempt to rotate text around the circumference of a circle. I would like to solicit ideas for making the speed of the subroutine, (containing the x and y loops), faster. On the hardware device, the program is taking just over 6 seconds to complete, currently.
The program works by placing twelve known 30° data points in a word list. Each data point is placed at the G1 origin, and passed to the subroutine, whereby each pixel in that string gets analyzed, its location on the circle determined (in the x,y loops), and affixed to G1; then when all is ready, transferred to GO for final display. The x-y subroutine is slower than molasses in winter. The prime chokes, until it eventually coughs up the display. After trying several things that are slower yet, I wonder if there are still better, faster ways to accomplish this? If you patiently wait out the six-seven seconds watching a beautiful blank screen, this program should reward you with the graphic of my efforts, thus far. Help is both needed and appreciated! This project is for fun(?) only, with no commercial intentions. You can see the run-time from Home. Enter: time(Atest); once the display shows up, push the HOME button. I'm seeing around 6.05 seconds. Thanks! -Dale- Drum roll ... Code:
|
|||
02-04-2015, 07:41 AM
Post: #10
|
|||
|
|||
RE: Rotate text?
Hello
FOR x:=-25 TO 25 DO FOR y:=-25 TO 25 DO PIXON_P(G1,x+a,y+b,GETPIX_P(G1,x*ca-y*sa,x*sa+y*ca)); END; // end y-height pixels END; // end x-width pixels They are 2 types of items that you can control here: - 2 loops - 4 parameter calculations you need the loops and you can not transform the using matrices or the like, so nothing to improve there. You can however do something on the parameter calculations. you have the x+a and y+b. These could be speed up by using binary numbers rather than floats but the cost of doing the conversion would be higher than the cost of doing the floating point calculations. So there is no point in looking further there. you then have the GETPIX_P pixel calculations. there is quite a lot there, 4 multiplications and 2 additions (well substractions)... This, you can improve on! create a local variable where you place your rotation as a complex number (rot) and then do GETPIX_P(G1,(x,y)*rot) and let the system do the * and - internally which will be faster because there is no memory allocations for results and time spent in executing your code. This is prety much all that I can think of. cyrille |
|||
02-04-2015, 01:18 PM
(This post was last modified: 02-04-2015 01:19 PM by Han.)
Post: #11
|
|||
|
|||
RE: Rotate text?
Build your alphabet as a set of skeletal points. Make a function that builds a point list from the alphabet and modifies the points to translate by (a,b). A makelist() call would be very fast for this. Finally use the line_p() command with a rotation matrix to draw the lines forming your word.
Also just using makelist() in place of for loops will speed things up a tad. Graph 3D | QPI | SolveSys |
|||
02-04-2015, 01:25 PM
Post: #12
|
|||
|
|||
RE: Rotate text?
(02-04-2015 07:41 AM)cyrille de brébisson Wrote: FOR x:=-25 TO 25 DO Thank you for your idea! It should help, but the output format of, "(x,y)*rot" doesn't seem to be compatible with the GETPIX_P[(G],x,y) function. The output is of the form "(x,y)" and the additional overhead to break x and y out of the parens, negates any speed gain. It's possible I'm not doing something quite right according to your plan, though. If convenient, could you elaborate a bit? Thanks! -Dale- |
|||
02-04-2015, 01:50 PM
Post: #13
|
|||
|
|||
RE: Rotate text?
(02-04-2015 01:18 PM)Han Wrote: Build your alphabet as a set of skeletal points... That was an idea I had thought of, as well. After a few attempts, I kind of got lost in the devilish details, and abandoned the effort. I thought that since I only needed a few characters, I would build a matrix for them, and dissect the matrix in the loops. That was not one of my better ideas! Ultimately, this is a circular reference set of points for the Smith chart project I've been fiddling with. As far as the chart is concerned, it's just a handy reference. This part of the project has been the most challenging to implement; and I've found myself chasing my tail, with nothing but dogged determinacy driving me forth. On the emulator, I can display the actual Smith chart, fully labeled with these circular details in little over a second. But on the HHC it's way too slow. Your suggestion takes my attempts in a better direction. If I can figure out how to realize your approach, it seems like it should be much faster. Would you happen to have any code snippets that accomplish something similar? Thanks, for your suggestion! -Dale- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)