You need to use some tedious trigonometry and break the rectangle into some
appropriate triangles to calculate the x and y offsets of the corners with
respect to the coordinates of the centre and the angle of rotation. I
started to do it on paper to scan in but made a mistake and I don't really
have time to go into such depth. Unless you want to contract me to write a
routine of course 🙂
What you're doing is a fairly simple task in vector graphics, which have
been around a long time; if you look up a web article, or even a computer
graphics textbook, they should tell you fairly early on how to do simple 2D
rotations.
--
Craig Graham
Physicist/Labview Programmer
Lancaster University, UK
"Helper" wrote in message
news:50650000000800000077390000-1
011517314000@exchange.ni.com...
> HI,
> I have a picture control on the front panel of my VI. I need to be
> able to draw rectangles of different lengths and at different places
> during runtime.I'm almost certain that this is too complicated of a
> question to get an ideal answer to, but basically I was wondering if
> anyone had any ideas of some algorithm that I could use to figure out
> the endpoints of this "rectangle" if what I'm given during runtime is
> an angle where it should be relative to the center of the picture and
> the length that the rectangle should be? (The width is going to be
> constant). Any ideas will be appreciated,
> Thanks