home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 49 / af049.adf / Genesis / CSG / CSG
Text File  |  1993-06-09  |  7KB  |  147 lines

  1. CSG approach
  2. ------------
  3.  
  4. CSG modellers are very few and far between, and those that you will
  5. find will probably be mainframe based. The reason for this is that it
  6. is a very new technique, and I have been fortunate enough to work with
  7. some of the original pioneers of this technique. Moreover, I have
  8. learnt most of the tricks used to keep execution speeds as quick as
  9. possible and discovered many more of my own in doing the work I have
  10. done so far. I know for a fact that the execution speeds I am currently
  11. getting out of my amiga are as fast as those other people are getting
  12. out of IBM RT risc based workstations (these are 32 bit machines with
  13. floating point hardware), and faster than an IBM model 80 PS2.
  14. For this reason alone I can garuantee that no-one will produce a
  15. similar modeller as fast as this on machines in the same league as the
  16. amiga. Execution speed has been my main consideration throughout.
  17.  
  18. The incentive for all this work is that I want to bring what is currently
  19. considered mainframe domain graphics onto machines that everyone can
  20. afford. However I must point out that all of the work I have done on
  21. the amiga is totally original.
  22.  
  23. CSG objects are constructed from a basic set of solid primitives which
  24. are combined in one of three ways. Once this is done, this object is
  25. in itself a new primitive (that you've created), and can then be used
  26. in place of any standard primitive.
  27.  
  28. The three ways of combining primitives and objects are;
  29.  
  30.   Union        - This is like gluing the objects together although they
  31.                  can actually pass through one another. In fact one object
  32.                  can be completely contained within another making it not
  33.                  visable at all.
  34.  
  35.   Intersection - The object resulting from this is comprised of ONLY the
  36.                  overlapping part of the two objects. If the two objects
  37.                  dont touch at any point the resulting object will be
  38.                  emptyness.
  39.  
  40.   Subtraction  - This is where one primitive is taken away from another.
  41.                  eg. subtracting a cylinder is the same as drilling a
  42.                  hole, in real life. By designing an object and subtracting
  43.                  it from a solid block, you've just made a MOULD for that
  44.                  object.
  45.  
  46. The following primitives are currently supported;
  47.  
  48.   Half plane - This is unlike the planes or polygons used by the more
  49.                conventional techniques. Because a model in CSG terms
  50.                has to be SOLID each of the primitives from which it is
  51.                constructed also has to be SOLID. A polygon or facet used
  52.                by convetional (surface) modellers is just a wafer thin
  53.                plane with a defined boundry (usually triangle), in other
  54.                words it has no depth. A CSG plane is an infinitly large
  55.                flat surface that divides the universe into a solid half
  56.                and an empty half (hence the term HALF plane). This on its
  57.                own is of little use, but by intersecting say, 6 half
  58.                planes a cube can be constructed. I plan to implement a
  59.                large selection of pre-defined primitives based on half
  60.                planes, eg. pyramids, cubes, hexagonal cylinders, prisms etc.
  61.                All in all the half plane is by far the most usefull
  62.                primitive. In fact some proffessional CSG modellers have
  63.                it as there only primitive! This however is more advanced
  64.                than your average proffessional system (he says modestly).
  65.  
  66.   Sphere     - Spheres are processed very quickly, although not as quickly
  67.                as half planes. Obviously the radius is variable.
  68.  
  69.   Cylinder   - The basic cylinder is infinitly long and is intersected
  70.                with half planes to truncate it to the desired length
  71.                (the program worries about this, the users just specifies
  72.                a length). Again any radius can be given.
  73.  
  74.   Cone       - Similarly the basic cone is an infinitly long double cone
  75.                (see the picture on this disk), and is truncated by half
  76.                planes by the program. The cone can be given any degree
  77.                of pointyness.
  78.  
  79.   Ellipsoid  - This is a 3D egg shape and can be given any degree of
  80.                pointyness or flatness (in mathmatical terms; all of the
  81.                semi-major axis lengths can be specified).
  82.  
  83. The easiest way to get a feel for how to build a model is to take you
  84. through an simple example, you will soon pick up an intuitive feel
  85. for how to construct a model of your own. The following model description
  86. would result in something resembling a weight lifters bar bell (this is
  87. the bar which has circular weights on either end). This example uses
  88. only the cylinder primitive and only the union operator. It could also
  89. be written more compactly than this but it serves as a good example.
  90.  
  91.   Line
  92.   ----
  93.    1    SmallWeight = Cylinder(12,4) at(0,30,30);
  94.    2    MedWeight   = Cylinder(16,4) at(0,30,30);
  95.    3    LargeWeight = Cylinder(20,4) at(0,30,30);
  96.  
  97.    4    RightSet = LargeWeight at(-4,0,0) union
  98.    5               MedWeight   union
  99.    6               SmallWeight at(,0,0);
  100.  
  101.    7    LeftSet  = SmallWeight at(-4,0,0) union
  102.    8               MedWeight   union
  103.    9               LargeWeight at(4,0,0);
  104.  
  105.    10   Bar = Cylinder(5,100) at(200,30,30);
  106.  
  107.    11   BarBell = Bar union
  108.    12             RightSet at(166,0,0) union
  109.    13             LeftSet  at(234,0,0);
  110.  
  111.    14   Draw BarBell XRotated(20) YRotated(15);
  112.  
  113. Explanation
  114. -----------
  115.   Lines 1  - 3    Define three circular weights. They are made from short
  116.                   fat cylinders running parallel to the x axis (The first
  117.                   parameter is the radius, then the length) at a certain
  118.                   distance above the ground and into the screen.
  119.                   NB. the 'AT' keyword moves the primitive/object by a
  120.                   given x,y,z offset. 
  121.  
  122.   Lines 4  - 9    Define first the set of weights on the left of the bar
  123.                   then the set of weigths on the right (which is in fact
  124.                   the mirror image of the left set). The weights are placed
  125.                   next to each other in the x direction.
  126.  
  127.   Line  10        Defines the actual bar itself as 100 units long and 5 in
  128.                   radius and is positioned so that it runs through the
  129.                   centre of the two sets. It is centred at 200 in x and
  130.                   because it is 100 long, it will extend from 150 to
  131.                   250 in the x direction.
  132.  
  133.   Lines 11 - 13   Positions both sets of weights in the x direction
  134.                   at either end of the bar with 10 units gap at each end.
  135.  
  136.   Line  14        Tells the modeller to draw the object called BarBell
  137.                   rotated slightly in the x and y axis's to get a better
  138.                   view of it.
  139.  
  140. Additional statements would also be used to describe the surface
  141. characteristics of the object, the position and brightness of lights
  142. to be applied, the position of an imaginary camera through which we are
  143. looking, and the resolution of the final picture. Although this type of
  144. object could easily be made on a conventional modelling package, much
  145. more complex objects can just as easily be described which would on a
  146. conventional system require hours of tedious plotting of points.
  147.