That means you modified the code you gave me.. at least the 'log' because log is only in debug mode..
can you share the project that you compiled to apk?
The formula I obtain is based only in two trigonometry formulas:
h^2 = a^2 + b^2 = r^2 + b^2
b = h * sin(ang)
x = h - r
If you solve this, you can obtain x.
Note: When you "Run" the project with the B4a Program, in the "Logs" zone, you can see the results (in the PC, not in the mobile device).
I use this in "Release mode" and I can see all the results loged. You don't need to debug it.
Hi Joan,
Can you share the project that you run on real device?
Thanks in advance.
'"""""""""""""""""""""""
h^2 = a^2 + b^2 = r^2 + b^2
is this a formula?
'"""""""""""""""""""""""
The equations I posted in post#6 look a bit more 'complicated' but are valid for both sides of the diagram. The given data, in the question, is the position on the x axis which means that the angle must be calculated before calculating the line length.
The equations were developped to be also able to display the red line, therefor the need for the coordinates of the end points of the line.
Thanks to all...
Guys, honestly I didn't try your latest solutions but will do asap.
Hi Klaus, the example you provided was perfectly what I was looking for.. I am looking for
0 to 90 degrees but the example was 0 to 180. That's why I looked into the other solutions
with the hope they may address 0 to 90 (only). I think modifying your code to stop at 90
could be my way to go. But this is also not necessary as I can pass any angel degree I wish to your
function.
If you replace in the Sub pnlDraw_Touch routine If X >= CenterX - Radius AND X <= CenterX + Radius Then
by If X >= CenterX - Radius AND X <= CenterX Then
You have the left side.
If you replace in the Sub pnlDraw_Touch routine
'If X >= CenterX - Radius AND X <= CenterX + Radius Then
'by
If X >= CenterX - Radius AND X <= CenterX Then
'You have the left side.
Hi Klaus,
Is it possible that we can, as well, make the red line rotates full cycle for 360 degrees? (0 to 359 OR 1 to 360)
Thank you in advance..
p.s.
sorry for brining up a 3-month old post, but I need the solution for my project : )
What are the input data ?
In the first question it was moving on the X axis independant of the Y position.
It's easy to modify the program, still depending on the X position, and show the lines in the upper part if Y is in the upper part and show the lines in the lower part if Y is in the lower part.
If you want that the angle is caluclated by the X and Y positions it needs a deeper look into it.