PDA

View Full Version : How to draw a fixed line based on Orientaion



ebsaith
25th June 2013, 09:47
Good day

Where a user clicks a line or must be drawn showing the orientation
Where the user clicks I store its point in an array
I have another array with different orientations

How do I draw a Fixed line of length(3)[arrow] from 1 point in the direction of the orientation

Idea on how to go about doing it

Regards

anda_skoa
25th June 2013, 10:19
By keeping the coordinate of the other axis?

Cheers,
_

ebsaith
25th June 2013, 10:51
Basically, my idea is
After user clicks a point
I have to create another point in the orientation from the initial point
and draw a line between them

Is there a function out there
that accepts Initial point, and an orientation -> showOrientation(1stPoint, Orientation)
and does the math?

anda_skoa
26th June 2013, 09:27
Orientation as in Qt::Orientation?

Btw, you will also need a distance

Cheers,
_

ebsaith
28th June 2013, 10:52
Sloved! it was more of a math problem

my solution:


newEndPoint.setX(x1 + length*cos(theta));
newEndPoint.setY(y1 + (length*sin(theta)));


Kind Regards