Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Given a point, slope and length, find another point 45 degrees from the original with a certain length

Posted on 2011-03-23
2
Medium Priority
?
571 Views
Last Modified: 2012-05-11
Background:
I have a viewer application that displays images. One feature that I have added is the ability to draw annotations onto the image. One of the annotations that I would like to draw is a pointer (arrow) annotation so users can add focus to certain parts of the document.

What I have so far:
Breaking this down my annotation is really nothing more than a line drawn from the Starting Point (S) to the Ending Point (E) with two additional lines being drawn from S to two new points (P1, P2) where the lines S->P1 and S->P2 come off of point S at 45 degrees.

Additionally, I want my arrow head to grow and shrink with the size of the annotation, so what I have done is find the midpoint (M) of Line S->E, and then find the midpoint of line S->M to find the "Quarter point" (Q) which should be exactly one fourth of the given line S->E. If I draw a perpindicular line through point Q (the thin blue line) I know that point P1 and P2 should lie on that line. I also know that lines S->Q, Q->P1, and Q->P2 should all have the same length.

Question:
How do I find the points P1 and P2? I have attached a diagram to further explain my problem. The dashed red lines are the lines I hope to draw. Diagram
0
Comment
Question by:PaperlessEnvironments
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 37

Accepted Solution

by:
TommySzalapski earned 2000 total points
ID: 35202113
All you need is S and E and it's easy
M.x = (E.x+S.x)/2
M.y = (E.y+S.y)/2

Q.x = (M.x+S.x)/2
Q.y = (M.y+S.y)/2

 diagramIf you look at this image, you can see that P2.y - Q.y = Q.x - S.x so

P2.y = Q.y + (Q.x - S.x)
P2.x = Q.x + (S.y - Qy)
P1.y = Q.y - (M.x - Q.x)
P1.x = Q.x - (Q.y.- M.y)
0
 

Author Closing Comment

by:PaperlessEnvironments
ID: 35202532
You rock. My mind was too far down the wrong track. Thanks!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
In this tutorial viewers will learn how to create blended and gradiated shapes in Illustrator using the blend tool Draw two shapes, one of them in a different color: Select both and create a blend by going to Object > Blend > Make: Blends can also b…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question