home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,772 of 10,840   
   Steve Gerrard to The Mess   
   Re: Line Method Function   
   04 Dec 05 09:22:31   
   
   From: mynamehere@comcast.net   
      
   "The Mess"  wrote in message   
   news:laFkf.210$kt5.38944@news20.bellglobal.com...   
      
   > I wish I had a function to draw a line, giving the angle and length but I do   
   > not have the math skills involved to do this. Does anyone have a function   
   that   
   > they care to share that does this?   
   > I was thinking something like:   
      
   > Public Sub DrawLine(X1 as single, Y1 as single, Len as single, Angle as   
   > single, byref  X2 as single, byref  Y2 as single)   
      
   > Any help would be appreciated. I tried some searches and get lots of math   
   > lessons but I would have a lot to learn to accomplish this. Or maybe there is   
   > a better way?   
      
   I'm afraid that any answer is going to involve some math, but not that much...   
      
   If your angle is in degrees, you will need  to convert it to radians:   
       Angle = Angle / 180 * 3.14159625   
      
   The basic formulas you need are   
       X2 = X1 + Cos(Angle) * Len   
       Y2 = Y1 + Sin(Angle) * Len   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca