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
557 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 500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction On a scale of 1 to 10, how would you rate our Product? Many of us have answered that question time and time again. But only a few of us have had the pleasure of receiving a stack of the filled out surveys and being asked to do somethi…
This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
Learn how to set up basic frames and paths in Prezi and understand the open space that Prezi allows you to create presentations in.
Learn how to create interesting presentations by including videos to keep your audience engaged using Prezi. Select "Insert" from the top menu in your Prezi editor: Select "YouTube Video": Paste the video URL into the prompt: "Select "Insert":…

687 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