cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

How to skew something (via XFORM)

Anonymous
Not applicable
Apologies to Katarina:

Her thread was sort of hijacked into a discussion of XFORM, so I have copied it into the GDL forum for further discussion of XFORM. Her original question on walls should be answered in the remaining thread in Working in ArchiCAD:

http://archicad-talk.graphisoft.com/viewtopic.php?t=26825

Sincerely,
Karl

------------------------------

Hello,

I am trying to create a wall that is slanted in two different directions, see the picture, but I haven’t been able to figure out how to do. I have looked at the complex profiles tool, but I have only managed to create a wall that is slanted at the same direction in both ends, not in opposite directions.

Anyone who knows how to do?

Regards,
Katarina
22 REPLIES 22
Karl Ottenstein
Moderator
Peter wrote:
Is there any way I can obtain your XFORM object
Thanks again, Peter - object and PDF article are a zip download in the Depository link given. Unless I messed up the upload.

Cheers,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.7, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Hello Karl,
I downloaded the skewer.gsm object and the .PDF tutorial
from the depository. What I was referring to was not the
skewer.gsm object but an object you wrote a long time ago
that I thought was called "XFORM.gsm". This object demonstrated
the use of the XFORM transformation by setting the
XFORM command's parameters in various ways to show
how it deformed a PRISM_ command. Is this object also in
the Object Depository somewhere ?
Thanks,
Peter Devlin
Karl Ottenstein
Moderator
Sorry I misunderstood. I don't remember writing an object like that, but I'm getting old and forgetful. I wonder you're thinking of Oleg?

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.7, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Hello Karl,
I am sure it was you. Bellow is a quote from a post you wrote
back in 2004 in which you acknowledge my reference to that object
and it's author, you.

http://archicad-talk.graphisoft.com/viewtopic.php?p=14496&highlight=xform#14496

*************************************************************
"Peter Devlin wrote:
Karl Ottenstein wrote:
"Add a ROTX command into the script using a fresh angle parameter and you can then rotate the wall/window assembly as needed."

Would it not work better to use XFORM rather than ROTX as this transformation would shear both the wall and the window?

I am not sure about this but Karl would know.
I believe he was the one who wrote that excellent library part
that explained and demonstrated XFORM.

Just wondering,
Peter Devlin
**********************************************************

Thanks, Peter. XFORM would be better, especially if one wants the sills to be parallel to the ground. I was suggesting ROTX since it is so simple and something that everyone should know how to do.

I actually have a new little part called Skewer that I wrote for a contribution to David's in-progress GDL Cookbook 4 to explain and demonstrate XFORM. It lets you parametrically skew another library part in any and all axes. Everyone who gets the CB4 will get a copy. If ROTX doesn't give the result that Vincent needs, I'll ask David if he minds if I pre-release Skewer here.

Karl"
************************************************************

I hope you will remember because I thought it was great and
would like to have it again.
Thanks,
Peter Devlin
Karl Ottenstein
Moderator
Wow, that seems like a long time ago. But, the part I mention there, skewer.gsm, is the part that is uploaded here...

Cheers,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.7, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Hello Karl,
You wrote:
"But, the part I mention there, skewer.gsm, is the part that is uploaded here.."
Yes it is but notice that you say:
"I actually have a new little part called Skewer"
The object I refer to was older than the "new little part called Skewer"

I am sorry you don't recall writing that other object.
Thank you for talking to me.
Regards,
Peter Devlin
Karl Ottenstein
Moderator
Peter wrote:
Thank you for talking to me.
Of course! I did a Spotlight search and couldnt find anything else other than an early version of skewer (not parametric) called 'xform test'. Getting old and forgetful stinks.

Cheers,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.7, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Hello Karl,
I presently have at least three lib parts that use XFORM and to
make sure I was doing it right I copied the code out of your
object and pasted into my object, commented it out, and then
pasted again and changed the parameters I wanted and
used it to distort the elements I wanted.
Bellow is the snippet of code I copied. Maybe you will recognize it.
Notice your commented explanations for each parameter.

xform 1,0,0,0, !mulx 1,shear xz plane positive x, shear xy plane positive x
0,1,0,0, !shear zy plane positive z,muly 1, shear xy plane positive y
0,0,1,0 !shear zy plane positive z, shear zx plane positive z, mulz 1

I hope this looks familiar
Thanks,
Peter Devlin
Karl Ottenstein
Moderator
Looks like something I would write. I'm guessing that I posted it to the old GDL talk list and do not have a copy of the original post. I found a bunch of posts from 2001 that I made concerning XFORM that included GDL script pasted in the post, but not the particular one you show. So, must be something I didn't save...

I'm going to move this thread over to the Libararies forum (apologies to the person who started it)...

Thanks,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.7, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Karl Ottenstein
Moderator
Here's an old post, explaining XFORM...
	Subject: 	[GDLTalk] XFORM (was koordinates)
	Date: 	July 13, 2001 12:33:36 PM MDT
	To: 	        GDLTalk

> Following the coordinates thread, could anybody enlighten me on how
> XFORM is used?
>
> Laurent Godel


Hi Laurent,

Below is an explanation of XFORM in the form of an annotated 3D script.

Not sure if that is what you wanted?



Regards,

Karl



------------> Copy and paste the following into a 3D Script <---

! XFORM Overview and Demo

! Karl Ottenstein

! July 13, 2001



! Laurent asked about how the XFORM command is used in GDL.  This object

! gives an overview, demo, and some references to textbooks at the end.



! Representing a point as a vector (x, y, z), one can apply matrix algebra

! in order to move (translate), scale, or rotate that point.  According to

! Foley and van Dam (ref at end), the concept of homogeneous coordinates

! originated in geometry in 1946 by E. Maxwell at Cambridge.  Homogeneous

! coordinates, and their transformations, extend a point vector with an

! additional scale factor - so (x, y, z) becomes (x, y, z, 1)



! The homogeneous transformation matrix for translation only is:

!   1   0   0   0

!   0   1   0   0

!   0   0   1   0

!   dx  dy  dz  1

!

! So, with dx, dy, dz as 2, 4, 6 [original said "3, 6, 9" - no idea where that came from], similar to ADD 2, 4, 6:

!   1   0   0   0

!   0   1   0   0

!   0   0   1   0

!   2   4   6   1

!

! Multiply a point (x, y, z, 1) in homogenous coordinate space

! (the extra 1) with the above matrix:  pt * M and you get

! (x+2, y+4, z+6, 1) - a "translated" (shifted) point.

!

! Read DOWN the matrix columns as entering data for the XFORM, and

! leave off the last column of the 4x4 matrix above.



        XFORM 1, 0, 0, 2,

                0, 1, 0, 4,

                0, 0, 1, 6

! Make an asymmetric block in order to see what's going on

BLOCK 1, 4, 8



        DEL 1



! The homogeneous transformation matrix for scaling only is:

!   sx  0   0   0

!   0   sy  0   0

!   0   0   sz  0

!   0   0   0   1

!

! So, with sx, sy, sz as 2, .5, .5, similar to MUL 2, 0.5, 0.5

! you have:

!   2   0   0   0

!   0   0.5 0   0

!   0   0   0.5 0

!   0   0   0   1

!

! Multiply a point (x, y, z, 1) in homogenous coordinate space

! by the above matrix:  pt * M and you get

! (x*2, y*0.5, z*.05, 1)

!

! Read DOWN the matrix columns as entering data for the XFORM, and

! leave off the last column of the 4x4 matrix above.



        XFORM 2, 0, 0, 0,

                0, 0.5, 0, 0,

                0, 0, 0.5, 0

! Make a sphere in order to see what's going on

SPHERE 3



        DEL 1



! Before we proceed to rotation - let's combine translation and scaling,

! using the same numbers as above.  Notice that the XFORM below replaces

! one ADD and one MUL at this point:



! Translate and scale together

        XFORM 2, 0, 0, 2,

                0, 0.5, 0, 4,

                0, 0, 0.5, 6

! Make a sphere in order to see what's going on

SPHERE 3



        DEL 1



!The transformation matrix for rotation "a" degrees about the Z axis is:

!   cos(a)  sin(a)  0       0

!   -sin(a) cos(a)  0       0

!   0       0       1       0

!   0       0       0       1

!For "a" degrees about the X axis:

!   1       0       0       0

!   0       cos(a)  sin(a)  0

!   0       -sin(a) cos(a)  0

!   0       0       0       1

!And, for "a" degrees about the Y axis:

!   cos(a)  0       -sin(a) 0

!   0       1       0       0

!   sin(a)  0       cos(a)  0

!   0       0       0       1



! So...let's rotate a block

! about the Y axis 30 degrees...same as ROTY 30



ang = 30

cosa = cos(ang)

sina = sin(ang)



        XFORM cosa, 0, sina, 0,

                0, 1, 0, 0,

                -sina, 0, cosa, 0

! Make an asymmetric block in order to see what's going on

BLOCK 1, 4, 8



        DEL 1

END

!

! Note that the matrices are combined by multiplying them together,

! giving a new 4x4 transformation matrix. Any number of transformations

! can be combined into one final matrix - represented by a single

! GDL XFORM.  Email me if you want me to post an explanation and

! example.

!

! This is probably not that useful for most GDL programmers, but

! would be very handy for API developers.  (Picture an add-on where the

! user has sliders to rotate, scale and translate an object.  The final

! settings could be saved as a single XFORM.)



! References

!

! These books are dated, as am I.  No doubt there are newer editions,

! and even other, newer books out there now.  Two of them were

! classics, and I expect still are.

!

! Foley, J. D. and van Dam, A. Fundamentals of Interactive Computer

! Graphics.  Addison-Wesley (1982) 664 pages.  This was THE book to

! have - there must be a newer edition.

! ISBN for this edition 0-201-14468-9.

!

! Giloi, Wolfgang K. Interactive Computer Graphics.

! Prentice-Hall (1978) 354 pages.

!

! Harrington, Steven.  Computer Graphics: A Programming Approach.

! McGraw-Hill (1983) 448 pages.

!

! Newman, William M. and Sproull, Robert F. Principles of

! Interactive Computer Graphics, 2nd Edition.

! McGraw-Hill (1979) 541 pages.  This was the bible for graphics

! when I was in school.

!

! Karl Ottenstein, July 2001.

One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.7, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB