• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X PCB Editor
  3. arc length or angle skill function

Stats

  • Replies 3
  • Subscribers 159
  • Views 13890
  • Members are here 0
More Content

arc length or angle skill function

Ejlersen
Ejlersen over 12 years ago

Hi

Does anyone know of a function to calculate the angle of an arc given 2 coordinates and the radius

or calculate the arc length

Either one would work out, but I've not been able to find such a function.

I know about axlDBGetLength but the problem is that my arc does not have it's own dbid since I'm traversing segments of shapes.

Thanks in advance 

Best regards

Ole

  • Sign in to reply
  • Cancel
Parents
  • eDave
    eDave over 12 years ago

    Hi Ole,

    Try using these functions:

     defun( DE_angleBetweenPtsWithRadius (pt2, pt1, r, cw), DE_radius2Angle(car(pt2) - car(pt1), cadr(pt2) - cadr(pt1), r) * if(cw, 1, -1))

    defun( DE_circularArcLength (pt1, pt2, r), abs(0.017453 * r * DE_angleBetweenPtsWithRadius(pt1, pt2, r, nil)))

    defun( DE_radius2Angle (x, y, r)

    if(zerop(x) && zerop(y) then 0.0 else DE_Rad2deg(2 * asin(DE_Rndp(if(zerop(x), y / (2 * r * sin(atan2(y, x))), x / (2 * r * sin(atan2(x, y)))), 8))))

    )

    defun( DE_Rad2deg (radians) radians * 90.0 / asin(1))

    defun( DE_Rndp (x, dec), "nx"), round(x * expt(10, dec)) / float(expt(10, dec)))

    Note that, if you are using 16.6 you can use the new function  axlRadToDeg.

    Hopefully the parameters are self explanatory. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • eDave
    eDave over 12 years ago

    Hi Ole,

    Try using these functions:

     defun( DE_angleBetweenPtsWithRadius (pt2, pt1, r, cw), DE_radius2Angle(car(pt2) - car(pt1), cadr(pt2) - cadr(pt1), r) * if(cw, 1, -1))

    defun( DE_circularArcLength (pt1, pt2, r), abs(0.017453 * r * DE_angleBetweenPtsWithRadius(pt1, pt2, r, nil)))

    defun( DE_radius2Angle (x, y, r)

    if(zerop(x) && zerop(y) then 0.0 else DE_Rad2deg(2 * asin(DE_Rndp(if(zerop(x), y / (2 * r * sin(atan2(y, x))), x / (2 * r * sin(atan2(x, y)))), 8))))

    )

    defun( DE_Rad2deg (radians) radians * 90.0 / asin(1))

    defun( DE_Rndp (x, dec), "nx"), round(x * expt(10, dec)) / float(expt(10, dec)))

    Note that, if you are using 16.6 you can use the new function  axlRadToDeg.

    Hopefully the parameters are self explanatory. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information