Board index » delphi » TPoints and a pentagon not sitting uprightly.
TPoints and a pentagon not sitting uprightly.
2003-12-02 10:25:25 AM
Starting from point [X,Y] I draw a line angled 60 degrees from that line.
The line equates to 50 pixels in length. It ends at point [A,B]. I
Calculate point A,B by doing A = 50 Cos(30) + X, and B by 50 Sin(30) + Y.
Once I have that point, I want to rotate another 108 degrees to begin
drawing a pentagon. The next line will be 108 deg off the previous one and
also 50 in length. How the heck do I calculate where to put the next set of
|John Herbster (TeamB)
2003-12-02 09:45:10 PM
Re:TPoints and a pentagon not sitting uprightly.
If you are trying to draw a regular pentagon why don't you
Starting from point [X,Y] I draw a line angled 60
start by choosing a center and radius and divide the circle
into 5 parts with five points like this:
For i := 0 to 4 do begin
angle := 2*pi*i/5;
X[i] := radius*sin(angle) + Xcenter;
Y[i] := radius*cos(angle) + Ycenter;
Also remember that the trig functions work on radians,
not degrees. Rgds, JohnH