Recent

Author Topic: Need procedure for equation of circle defined by 2 pts and tangent line - edit 1  (Read 12988 times)

Paolo

  • Hero Member
  • *****
  • Posts: 571
@ Peter H, probably you are confusing me with other people in the forum, not yet given my code ! but... look at the picture, I have finisched the GUI and all "seems" fine.

I am late with code because I need to correct some typos, very soon the code and a note on the math behind it.

see you soon

@Peter H, yes there could be a dangerous division by DY, but you can avoid that using formula with DX insted of DY !

Peter H

  • Sr. Member
  • ****
  • Posts: 272
Ok, the other problems I have seen:

If one of the two points is on the tangent, then a geometrical solution is not possible unless the other point is orthogonally to the intersection. The program doesnt recognise this and draws a circle that intersects the tangent.

If both points are on different sides of the tangent. Then also a geometric solution is impossible, but the program draws the circles intersecting the tangent. In this case my formula should deliver an exception because it calculates sqrt(-xyz).

When the coordinate system is transformed as I described before, I have only to check:
if abs(Y1) < epsilon or abs(Y2) < epsilon then //test if other point is orthogonal above, if not, geometric solution impossible.
if sign(y1) <> sign(Y2), //geometric solution impossible
 to detect these special situations.
In both cases the mathematic formula should deliver a complex result "sqrt(-xyz)" or an exception

The final test should be If( (Y1-Y2)^2+(X1-X2)^2 < epsilon  then //Points too close together, result is unstable or gives exception.
« Last Edit: February 09, 2021, 05:02:05 pm by Peter H »

Paolo

  • Hero Member
  • *****
  • Posts: 571
@Peter H,

if one point (only one !) of circle is also one point of the tangent the solution is easier : there is just one circle (or two coincidents, it depends how you see the thing). Look at the example in the picture

Peter H

  • Sr. Member
  • ****
  • Posts: 272
Correct, only the other circle is impossible, it will intersect the tangent.
If the secant is not orthogonal to the tangent, both circles are impossible. Edit oops - confusing, but easier to solve with transformed coordinates. 8)
Edit: If one point is on the tangent, and the secant is orthogonal to the tangent, two circles are mathemathically possible but they will be identic.
My formula would deliver an sqrt(-xyz) exception when the second circle is calculated but this can also be detected and prevented.

If I work with transformed coordinates, I have not to test orthogonality but only verticality, because the transformed tangent is always horizontal.

The intersecting tangent-secant method was described and proofen by Euklid 300 years before Anno 0. ;-) See Wikipedia.
The mathematic method is equivalent to the geometric method, because classic geometry is 100% solved today in mathemathics, for each geometric rule and axiom there is a mathematic and logic equivalent
Therefore a mathematic solution is superior beause:
It will give a sqrt(-1) or 1/0 exception if a tried solution is impossible, or if the solution must be found with another method than intersecting tangent-secant.

@ Peter H, probably you are confusing me with other people in the forum

Excuse me for this. I do not confuse people. This is the internet, nobody really knows anyone. I care about the truth here, not about people. (I care about people I know, but nothing more) I did not tightly follow the discussion, because I had another (IMHO better) solution in mind that was not accepted by the community, and therefore I dont remember who wrote the program. Error corrected above.   8)
If the public power supply fails. all this discussion about algorithms and programing languages and the internet is over, dont forget this. 8-)
« Last Edit: February 10, 2021, 02:19:20 am by Peter H »

avk

  • Hero Member
  • *****
  • Posts: 771
...
The mathematic method is equivalent to the geometric method, because classic geometry is 100% solved today in mathemathics, for each geometric rule and axiom there is a mathematic and logic equivalent
Therefore a mathematic solution is superior beause:
...
That is, geometry is no longer mathematics? :)

Paolo

  • Hero Member
  • *****
  • Posts: 571
dear all, in the following:

my TN (Technical Note) on the involved math
the Lazarus code (sorry not input check or plots because based on my components)

PS:I see the size limitation in file dimension, how to share larger file of about 1-2MB ? (=the runnign code with GUI)

Paolo

  • Hero Member
  • *****
  • Posts: 571
the code

Paolo

  • Hero Member
  • *****
  • Posts: 571
I see now that my TN was't uploaded, this evening I'll upload the TN.
Sorry for the mistake.

Paolo

  • Hero Member
  • *****
  • Posts: 571
the TN ...

 

TinyPortal © 2005-2018