Click here to Skip to main content
15,894,362 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: WANTED: Programmer looking for an algorithmic challenge Pin
Xpnctoc24-Jul-10 12:09
Xpnctoc24-Jul-10 12:09 
AnswerRe: WANTED: Programmer looking for an algorithmic challenge Pin
ProtoBytes24-Jul-10 12:56
ProtoBytes24-Jul-10 12:56 
GeneralRe: WANTED: Programmer looking for an algorithmic challenge Pin
Xpnctoc25-Jul-10 8:29
Xpnctoc25-Jul-10 8:29 
GeneralRe: WANTED: Programmer looking for an algorithmic challenge Pin
ProtoBytes25-Jul-10 8:59
ProtoBytes25-Jul-10 8:59 
GeneralRe: WANTED: Programmer looking for an algorithmic challenge Pin
Xpnctoc25-Jul-10 10:45
Xpnctoc25-Jul-10 10:45 
AnswerRe: WANTED: Programmer looking for an algorithmic challenge [modified] Pin
Luc Pattyn25-Jul-10 12:12
sitebuilderLuc Pattyn25-Jul-10 12:12 
AnswerRe: WANTED: Programmer looking for an algorithmic challenge Pin
Member 419459325-Jul-10 12:52
Member 419459325-Jul-10 12:52 
QuestionGet the angle in radians of a shape made up with 2D points? Pin
venomation20-Jul-10 9:01
venomation20-Jul-10 9:01 
I have a square that is created in 2D points that can be dragged about and it rotates depending on where the mouse drags ect.

The problem I am facing is getting the angle in radians as there is a texture that I would like to apply over the wireframe.

I have this so far to get the angle:

void GetAngle()
      {
          float dx = Points[0].Position.X - Points[1].Position.X;
          float dy = Points[0].Position.Y - Points[1].Position.Y;

          float angle = (float)Math.Atan2(dy, dx);
          _angle = angle;

      }

This works fine apart from that when the square is rotate (points) the texture rotates accordingly but its position changes, here is a screen shot of the issue.
http://img339.imageshack.us/img339/7786/captureas.png[^]
The texture should be inside the wire-frame.

If i rotate it to the left instead to the right the texture is below the wireframe!
This is a link to the project :
http://www.mediafire.com/?2i62poeedyw192n[^]

It is in C# and uses the XNA game programming engine.

Thanks for your help! Big Grin | :-D
AnswerRe: Get the angle in radians of a shape made up with 2D points? Pin
Alan Balkany21-Jul-10 3:53
Alan Balkany21-Jul-10 3:53 
GeneralRe: Get the angle in radians of a shape made up with 2D points? Pin
venomation21-Jul-10 7:30
venomation21-Jul-10 7:30 
Questiondetect recursion during compilation Pin
invader8215-Jul-10 22:46
invader8215-Jul-10 22:46 
AnswerRe: detect recursion during compilation Pin
Alan Balkany16-Jul-10 4:04
Alan Balkany16-Jul-10 4:04 
AnswerRe: detect recursion during compilation Pin
Peter_in_278016-Jul-10 14:41
professionalPeter_in_278016-Jul-10 14:41 
AnswerRe: detect recursion during compilation Pin
T M Gray23-Jul-10 6:27
T M Gray23-Jul-10 6:27 
AnswerRe: detect recursion during compilation [OpenCL] Pin
ProtoBytes25-Jul-10 8:50
ProtoBytes25-Jul-10 8:50 
QuestionDistributing (different sized) objects Pin
Wjousts15-Jul-10 4:30
Wjousts15-Jul-10 4:30 
AnswerRe: Distributing (different sized) objects Pin
Alan Balkany16-Jul-10 4:01
Alan Balkany16-Jul-10 4:01 
GeneralRe: Distributing (different sized) objects Pin
Wjousts16-Jul-10 4:29
Wjousts16-Jul-10 4:29 
GeneralRe: Distributing (different sized) objects Pin
Alan Balkany16-Jul-10 4:37
Alan Balkany16-Jul-10 4:37 
GeneralRe: Distributing (different sized) objects Pin
Wjousts16-Jul-10 5:40
Wjousts16-Jul-10 5:40 
GeneralRe: Distributing (different sized) objects Pin
Alan Balkany16-Jul-10 5:50
Alan Balkany16-Jul-10 5:50 
GeneralRe: Distributing (different sized) objects Pin
Wjousts20-Jul-10 3:31
Wjousts20-Jul-10 3:31 
GeneralRe: Distributing (different sized) objects Pin
Wjousts20-Jul-10 7:56
Wjousts20-Jul-10 7:56 
GeneralRe: Distributing (different sized) objects Pin
Alan Balkany20-Jul-10 8:01
Alan Balkany20-Jul-10 8:01 
AnswerRe: Distributing (different sized) objects Pin
Luc Pattyn16-Jul-10 5:54
sitebuilderLuc Pattyn16-Jul-10 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.