transformation matrix...

Discussion in 'AutoCAD' started by Devin, Jul 31, 2003.

  1. Devin

    Devin Guest

    Does anybody know where I could find a routine that would transform a pt by
    a supplied transformation matrix?

    Also, given a trasformation matrix, what's the matrix to return back from
    it. Would it be -matrix?

    Thanks,

    Devin
     
    Devin, Jul 31, 2003
    #1
  2. Devin

    BillZ Guest

    Devin,
    This is a snip of a transformation matrix I have written for the insertion point of an inserted border.
    It's been a while so I don't remember everything about it, only that it multiplies the x,y,z to the object coordinate system numbers delivered by nentselp. HTH

    Bill
     
    BillZ, Jul 31, 2003
    #2
  3. Devin

    Devin Guest

    Hi Jon,

    Thanks for the page, I'll research. I really want to understand this 3d
    stuff better. What I was referring to in my statement...

    O.K. so given a transformation matrix I can transform a point to that
    matrix. But what if I want to transform that point back to the original pt.
    Perhaps I'll be transforming points, moving them and then transforming them
    back.

    Thanks for your help,

    Devin
     
    Devin, Jul 31, 2003
    #3
  4. Devin

    Devin Guest

    I see that your functions do transform back if you want. This is great Jon!

    Thanks,

    Devin
     
    Devin, Jul 31, 2003
    #4
  5. Devin

    Joe Burke Guest

    Devin,

    Here's two functions (file attached) which deal with WCS <> OCS
    transformations. Thanks to John Uhden and Larry Leuallen.

    I think the first one, @OCS2WCS, is basically the same as Bill's post except
    it accepts either a 4x3 matrix as returned by nentsel, or a 4x4 from
    nentselp.

    The other one, to go the other way, @WCS2OCS, has a front end by John which
    calls Larry's functions, which in turn call each other. In other words,
    things get real complicated. I sure don't understand how it works... but it
    does. Note, this is a subset of Larry's functions pared down by me to
    include only the required functions. It will also accept either a 4x3 or 4x4
    matrix.

    Joe Burke
     
    Joe Burke, Jul 31, 2003
    #5
  6. Devin

    Devin Guest

    Thanks Joe.
     
    Devin, Jul 31, 2003
    #6
  7. Devin

    Joe Burke Guest

    Jamie,

    A line in block... well, actually an "insert".

    Command: (setq e (nentselp))

    Select object: (<Entity name: 40095b50> (100.966 25.7356 0.0) ((1.0 0.0 0.0
    81.8045) (0.0 1.0 0.0 19.5411) (0.0 0.0 1.0 0.0) (0.0 0.0 0.0 1.0)) (<Entity
    name: 40095b60>))

    From (entget (car e)) you can find the start and end points (10 and 11
    codes) of the line expressed in terms of the OCS of the block definition.
    The second item (cadr e) is the pick point. The third item (caddr e) is a
    4x4 transformation matrix. And the last item is the ename of the insert.

    So to get the start point of the line in terms of WCS using the function
    posted earlier:

    (setq wcspoint (@OCS2WCS startpoint (caddr e)))

    Feed it the point to transform and the matrix. Hope this is clear and I got
    it right.

    BTW, you could use nentsel instead of nentselp. It would work thanks to
    John's attention to detail.

    Joe Burke
     
    Joe Burke, Aug 1, 2003
    #7
  8. Devin

    Jamie Myers Guest

    YOU D' THE MAN JOE!!!!
    You took something that was hard for me to understand and explained it where
    I can understand it. Works perfectly.
    Thank you!
    Thank you!
    Thank you!
     
    Jamie Myers, Aug 1, 2003
    #8
  9. Devin

    Joe Burke Guest

    Jamie,

    You're welcome.

    BTW, it's all news to me recently. And I wouldn't know poop about it without
    John Uhden's help.

    Joe Burke
     
    Joe Burke, Aug 1, 2003
    #9
  10. Devin

    Jamie Myers Guest

    Then I guess that Jon deserves part of the credit.

    JOHN, YOU D' THE MAN ALSO!!!!
     
    Jamie Myers, Aug 1, 2003
    #10
  11. Devin

    John Uhden Guest

    WCS2OCS.LSP has been posted in
    news://discussion.autodesk.com/autodesk.autocad.customer-files
     
    John Uhden, Aug 3, 2003
    #11
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.