+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12
  1. #11
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,158

    Default

    Registered forum members do not see this ad.

    Thanks Lee!
    It looks quite useful, for example finding the nearest/furthest distance between point list and origin:
    Code:
    _$ (extremum '(lambda ( a b ) (< (distance '(0. 0. 0.) a)(distance '(0. 0. 0.) b))) '((1.2 5.7 8.3) (9.4 2.6 0.3) (5.7 6.6 7.2)))
    (9.4 2.6 0.3)
    More expanded idea for usage would be constructing assoc list of (distN . enameN) to find the nearest/furthest entity.

    I see it as a combination between vl-some and vl-sort (like doing something like: (vl-some 'min lst) ).

    I'd say good job!

  2. #12
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,364

    Default

    Registered forum members do not see this ad.

    Thanks Grrr.

    In practice however, the function could be optimised, as the result of the comparison function when applied to the current extremum would be known and would therefore not need to be recalculated for each item in the list (this is demonstrated by the 'zmx' & 'zmi' variables used in my earlier function which returns the points with minimum & maximum z-coordinate values). This optimisation is not possible when an arbitrary comparison function is used.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Want to draw a series of "X" or "l l" lines between 2 points (weld lines)
    By p0peye in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 3rd Dec 2013, 10:58 pm
  2. Replies: 1
    Last Post: 7th Feb 2013, 10:28 pm
  3. Replies: 10
    Last Post: 29th Jan 2013, 08:38 pm
  4. selected objects not showing up as "dashed"
    By streetmike in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 3
    Last Post: 21st Jun 2010, 08:00 pm
  5. Lisp: Extract highest/lowest value from a list
    By ajs in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 12th Feb 2009, 02:58 am

Tags for this Thread

Bookmarks

Posting Permissions

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