Results 1 to 2 of 2

Thread: Calculate next polar coordinate if line is not straight

  1. #1
    Login to Give a bone
    0

    Angry Calculate next polar coordinate if line is not straight

    Dear ,

    I want to move an object (car object) on road object(which has turns i.e S type road) , i am calculating the polar coordinate based on the angle between two points distance between two points and moving the car object to the next polar coordinate it works fine if road is straight , but how to calculate next point if road is not straight.

    Please help me on this .

    (defun c:newmove ( / ss pt)
    (princ "\r Move Car ")
    (setq ss (entsel))
    (setq pt1 (getpoint "\nSelect base point: "))
    (setq forang2 (getpoint "\nSelect another point on road to calculate angle: "))
    (setq ang1 (apply 'atan (cdr (reverse (mapcar '- forang2 pt1)))))
    (setq pt2 (polar pt1 ang1 0.0004))
    (setq ang2 (apply 'atan (cdr (reverse (mapcar '- pt2 forang2)))))
    (setq pt3 (polar pt2 ang2 0.0004))
    (setq ang3 (apply 'atan (cdr (reverse (mapcar '- pt3 pt2)))))
    (prin1 ang3)
    (setq pt4 (polar pt3 ang3 0.0004))
    (setq dis4 (distance pt3 pt4))
    (setq ang4 (apply 'atan (cdr (reverse (mapcar '- pt4 pt3)))))
    (setq pt5 (polar pt4 ang4 0.0004))
    (setq ang5 (apply 'atan (cdr (reverse (mapcar '- pt5 pt4)))))
    (setq pt6 (polar pt5 ang5 0.0004))
    (setq ang6 (apply 'atan (cdr (reverse (mapcar '- pt6 pt5)))))
    (setq pt7 (polar pt6 ang6 0.0004))
    (setq ang7 (apply 'atan (cdr (reverse (mapcar '- pt7 pt6)))))
    (setq pt8 (polar pt7 ang7 0.0004))
    (setq ang8 (apply 'atan (cdr (reverse (mapcar '- pt8 pt7)))))
    (setq pt9 (polar pt8 ang8 0.0004))
    (command "._move" ss "" pt1 pt2)
    (command "DELAY" 10000)
    (command "._move" ss "" pt2 pt3)
    (command "DELAY" 10000)
    (command "._move" ss "" pt3 pt4)
    (command "DELAY" 10000)
    (command "._move" ss "" pt4 pt5)
    (command "DELAY" 10000)
    (command "._move" ss "" pt5 pt6)
    (command "DELAY" 10000)
    (command "._move" ss "" pt6 pt7)
    (command "DELAY" 10000)
    (command "._move" ss "" pt7 pt
    (command "DELAY" 10000)
    (command "._move" ss "" pt8 pt9)
    (command "DELAY" 10000)
    (princ "\nEnter LazyMove to run program")
    )

    Thanks,

    Sanjay

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,422
    Login to Give a bone
    0

    Default Re: Calculate next polar coordinate if line is not straight

    I'd love to see this finished, but to account for steering limits, various wheelbases & tracking, and trailers makes for an extremely complex program.
    You should look at AutoTurn & AutoTrack. They handle this nicely.
    Tom Beauford P.S.M. - Civil 2020 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

Similar Threads

  1. 2012: From straight line to spline line
    By diesellam in forum Revit Architecture - General
    Replies: 1
    Last Post: 2012-08-17, 01:31 PM
  2. Replies: 0
    Last Post: 2011-01-25, 05:59 AM
  3. Cylindrical (polar) coordinate system
    By strozy in forum Robot Structural Analysis
    Replies: 1
    Last Post: 2010-07-08, 06:47 AM
  4. Straight Line from a Curved polyline
    By rhayes.99001 in forum ACA General
    Replies: 2
    Last Post: 2006-06-09, 09:25 AM
  5. Can't array in a straight line (vertically)
    By Adam Mac in forum Revit Architecture - Families
    Replies: 6
    Last Post: 2006-01-12, 10:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •