transformation matrix...

Devin

Usenet Archive
Joined
Sep 27, 2001
Messages
342
Reaction score
0
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,
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
 
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
 
I see that your functions do transform back if you want. This is great Jon!

Thanks,

Devin
 
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
 
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
 
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,

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
 
Then I guess that Jon deserves part of the credit.

JOHN, YOU D' THE MAN ALSO!!!!
 

Latest threads

Back
Top