Page 2 of 2 FirstFirst 12
Results 13 to 15 of 15

Thread: Finding arc angles

  1. #13
    Registered
    Join Date
    Aug 2007
    Location
    Argentina
    Posts
    43
    Downloads
    0
    Uploads
    0
    Try this, is a modified version of your code.

    Perhaps contain some bugs, because I could not verify.


    Code:
    function LWBulgeCalc($xs, $xe, $ys, $ye, $bulge)
    {
    	$result = array();
    
    	$dx = ($xe - $xs)/2 ;
    	$dy = ($ye - $ys)/2 ;
    	$a = (1/$bulge-$bulge)/2 ;
    	$r = abs($bulge+1/$bulge)*sqrt($dx*$dx + $dy*$dy)/2 ; //Radius circle
    
    	$dr1x =  $dy*$a - $dx ;
    	$dr1y = -$dx*$a - $dy ;
    
    	$theta_s = rad2deg(acos($dr1x/$r)) ;
    	if($dr1y <  0) $theta_s = 360 - $theta_s ;
    
    	$theta_e = $theta_s + 4*rad2deg(atan($bulge))  ;
    	if($theta_e <  0)      $theta_e += 360  ;
    	if($theta_e >=  360) $theta_e -= 360  ;
    
    
    	$result[0] = $xe-$dr1x ;
    	$result[1] = $ye-$dr1y ;
    	$result[2] = $r        ;
    	$result[3] = $theta_s  ;
    	$result[4] = $theta_e  ;
    
    	return $result;
    }
    Last edited by _Eduardo_; 07-26-2010 at 07:40 PM.


  2. #14
    Registered
    Join Date
    Oct 2010
    Location
    gr
    Posts
    1
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by fantasy2 View Post
    YES! I guess this is my lucky evening!
    I still don't know exactly what I changed but luck is on my side and I changed the right values. Except for closing the drawing, everything goes as planned!
    Can you please post your modified code, 'cause i am stuck in the same point, the start and end angles.

    I can't find the right conditions to get always the right angles.


  3. #15
    Registered bradodarb's Avatar
    Join Date
    Oct 2004
    Location
    usa
    Posts
    147
    Downloads
    0
    Uploads
    0
    Hello,

    I use this in my geometry lib::

    Code:
    	public static double GetAnglefromPoints(double x1, double y1, double x2, double y2)
            {
                double retval = 0;
    
                retval = Math.Round(Math.Atan2((y2 - y1),
                   (x2 - x1)), 4);
    
                retval = R2D(retval);
    
                return retval;
    
            }
    
            public static double R2D(double iangle)
            {
                return iangle * (180.0 / Math.PI);
            }

    And with GetAnglefromPoints, the first X,Y is center point and the second will either be start or end.


    HTH,
    Brad Murry


Page 2 of 2 FirstFirst 12

Similar Threads

  1. Help figuring out the angles
    By Shanghyd in forum Autodesk Software (Autocad, Inventor etc)
    Replies: 3
    Last Post: 04-14-2010, 12:15 AM
  2. Positive angles
    By GBRAVO in forum Visual Mill
    Replies: 0
    Last Post: 06-22-2009, 11:33 PM
  3. Newbie- CUTTING BEVELED ANGLES
    By mdyust in forum WoodWorking
    Replies: 3
    Last Post: 09-05-2008, 08:10 PM
  4. slopes and angles
    By massbaster in forum Sharp CNC
    Replies: 1
    Last Post: 07-11-2007, 11:14 PM
  5. how to mill angles?
    By cowanrg in forum General Metalwork Discussion
    Replies: 19
    Last Post: 05-14-2007, 10:35 AM

Posting Permissions


 


About CNCzone.com

    We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

Follow us on

Facebook Dribbble RSS Feed


Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.