Talk:Line circle intersection: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 14: Line 14:


:: Worth adding to the draft task --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 11:26, 21 October 2022 (UTC)
:: Worth adding to the draft task --[[User:Rdm|Rdm]] ([[User talk: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 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:

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

<math>d_x = 1,\; d_y = 1,\; d_r = \sqrt{1^{2}+1^{2}} = \sqrt{2},\; D = 0</math>

<math>x = {{d_x \sqrt{r^{2}d_r^{2}-0}} \over {d_r^{2}}} = {{\sqrt{2}} \over {2}}</math>

<math>y = {{d_y \sqrt{r^{2}d_r^{2}-0}} \over {d_r^{2}}} = {{\sqrt{2}} \over {2}}</math>

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. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 12:59, 21 October 2022 (UTC)

Revision as of 12:59, 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 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:

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)