954,152 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem in creating a rectangle at a angle

hi all,
i have to make a rectangle in c++.
The inputs are length,breadth,center point and the aspect angle.
The rectangle should be tilted at that angle

aviral82
Newbie Poster
4 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

Hi;
There is built in funtion in c++ for drawing a rectangle
U should include graphics.h as the header file
and call the function rectangle(int,int,int,int);

It takes four parameter as x1,y1,x2,y2 as the coordinates

For the angle U can calculate from the angle that what coordinates u have to give,,,,,,,,.

I hope that the problem is clear but if still there are some problems ask again......


Fahad

fahad
Light Poster
27 posts since Sep 2004
Reputation Points: 14
Solved Threads: 0
 

Take the points (1,1), (1,-1), (-1,1) and (-1,-1). Stretch the set to however wide/tall you need, then run all four through

x *= cos(a);
y *= sin(a);

It's the same principle as in the rotated-ellipse problem.

Nuez_Jr
Newbie Poster
18 posts since Oct 2004
Reputation Points: 10
Solved Threads: 1
 

Hi there,

Per the terms of our forum, have you written any code yourself? We're not here to write code or do your homework for you-- you need to show effort of your own for us to help you more effectively.

alc6379
Cookie... That's it
Team Colleague
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You