‎2008-11-15 06:09 PM
‎2008-12-13 10:46 PM
Peter wrote:Thanks again, Peter - object and PDF article are a zip download in the Depository link given. Unless I messed up the upload.
Is there any way I can obtain your XFORM object
‎2008-12-13 11:38 PM
‎2008-12-14 12:08 AM
‎2008-12-14 01:28 AM
‎2008-12-14 02:00 AM
‎2008-12-14 02:17 AM
‎2008-12-14 04:39 AM
Peter wrote: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.
Thank you for talking to me.
‎2008-12-14 04:45 PM
‎2008-12-14 08:13 PM
‎2008-12-14 08:32 PM
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.