This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
-
Hi there, Vecti looks fantastic. I'm trying to adapt this stackoverflow suggestion to your API: What I'm trying to achieve: Given line AB, how do I calculate points C and D? So far, I have:
My question is, how can I calculate the normalized perpendicular of line |
Beta Was this translation helpful? Give feedback.
Answered by
DerYeger
Sep 1, 2022
Replies: 1 comment 2 replies
-
Hi, this shouldn't be too difficult! You could use this StackOverflow answer, or use Vecti's methods as seen below: const b = new Vector(x1, y1);
const c = new Vector(x2, y2);
const aToB = B.subtract(A);
const orth = aToB.rotateByDegrees(90).normalize()
// Multiple by (-1) * 6 / 2 to get C, 6 / 2 to get D
const c = b.add(orth.multiply(-3))
const d = b.add(orth.multiply(3)) Let me know if this works, I wrote it off the top of my head. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
bstro
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, this shouldn't be too difficult!
You could use this StackOverflow answer, or use Vecti's methods as seen below:
Let me know if this works, I wrote it off the top of my head.