# Search the Community

Showing results for tags 'atn'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• News, Announcements & FAQ
• Feedback
• AutoCAD 2D Drafting, Object Properties & Interface
• AutoCAD Drawing Management & Output
• AutoCAD 3D Modelling & Rendering
• AutoCAD Bugs, Error Messages & Quirks
• The CUI, Hatches, Linetypes, Scripts & Macros
• AutoLISP, Visual LISP & DCL
• .NET, ObjectARX & VBA
• Application Beta Testing
• Application Archive
• Other Autodesk Products
• Autodesk 3ds Max
• Autodesk Revit
• Autodesk Inventor
• Autodesk Software General
• SketchUp
• Rhino
• SolidWorks
• MicroStation
• Design Software
• Catch All
• Resources
• Tutorials & Tips'n'Tricks
• Blocks, Images, Models & Materials
• Community
• Introduce Yourself
• Showcase
• Work In Progress
• Jobs & Training
• Chat
• Competitions

### Categories

• Programs and Scripts
• Images
• Backgrounds

• 0 Replies

• 0 Reviews

• 0 Views

Found 1 result

1. ## can't get coordinates straight

I have set in autocad the correct angle settings, have been applying 20 different functions to obtain the correct angle (Y axis) between two coordinates, but I keep getting strange angles back from this routine. Either the correct angle is difference with 90, or 450. Any idea why? I have gone through most of math forums on the internet. I need the angle correctly in order to scale a polygon. thanks. Public Function GiveAngle(DegRad As Boolean, x1 As Double, y1 As Double, x2 As Double, y2 As Double) As Double Dim Xdist, Ydist As Double Dim ATAN3 As Double Dim PI As Double PI = 3.14159265358979 Xdist = (x2 - x1) Ydist = (y2 - y1) If Abs(Ydist) > Abs(Xdist) Then If Ydist > 0 Then ATAN3 = Math.Atn((x2 - x1) / (y1 - y2)) Else ATAN3 = Math.Atn((x2 - x1) / (y1 - y2)) + PI End If Else If Xdist > 0 Then ATAN3 = 0.5 * PI - Atn((x2 - x1) / (y1 - y2)) Else ATAN3 = -0.5 * PI - Atn((x2 - x1) / (y1 - y2)) End If End If GiveAngle = ATAN3 * 180 / PI End Function
×
×
• Create New...