csn899
(Lee Tao)
1
Clear[“Global`*”]
reg = ImplicitRegion[ x + k y == 0, {x, y}]
pt = {-((a^2 k)/Sqrt[b^2 + a^2 k^2]), b^2/Sqrt[b^2 + a^2 k^2]}
RegionDistance[reg, pt]
Use codes above all
Why is it impossible to find the distance from this point to the straight line?
The known condition is: a > b > 0, and the point is in the first quadrant. k<0
I don’t know, but this variant works correctly:
reg = InfiniteLine[{{0, 0}, {-k, 1}}];
pt = {-((a^2 k)/Sqrt[b^2 + a^2 k^2]),
b^2/Sqrt[b^2 + a^2 k^2]};
RegionDistance[reg, pt]
csn899
(Lee Tao)
3
Thank you! This is an alternative method.
csn899
(Lee Tao)
4
Using this code to derive the distance from a point to a straight line is also unsuccessful.
Clear[“Global`*”]
reg = ImplicitRegion[a x + b y + c == 0, {x, y}]
pt = {x0, y0}
RegionDistance[reg, pt]
Is there any method to derive the distance formula from a point to a straight line?
Give up on ImplicitRegion:
reg = InfiniteLine[{x, y} /.
Solve[a x + b y + c == 0, y][[1]] /.
{{x -> 0}, {x -> 1}}]
RegionDistance[reg,
{x0, y0}]