ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Coordinates of a grouped line (https://www.excelbanter.com/excel-programming/454952-coordinates-grouped-line.html)

David Cuthill[_3_]

Coordinates of a grouped line
 
In code I draw 2 identical vertical lines (the end of one line is the start of the next). The lines are then grouped to form a grouped shape that is twice the length of the individual lines. I then rotate the shape a set number of degrees. How do I determine the new coordinates of the bottom end of the rotated shape. Using .left and .top etc. all give me the position of the shape before rotation. Is there a parameter which describes the new position?

David



Peter T[_8_]

Coordinates of a grouped line
 
"David Cuthill" wrote in message
In code I draw 2 identical vertical lines (the end of one line is the start
of the next). The lines are then grouped to form a grouped shape that is
twice the length of the individual lines. I then rotate the shape a set
number of degrees. How do I determine the new coordinates of the bottom end
of the rotated shape. Using .left and .top etc. all give me the position of
the shape before rotation. Is there a parameter which describes the new
position?

David

==========

The Shape object as a Rotation property which returns degrees about the
centre of the shape, in your case the point where the two lines join.

Your shape will include two GroupItems, ie your line objects. Get the XY end
points of the lines from the opposite diagonals of the left/top/ht/wd
values. One point will be the centre, the other the point on the circle.

Use the rotation value with a bit of trigonometry to calculate the new
virtual positions of the lines. Don't forget degrees need to be converted to
radians with Excel's trig functions.

Peter T



David Cuthill[_3_]

Coordinates of a grouped line
 
Thanks Peter
I have got something to work based on your suggestions.


All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com