User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 391,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,775 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 1930 | Replies: 3
Reply
Join Date: Sep 2004
Posts: 4
Reputation: aviral82 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
aviral82 aviral82 is offline Offline
Newbie Poster

News problem in creating a rectangle at a angle

  #1  
Oct 6th, 2004
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2004
Posts: 27
Reputation: fahad is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
fahad fahad is offline Offline
Light Poster

Re: problem in creating a rectangle at a angle

  #2  
Oct 6th, 2004
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
Reply With Quote  
Join Date: Oct 2004
Location: Bellingham, WA
Posts: 12
Reputation: Nuez_Jr is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Nuez_Jr's Avatar
Nuez_Jr Nuez_Jr is offline Offline
Newbie Poster

Re: problem in creating a rectangle at a angle

  #3  
Oct 6th, 2004
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.
Reply With Quote  
Join Date: Dec 2003
Location: Nashville, TN
Posts: 2,333
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Rep Power: 11
Solved Threads: 101
Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: problem in creating a rectangle at a angle

  #4  
Oct 7th, 2004
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.
Alex Cavnar, aka alc6379
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 8:39 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC