1
$\begingroup$

Hi and sorry if my post is not the best but is my first time in something like this I have seen this post,

I have two directional points. Point A going to point B. Each point has an X and Y coordinate.

What I am trying to do is find a point C, with distance d. The two constraints are that C has to be perpendicular to where B ends AND BC is always 90 degrees anti-clockwise relative to AB.

Essentially what I am asking is what are the steps to solve for C using those two constraints.

enter image description here

the user quasi answered in this post whit this form and anser

If A,B are represented as complex numbers a,b, then C is represented by the complex number c, where c is given by

c=b+(di)b−a/|b−a|

I would like know if someone can tell me the way to put that expresion in javascript, whit cordinates x,y or longitude and latitude

Thans you

$\endgroup$

closed as off-topic by Siong Thye Goh, Cesareo, Lee David Chung Lin, user91500, achille hui Jan 12 at 10:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about mathematics, within the scope defined in the help center." – Siong Thye Goh, Cesareo, Lee David Chung Lin, achille hui
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ For a question like this about a specific programming language, you'd probably be better off asking it somewhere focused on programming. While mathematicians can generally be expected to know some programming, it's unlikely that'll be Javascript. As noted, the mathematics of this is fairly simple and you already have an answer there - so that leaves the programming part better answered elsewhere. $\endgroup$ – jmerry Jan 12 at 1:21
0
$\begingroup$

Given $A(x_A,y_A)$ and $B(x_B,y_B)$, the required point $C(x_C,y_C)$ is given by: \begin{align}%$c=b-id\frac{a-b}{|a-b|}$ x_C&=x_B+d\frac{y_A-y_B}{\sqrt{(x_A-x_B)^2+(y_A-y_B)^2}}& y_C&=y_B-d\frac{x_A-x_B}{\sqrt{(x_A-x_B)^2+(y_A-y_B)^2}}& \end{align} To get it in javascript:

C={
   x:B.x+d*(A.y-B.y)/Math.sqrt(Math.pow(A.x-B.x,2)+Math.pow(A.y-B.y,2)),
   y:B.y-d*(A.x-B.x)/Math.sqrt(Math.pow(A.x-B.x,2)+Math.pow(A.y-B.y,2))
}
$\endgroup$
  • $\begingroup$ You can use Math.sqrt() and Math.pow() methods in JavaScript. $\endgroup$ – model_checker Jan 12 at 10:14

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