Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shape rotation

Status
Not open for further replies.

Froskoy

Programmer
Jul 25, 2009
18
0
0
GB
Hi,

I'm trying to rotate a rectangle in Delphi 4.

I looked at this:

which is the sort of thing I'm looking for but this requires a collection of points, and I need to rotate a shape.

I can't install any extra components, as my workstation is on a network and I don't have admin privileges.

Many thanks,

Froskoy.
 
A shape is nothing more than an array of TPoint as shown in the link. You should not need to install any components to do this as shown in your link.

Roo
Delphi Rules!
 
Thanks very much for your reply. I've made an array of TPoint so I can use the code pretty much as supplied in the link.

Here's my code:

Code:
type TBoatTop = array[1..3] of TPoint;

var shpBoatTop : TBoatTop;

procedure TfrmRotation.FormCreate(Sender: TObject);
begin
     //creates triangle of points
     shpBoatTop[1].X:=100;
     shpBoatTop[1].Y:=50;
     shpBoatTop[2].X:=60;
     shpBoatTop[2].Y:=80;
     shpBoatTop[3].X:=160;
     shpBoatTop[3].Y:=80;

     //how do I make these points show up on screen i.e. dynamically create the object
     //how do I  fill the space in between these points e.g. green, so that it looks like a nice shape
end;

//rotation and translation procedures......

So, as commented in the code, my two questions are: how do I dynamically create this so that it shows up on screen?

How do I fill them in to make them look like a shape?

Thanks very much!

Froskoy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top