###############################################################################
#                                                                             #
#                Dust V2.30 - Copyright 1994 by A.Maschke                    #
#                           All rights reserved.                              #
#-----------------------------------------------------------------------------#
#                                                                             #
#                             CDEFORM-Tutorial                                #
#                                                                             #
###############################################################################


1. Cone->Prism (simple introduction)
-------------------------------------------------------------------------------

a) create the objects:

   Source:
    -create a tube (24 circle sections, turn of "stagger points",
                            turn on "close bottom" and "close top")
    -enter the "Pick-faces"-mode
    -select the top-faces, create a subgroup "G1"
    -select the bottom-faces, create a subgroup "G2"
    -save it as "t1"

   Destination:
    -create a tube (5 circle sections, turn of "stagger points",
                            turn on "close bottom" and "close top")
    -enter the "Pick-faces"-mode
    -select the top-faces, create a subgroup "G1"
    -select the bottom-faces, create a subgroup "G2"
    -save it as "t2"

b) deform the source object
    -start Dust
    -load the objects
      "load(1,t1)" and
      "load(2,t2)"
    -deform it
      "cdeform(1,2,G1,"",0.2)" and
      "cdeform(1,2,G2,"",0.2)"
    -save it
      "save(1,test)"

c) create the metamorphosis
    -load the object "t1", create a state "CONE" (Shape).
    -load the deformed object "test", select the "t1"-object
     and choose "States/Import" to import the state of the deformed
     object.
    -delete the "test"-object, save your states-object, morph it


2. Head->Bottle (nice effect) (only registered version)
-------------------------------------------------------------------------------
 a) define the curves

    Source:
     -load the supplied object "head", enter the "Pick faces"-mode
     -select the the first curve at the top, name it "G1"
      (you should have selected 18 faces)
     -save it as "head2"
     -count the number of curves you want to morph: 33
     -let's start Dust to define the curves using the
      EXPANDSG-command:
       load(1,head2)
       ;create subgroups G2-G32
       for(i,1,31)
        expandsg(1,G$,G$(i+1))
       end
       save(1,head3)
     -"head3" contains 32 subgroups (curves), the remaining
      is the boundary the whole object

    Destination:
     -load the supplied object "bottle", enter the "Pick faces"-mode
     -select the the first curve at the top, name it "G1"
      (you should have selected 20 faces)
     -count the number of curves: 8
     -let's start Dust to define the curves using the
      EXPANDSG-command:
       load(1,bottle2)
       ;create subgroups G2-G8
       for(i,1,7)
        expandsg(1,G$,G$(i+1))
       end
       save(1,bottle3)
     -"bottle3" contains 8 subgroups (curves)

 b) deform the head

    Because the destination-oobject has less curves than the
    source -object we have to use the CDEFORMINTERP-command.

    The bootle has 7 segment. Let's make a list which curves
    to move into which segment. E.g., Segment 1 is build by the curves
    1 and 2, if you want to move 5 source curves into this segment
    you have to use scale-values from 0.2 to 1.0 (step 1/5).

     1   ->    segment 1 (scale=0.0)
     2-6 ->    segment 1 (scale=0.2,0.4,0.6,0.8,1.0)
     7-10 ->   segment 2 (scale=0.25,0.5,0.75,1.0)
     11-15 ->  segment 3 (scale=0.2,0.4,0.6,0.8,1.0)
     16-20 ->  segment 4 (scale=0.2,0.4,0.6,0.8,1.0)
     21-25 ->  segment 5 (scale=0.2,0.4,0.6,0.8,1.0)
     26->30 -> segment 6 (scale=0.2,0.4,0.6,0.8,1.0)
     31->33 -> segment 7 (scale=0.3333,0.6667,1.0)

     A procedure which moves N curves into one segment defined
     by the curves destSG1 and destSG2 could look like this:

      .srcSG=<start with source-curve>
      .destSG1=<segment-curve 1>
      .destSG2=<segment-curve 2>
      .steps=<N>
      for(i,1,steps)
       .scale=i*1.0/steps
       cdeforminterp(1,2,G$(srcSG),NONE,G$(destSG1),NONE,G$(destSG2),NONE,scale,0.0,G$(srcSG-1),NONE,G$(srcSG-2),NONE)
       ;if you don't have control-curves:
       ;cdeforminterp(1,2,G$(srcSG),NONE,G$(destSG1),NONE,G$(destSG2),NONE,scale,0.0)
       .srcSG=srcSG+1
      end

     This procedure uses control-curves for best results.

     The script "head->bottle.bat" is the final script deforming the
     whole object.
     It creates the deformed object test", load this object into Imagine's
     Detail-Editor to move one point which doesn't belong to any curve
     by hand. This the inner-point of subgroup "G1".

     Now remove all subgroups, create a states-object, render it. You will
     produce an exciting effect.


(15 September 1995)
