Talk:Line circle intersection: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 19: Line 19:
The task currently references https://mathworld.wolfram.com/Circle-LineIntersection.html which (for now, at least) seems to be incorrect.
The task currently references https://mathworld.wolfram.com/Circle-LineIntersection.html which (for now, at least) seems to be incorrect.


Consider, for example, a circle of radius 1 at the origin and a line extending through the origin and the point x=1, y=1. Here, we expect intersections at x and y equal to the square root of 2 and the negative of the square root of 2. Ignoring the negative x and y results for simplicity, and working through the wolfram approach:
Consider, for example, a circle of radius 1 at the origin and a line extending through the origin and the point x=1, y=1. Here, we expect intersections at <math>x=\pm \sqrt{2},\;y=\pm\sqrt{2}</math>.

Ignoring the negative x and y results for simplicity, and working through the wolfram approach:


<math>r = 1,\; x_1=0,\; y_1=0,\; x_2=1,\; y_2=1</math>
<math>r = 1,\; x_1=0,\; y_1=0,\; x_2=1,\; y_2=1</math>

Revision as of 13:02, 21 October 2022

Error by vb.net

i try to use the vb.net-code but in following constellation is a error

center=10,10 radius=5 line from 5,0 to 5,20

there is no intersection - but it is a point of tangent.

regards Jan

It seems the task author did not include test examples where there is a tangent. --Wherrera (talk) 18:42, 20 October 2022 (UTC)
Worth adding to the draft task --Rdm (talk) 11:26, 21 October 2022 (UTC)

The Wolfram approach

The task currently references https://mathworld.wolfram.com/Circle-LineIntersection.html which (for now, at least) seems to be incorrect.

Consider, for example, a circle of radius 1 at the origin and a line extending through the origin and the point x=1, y=1. Here, we expect intersections at .

Ignoring the negative x and y results for simplicity, and working through the wolfram approach:

I'd like to believe that I'm wrong here -- past experience suggests I make mistakes far more often than anything in Wolfram. But I keep going over this and not seeing where I went wrong. --Rdm (talk) 12:59, 21 October 2022 (UTC)