|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Math drawing questionHi group,
I have got a math/drawing question and as the question will show my math knowledge is of toddler level... I've got a line going from x1,y1 to x2,y2 then the user inputs an angle and a length for a second line starting from x2,y2 going to x3,y3 But how do I calculate the value for x3,y3? I think I need to do something with cosinus and sinus and my angle and length but I don't know what. Thanks in advance, Greetz, Peter Peter Proost wrote:
> I've got a line going from x1,y1 to x2,y2 then the user inputs an x3=x2+r*cos(t)> angle and a length for a second line starting from x2,y2 going to > x3,y3 But how do I calculate the value for x3,y3? I think I need to do > something with cosinus and sinus and my angle and length but I don't > know what. y3=y2+r*sin(t) where r is the length (commonly referred to as the radius in this situation) and t is the angle in radians (theta, angles are usually called theta for these things). (angle in radians)=(angle in degrees)*pi/180 And don't forget that the screen y-axis is upside-down compared to what you'd draw with pencil and paper. -- Andrew On 28/04/2010 10:28, Andrew Morton wrote:
Show quoteHide quote > Peter Proost wrote: Thanks a lot exactly what I needed. I was already aware of the .net y >> I've got a line going from x1,y1 to x2,y2 then the user inputs an >> angle and a length for a second line starting from x2,y2 going to >> x3,y3 But how do I calculate the value for x3,y3? I think I need to do >> something with cosinus and sinus and my angle and length but I don't >> know what. > > x3=x2+r*cos(t) > y3=y2+r*sin(t) > > where r is the length (commonly referred to as the radius in this situation) > and t is the angle in radians (theta, angles are usually called theta for > these things). > > (angle in radians)=(angle in degrees)*pi/180 > > And don't forget that the screen y-axis is upside-down compared to what > you'd draw with pencil and paper. > axis being upside-down Thanks again Hi,
I've got an extra question which I forgot to mention in my original post. Thanks to your answer I can calculate x3,y3, but they need to be calculated with respect to the angle of the x1,y1 - x2,y2 line. I hope you get what I mean. Thanks again, Peter Peter Proost wrote:
> I've got an extra question which I forgot to mention in my original Angle of line (p1,p2) in radians=atan2(y2-y1, x2-x1) where p1=(x1,y1) and > post. Thanks to your answer I can calculate x3,y3, but they need to be > calculated with respect to the angle of the x1,y1 - x2,y2 line. I hope > you get what I mean. p2=(x2,y2). I recommend that you keep all angles in the code in radians, and only do the degrees<->radians conversions at the user-interface level. HTH -- Andrew On 28/04/2010 11:44, Andrew Morton wrote:
Show quoteHide quote > Peter Proost wrote: Thanks again for your answer, I'll give it a try later on. Just got out >> I've got an extra question which I forgot to mention in my original >> post. Thanks to your answer I can calculate x3,y3, but they need to be >> calculated with respect to the angle of the x1,y1 - x2,y2 line. I hope >> you get what I mean. > > Angle of line (p1,p2) in radians=atan2(y2-y1, x2-x1) where p1=(x1,y1) and > p2=(x2,y2). > > I recommend that you keep all angles in the code in radians, and only do the > degrees<->radians conversions at the user-interface level. > > HTH > of a meeting, and got a new one coming in 5 minutes. Thanks, Peter
Determine depend on services
Integrating the webBrowser controlling form Can't evaluate expressionin IDE debug mode Upload/Download files in Chunks on FTP The string font is ugly on chart Do not work well for Windows 7? a few basic question about resource files Is This Method Of Creating a String Possible? How to send email with no outlook and SMTP server ? System.net Utilities.FTP or ProcessStart? |
|||||||||||||||||||||||