0
$\begingroup$

A given coefficients line : $$Ax + By + C = 0$$ I wish it rotate around the origin $O(0,0)$ and pass through a given point $P(p_x, p_y)$, how to find the rotate angle? Of course the distance of point P to $O$ is greater than the distance point O to the line $Ax+By+C=0$ or it will have no solution. The result can be have two angle.

$\endgroup$
0
$\begingroup$

Distance of line $L_1: Ax+By+C=0$ to origin is $R=\dfrac C{\sqrt{A^2+B^2}}$.

Hence $L_1$ is tangent to the circle $C_1: x^2+y^2=R^2$.

Rotating the line such that it passes through $P(h,k)$ (say) is equivalent to finding a tangent to the same circle that passes through $P$.

The equation of any line which is a tangent to the circle $C_1$ is given by $r=\dfrac R{\cos(\theta-\beta)}\tag{1}$.

The polar coordinates for $P$ are $(r,\theta)=(\sqrt{h^2+k^2}, \arctan\frac kh)\tag{2}$

Putting $(2)$ in $(1)$ gives $$\beta=\arctan\left(\frac kh\right)-\arccos\left(\frac R{\sqrt{h^2+k^2}}\right)\tag{3}$$

Substituting $(3)$ in $(1)$ gives the equation of the rotated line passing through $P$.

$\endgroup$
  • 1
    $\begingroup$ I prefer to your answer, but I can not +1 to your answer because my poor reputation, sorry. $\endgroup$ – minmeten May 13 '17 at 18:21
0
$\begingroup$

I'm not sure if this is going to work, but maybe it will be helpful. You need a matrix of rotation around origin for the angle $\phi $, which is $[a_{ij}]$, $a_{11}=cos\phi$, $a_{12}=-sin\phi$, $a_{21}=sin\phi$, $a_{22}=cos\phi$. Coordinates of the point on that line are $[x,\frac{C-Ax}{B}]^T$. When you multiply coordinates and matrix of rotation, for a certain x and $\phi$ you are supposed to get coordinates $[p_x, p_y]^T$.

$\endgroup$
  • $\begingroup$ I am sorry but "you are supposed to" is not an answer. $\endgroup$ – Jean Marie May 12 '17 at 19:55
  • $\begingroup$ @JeanMarie Well you're setting an equation and you need to solve it. "Getting it" is not something uncertain. I'm new here so I don't really know how to type in what I want. I've mentioned that this might not be the best way to do it, but it can be helpful. $\endgroup$ – blue May 12 '17 at 19:58
  • $\begingroup$ @user445819 Yes, It needs trigonometric equations, maybe it's difficult to solve $\endgroup$ – minmeten May 12 '17 at 20:05
0
$\begingroup$

Let $d$ be the distance from the line to the origin. This is constant when you rotate the line about the origin. Let $e_\theta$ be the unit vector pointing from the origin to the closest point on the line to the origin, after it has been rotated counter-clockwise through an angle of $\theta$. Note $e_\theta$ is just $e_0$ rotated counter-clockwise through an angle of $\theta$.

When the line has been rotated so that it contains the point $P$, the equation $\vec{OP}\cdot e_\theta = d$ is satisfied. That is, the component of $\vec{OP}$ in the direction of $e_\theta$ is $d$. This amounts to solving the equation $$\begin{pmatrix}p_x \\ p_y \end{pmatrix}\cdot \left(\begin{pmatrix}\cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{pmatrix}e_0\right) = d.$$ You are given the coordinates $p_x$ and $p_y$, and the constant $d$ and the vector $e_0$ can be found from the equation of the line. The rest is a trigonometry problem.

$\endgroup$
  • $\begingroup$ your answer is similar to @user445819, and need more calculation about the distance from O to the line $\endgroup$ – minmeten May 12 '17 at 21:01
  • $\begingroup$ The other answer doesn't even mention the distance from the origin to the line. OP mentions this, so I assume they know how to compute it. If not, they can ask and I am happy to elaborate. $\endgroup$ – kccu May 13 '17 at 1:08
0
$\begingroup$

From polar equation of straight line

$$ x \cos \beta + y \sin \beta =p \tag1$$

and corresponding form

$ \dfrac{Ax+By+C}{{\sqrt{A^2+B^2}}} =0 $ the pedal distance is $p=\dfrac {-C}{\sqrt{A^2+B^2}}\tag2$

Distance to origin $\sqrt{x_p^2+ y_p^2}, p$ are invariant in rotation. It acts just like a rigid $T$ joint while entire straight line rotates around origin on pedal line length $p$.

Using $ ( x_p,y_p) $ for $P$ coordinates in place of $ (p_x,p_y),$

$$ x_p \cos \beta + y_p \sin \beta =\dfrac {-C}{\sqrt{A^2+B^2}} ,\ \beta= \tan^{-1} \frac{B}{A} \tag3$$

Can you go from there?

EDIT1:

Again apply same trick.

$$\dfrac{ x_p \cos \beta + y_p \sin \beta}{{\sqrt{x_p^2+y_p^2}}} =\dfrac {-C}{\sqrt{A^2+B^2}} \cdot \dfrac{ 1}{{\sqrt{x_p^2+y_p^2}}} =RHS \tag4 $$

Letting

$$\dfrac{ [x_p , y_p] }{{\sqrt{x_p^2+y_p^2}}}= [\cos \gamma , \sin \gamma] ,\, \gamma= \tan^{-1} \frac{y_p}{x_p}\tag5$$

Left hand side of (4) is now

$$ \cos ( \beta - \gamma)= RHS \tag6$$

So rotate given line by $\cos^{-1}$ of RHS.

EDIT2: Line Rotn

If given line $ x+y = \sqrt2 $ is rotated to pass through given point $ P[2, 2( \sqrt 3 +1)], $ then angle between tangents should be $ 60^0-(-45)^0 = 105^0$, and it tallies with calculation by formula given in (6) within construction errors.

EDIT3:

Can you now guess how to arrive at the sketched second tangent drawn from P?

$\endgroup$
  • $\begingroup$ Yes,the trigonometric equation will finally come down to xcosα+ysinα=p. $\endgroup$ – minmeten May 13 '17 at 18:31
0
$\begingroup$

The rotation that you describe maps to the point $P$ to the point(s) $Q$ on the line that are equidistant from the origin to $P$. Finding these points is a matter of applying the Pythagorean theorem, after which you can use your favorite way of computing the angle between two points to determine the required rotation angle.

The vector $(A,B)$ is normal to the line, so $(B,-A)$ is parallel to it. The square of distance of the line from the origin is ${C^2\over A^2+B^2}$ and a straightforward computation gives the point on the line nearest the origin as $R\left(-{ac\over a^2+b^2},-{bc\over a^2+b^2}\right)$. Let $d=\sqrt{p_x^2+p_y^2}$, the distance of $P$ from the origin. Then $$Q=R\pm\sqrt{d^2-{C^2\over A^2+B^2}}{(B,-A)\over\sqrt{A^2+B^2}}=R\pm{\sqrt{d^2(A^2+B^2)-C^2}\over A^2+B^2}(B,-A).$$

Now, if what you ultimately want is a rotation matrix, you don’t need to compute any angles at all. The rotation matrix can be found directly from the coordinates of $P$ and $Q$ as $$\begin{bmatrix}p_x&-p_y\\p_y&p_x\end{bmatrix}\begin{bmatrix}q_x&-q_y\\q_y&q_x\end{bmatrix}^{-1}.$$ You can, of course, extract the rotation angle $\theta$ (up to sign) from the resulting matrix since the trace of a 2-D rotation matrix equals $2\cos\theta$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.