Category : OS/2 Files
Archive   : IRIT-OS2.ZIP
Filename : MORPHING.IRT

 
Output of file : MORPHING.IRT contained in archive : IRIT-OS2.ZIP
#
# A simple example of morphing.
#
# Gershon Elber, July 1992.
#

save_res = resolution;
resolution = 10;
if ( machine, "=", msdos, ( resolution = 7 ) );
step = 0.05;
if ( machine, "=", msdos, ( step = 0.2 ) );

# Needs these variable in loops.
SrfIso = 0;
MSrf = 0;

FloorLvl = -0.72;

v1 = vector( -16.0, -16.0, FloorLvl );
V2 = vector( -16.0, 16.0, FloorLvl );
v3 = vector( 16.0, 16.0, FloorLvl );
v4 = vector( 16.0, -16.0, FloorLvl );
Floor = poly( list( v1, v2, v3, v4 ) );
color( Floor, red );
attrib( Floor, "rgb", "244,164,96" );
attrib( Floor, "texture", "wood" );
attrib( Floor, "reflect", "0.3" );

#############################################################################
# First Morphing Sequence. #
#############################################################################

Srf1 = ruledsrf( circle( vector( 0.0, 0.0, FloorLvl + 0.01 ), 1.0 ),
circle( vector( 0.0, 0.0, FloorLvl + 0.01 ), 0.01 ) );
color( Srf1, yellow );

bcross = cbspline( 3,
list( ctlpt( E3, 0.0, 0.0, -0.71 ),
ctlpt( E3, 0.2, 0.0, -0.72 ),
ctlpt( E3, 0.25, 0.0, -0.7 ),
ctlpt( E3, 0.25, 0.0, -0.1 ),
ctlpt( E3, 0.2, 0.0, -0.05 ),
ctlpt( E3, 0.15, 0.0, 0.0 ),
ctlpt( E3, 0.1, 0.0, 0.6 ),
ctlpt( E3, 0.11, 0.0, 0.61 ),
ctlpt( E3, 0.12, 0.0, 0.61 ),
ctlpt( E3, 0.12, 0.0, 0.65 ),
ctlpt( E3, 0.09, 0.0, 0.65 ),
ctlpt( E3, 0.07, 0.0, 0.64 ),
ctlpt( E3, 0.10, 0.0, -0.05 ),
ctlpt( E3, 0.21, 0.0, -0.1 ),
ctlpt( E3, 0.21, 0.0, -0.64 ),
ctlpt( E3, 0.18, 0.0, -0.67),
ctlpt( E3, 0.0, 0.0, -0.66 ) ),
list( KV_OPEN ) );
Srf2 = surfrev( bcross );
free( bcross );
color( Srf2, green );

#
# Must make them compatible before doing some morphing.
#
ffcompat( Srf1, Srf2 );

#
# Since we would like the animation to look as good as possible we need
# to precompute as much as possible before invoking view to erase old
# drawing and display new one. That is why we precompute isolines.
#
for ( ( i = 0 ), step, 1.0,
(
( SrfIso = gpolyline( smorph( Srf1, Srf2, i ) ) ):
view( SrfIso, true )
)
);

view( list( Srf1, Srf2 ), true );
for ( ( i = step ), step, 1.0 - step,
(
( SrfIso = gpolyline( smorph( Srf1, Srf2, i ) ) ):
view( SrfIso, false )
)
);

#
# Now dump 12 steps in this morphing sequence as 12 distinct files.
#

for ( ( i = 0.0 ), 1.0, 11.0,
(
( Msrf = smorph( Srf1, Srf2, i / 11.0 ) ):
color( Msrf, white ):
attrib( Msrf, "rgb", "255,255,255" ):
attrib( Msrf, "reflect", "0.7" ):
save( "morp1-" + i, list( view_mat, Msrf, Floor ) )
)
);

#############################################################################
# Second Morphing Sequence. #
#############################################################################

bcross = cbspline( 3,
list( ctlpt( E3, 0.0, 0.0, -0.71 ),
ctlpt( E3, 0.2, 0.0, -0.72 ),
ctlpt( E3, 0.25, 0.0, -0.7 ),
ctlpt( E3, 0.25, 0.0, -0.1 ),
ctlpt( E3, 0.2, 0.0, -0.05 ),
ctlpt( E3, 0.15, 0.0, 0.0 ),
ctlpt( E3, 0.1, 0.0, 0.6 ),
ctlpt( E3, 0.11, 0.0, 0.61 ),
ctlpt( E3, 0.12, 0.0, 0.61 ),
ctlpt( E3, 0.12, 0.0, 0.65 ),
ctlpt( E3, 0.09, 0.0, 0.65 ),
ctlpt( E3, 0.07, 0.0, 0.64 ),
ctlpt( E3, 0.10, 0.0, -0.05 ),
ctlpt( E3, 0.21, 0.0, -0.1 ),
ctlpt( E3, 0.21, 0.0, -0.64 ),
ctlpt( E3, 0.18, 0.0, -0.67),
ctlpt( E3, 0.0, 0.0, -0.66 ) ),
list( KV_OPEN ) );
Srf2 = surfrev( bcross );
free( bcross );
color( Srf2, green );

gcross = cbspline( 3,
list( ctlpt( E3, 0.001, 0.0, 0.02 ),
ctlpt( E3, 0.2, 0.0, 0.02 ),
ctlpt( E3, 0.22, 0.0, 0. ),
ctlpt( E3, 0.22, 0.0, 0.03 ),
ctlpt( E3, 0.03, 0.0, 0.03 ),
ctlpt( E3, 0.03, 0.0, 0.07 ),
ctlpt( E3, 0.04, 0.0, 0.3 ),
ctlpt( E3, 0.3, 0.0, 0.3 ),
ctlpt( E3, 0.4, 0.0, 0.4 ),
ctlpt( E3, 0.3, 0.0, 0.7 ),
ctlpt( E3, 0.28, 0.0, 0.7 ),
ctlpt( E3, 0.37, 0.0, 0.42 ),
ctlpt( E3, 0.31, 0.0, 0.32 ),
ctlpt( E3, 0.001, 0.0, 0.32 ) ),
list( KV_OPEN ) );
Srf3 = surfrev( gcross * trans( vector( 0.0, 0.0, -0.45 ) ) *
scale( vector( 1.6, 1.6, 1.6 ) ) );
free( gcross );
color( Srf3, cyan );

#
# Must make them compatible before doing some morphing.
#
ffcompat( Srf2, Srf3 );

for ( ( i = 0 ), step, 1.0,
(
( SrfIso = gpolyline( smorph( Srf2, Srf3, i ) ) ):
view( SrfIso, true )
)
);

view( list( Srf2, Srf3 ), true );
for ( ( i = step ), step, 1.0 - step,
(
( SrfIso = gpolyline( smorph( Srf2, Srf3, i ) ) ):
view( SrfIso, false )
)
);

#
# Now dump 12 steps in this morphing sequence as 12 distinct files.
#

for ( ( i = 0.0 ), 1.0, 11.0,
(
( Msrf = smorph( Srf2, Srf3, i / 11.0 ) ):
color( Msrf, white ):
attrib( Msrf, "rgb", "255,255,255" ):
attrib( Msrf, "reflect", "1.0" ):
attrib( Msrf, "transp", "0.95" ):
attrib( Msrf, "index", "1.4" ):
save( "morp2-" + i, list( view_mat, Msrf, Floor ) )
)
);

#############################################################################
# Third Morphing Sequence. #
#############################################################################

gcross = cbspline( 3,
list( ctlpt( E3, 0.001, 0.0, 0.02 ),
ctlpt( E3, 0.2, 0.0, 0.02 ),
ctlpt( E3, 0.22, 0.0, 0. ),
ctlpt( E3, 0.22, 0.0, 0.03 ),
ctlpt( E3, 0.03, 0.0, 0.03 ),
ctlpt( E3, 0.03, 0.0, 0.07 ),
ctlpt( E3, 0.04, 0.0, 0.3 ),
ctlpt( E3, 0.3, 0.0, 0.3 ),
ctlpt( E3, 0.4, 0.0, 0.4 ),
ctlpt( E3, 0.3, 0.0, 0.7 ),
ctlpt( E3, 0.28, 0.0, 0.7 ),
ctlpt( E3, 0.37, 0.0, 0.42 ),
ctlpt( E3, 0.31, 0.0, 0.32 ),
ctlpt( E3, 0.001, 0.0, 0.32 ) ),
list( KV_OPEN ) );
Srf3 = surfrev( gcross * trans( vector( 0.0, 0.0, -0.45 ) ) *
scale( vector( 1.6, 1.6, 1.6 ) ) );
free( gcross );
color( Srf3, cyan );

s45 = sin( 45 );
HelixAux = cbspline( 3,
list( ctlpt( P3, 1, 1, 0, 0 ),
ctlpt( P3, s45, s45, s45, 0.2 * s45 ),
ctlpt( P3, 1, 0, 1, 0.4 ),
ctlpt( P3, s45, -s45, s45, 0.6 * s45 ),
ctlpt( P3, 1, -1, 0, 0.8 ),
ctlpt( P3, s45, -s45, -s45, 1.0 * s45 ),
ctlpt( P3, 1, 0, -1, 1.2 ),
ctlpt( P3, s45, s45, -s45, 1.4 * s45 ),
ctlpt( P3, 1, 1, 0, 1.6 ) ),
list( 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4 ) );
HelixApx = HelixAux +
HelixAux * trans( vector( 0.0, 0.0, 1.6 ) ) +
HelixAux * trans( vector( 0.0, 0.0, 3.2 ) );

ScaleCrv = cbezier( list( ctlpt( E2, 0.0, 0.01 ),
ctlpt( E2, 1.0, 1.0 ) ) );

Srf4 = sweepsrf( circle( vector( 0.0, 0.0, 0.0 ), 0.8 ), HelixApx, ScaleCrv ) *
scale( vector( 0.2, 0.2, 0.2 ) ) *
trans( vector( 0.0, 0.0, FloorLvl ) );

free( HelixAux );
free( HelixApx );
free( ScaleCrv );
color( Srf4, magenta );

#
# Must make them compatible before doing some morphing.
#
ffcompat( Srf3, Srf4 );

for ( ( i = 0 ), step, 1.0,
(
( SrfIso = gpolyline( smorph( Srf3, Srf4, i ) ) ):
view( SrfIso, true )
)
);

view( list( Srf3, Srf4 ), true );
for ( ( i = step ), step, 1.0 - step,
(
( SrfIso = gpolyline( smorph( Srf3, Srf4, i ) ) ):
view( SrfIso, false )
)
);

#
# Now dump 12 steps in this morphing sequence as 12 distinct files.
#

for ( ( i = 0.0 ), 1.0, 11.0,
(
( Msrf = smorph( Srf3, Srf4, i / 11.0 ) ):
color( Msrf, white ):
attrib( Msrf, "rgb", "255,255,255" ):
attrib( Msrf, "reflect", "1.0" ):
attrib( Msrf, "transp", "0.95" ):
attrib( Msrf, "index", "1.4" ):
save( "morp3-" + i, list( view_mat, Msrf, Floor ) )
)
);


free(Srf);
free(Msrf);
free(Srf1);
free(Srf2);
free(Srf3);
free(Srf4);

resolution = save_res;



  3 Responses to “Category : OS/2 Files
Archive   : IRIT-OS2.ZIP
Filename : MORPHING.IRT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/