Faqts : Computers : Programming : Languages : Bbcbasic

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 2 people (100%) answered Yes
Recently 2 of 2 people (100%) answered Yes

Entry

Graphics: Transformation: Linear: BBCBasic: What is the general effect of any linear transformation?

Jun 4th, 2005 19:50
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 29 May 2021 - 02:19 pm ------------------------
Graphics: Transformation: Linear: BBCBasic: What is the general effect 
of any linear transformation?
---
The general effect of any linear transformation, applied simultaneously
to all points of a given object will be a stretching and rotation of
the whole object.
It will e.g. transform any square into a parallelogram, or a cube into
a parallelepiped.
In this program you apply any linear transformation by randomly varying
the 9 numbers in the general linear transformation, applying this
simultaneously to all 4 points (and a few more)of the square and
showing the result.
Each time you press say the spacebar, you will thus be shown a
parallelogram (which resulted thus by simultaneously stretching and
rotating the arrows pointing to each of the points of that object, that
is a square).
Thus the general effect of any linear transformation on a square is
that it becomes a rotated parallelogram.
Using your imagination, you can see that if you apply this on a circle,
in general any linear transformation will transform it into a rotated
and possibly sheared ellips.
In general it will thus rotate and shear the original object, say a car
or a font.
---
--- cut here: begin --------------------------------------------------
 MODE 18
 VDU 29, 640; 512;
 :
 PROCDraw( 1, 0, 0, 0, 1, 0, 0, 0, 1 )
 END
 :
 :
 :
 DEF PROCDraw( s11, s12, s13, s21, s22, s23, s31, s32, s33 )
 LOCAL stopB%
 REPEAT
   RESTORE
   REPEAT
     READ drawV%, x, y, z
     stopB% = ( x = -1 AND y = -1 AND z = -1 )
     IF NOT stopB% THEN PROCDrawSub( drawV%, x, y, z, s11, s12, s13, 
s21, s22, s23, s31, s32, s33 )
   UNTIL stopB%
   s11 = RND( 1 )
   s12 = RND( 1 )
   s13 = RND( 1 )
   s21 = RND( 1 )
   s22 = RND( 1 )
   s23 = RND( 1 )
   s31 = RND( 1 )
   s32 = RND( 1 )
   s33 = RND( 1 )
   REPEAT UNTIL GET
   CLG
 UNTIL FALSE
 ENDPROC
 :
 DEF PROCDrawSub( drawV%, x, y, z, s11, s12, s13, s21, s22, s23, s31, 
s32, s33 )
 x = s11 * x + s12 * y + s13 * z
 y = s21 * x + s22 * y + s23 * z
 z = s31 * x + s32 * y + s33 * z
 PLOT drawV%, 100 * x, 100 * y
 ENDPROC
 :
 DATA 4, 1.0, 1.0, 0
 DATA 5, 1.5, 1.0, 0
 DATA 5, 2.0, 1.0, 0
 DATA 5, 2.0, 1.5, 0
 DATA 5, 2.0, 2.0, 0
 DATA 5, 1.5, 2.0, 0
 DATA 5, 1.0, 2.0, 0
 DATA 5, 1.0, 1.5, 0
 DATA 5, 1.0, 1.0, 0
 DATA 5, -1, -1, -1
--- cut here: end ----------------------------------------------------
---
---
Internet: see also:
---
Computer: Graphics: Vector: Link: Overview: Can you give overview of 
links about vector graphics?
http://www.faqts.com/knowledge_base/view.phtml/aid/36506/fid/1810
----------------------------------------------------------------------