APPLICATIONSCREATION GRAPHIQUE ★ Delve into 3D surface plotting ★

3D Surface Plotter (Computing with the Amstrad)Applications Creation Graphique
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Experiment with IAN SHARPE's fascinating graphics program

HAVE you seen computer generated pictures of objects in 3D with full shading and hidden line removal? These can almost be mistaken for photographs and produce striking animated effects when several thousand are strung together.

Amstrad graphics, good as they are, will not duplicate these effects but for an insight into how they are achieved why not develop the following idea for yourself?

Program I will draw 3D surfaces such as the one shown in Figure I. There are eight surfaces built in and you can easily add more.

The surfaces are all graphs of functions with three axes - x and y are the horizontal axes, z the vertical.

The program calculates the z values as a function of x and y. This means that the x and y values used in the calculations remain the same every time the program is run - only z varies.

The z coordinates are held in a 2D array z and the values are calculated from the x and y indices of the array.

To translate the values into a 3D image on the screen, the z value is taken as a vertical distance above a point on the screen corresponding to z=0.

This point is determined by applying a transformation to the x and y values: Rotate to give the corner view, flatten to give a 3D effect and magnify to fill the screen.

Figure II gives you some idea of how the shape changes to create the 3D effect.

The program gains speed by only calculating these base coordinates once during initialisation rather than each time a surface is drawn.

They are held in the array scrd, and the number of individual points on the x and y axes are held in the variable sc. The higher the value of sc the higher the resolution of the grid but the slower the program runs.

When drawing the surface the graphics cursor is moved to the calculated point and lines drawn to the points at x-1,y and x,y+1.

To remove areas of the surface hidden by the foreground, the drawing works towards the viewer from the point furthest away. At each point before the visible lines are drawn, a section of screen is blanked out underneath them by drawing lines in ink 0 as illustrated in Figure III. The extent of hidden line removal is controlled by the variable hlr.

An overall magnification factor mag, is applied to scale the whole thing up and the z values are exaggerated vertically by multiplying by a scale factor vex. Other corrections may be applied within each function to make z big enough to be visible without being over exaggerated.

There is plenty of scope for further development. Try adding more functions and altering the values of the variables that control the size and orientation of the display. You can restore line 400, presently deactivated with a REM, for a more solid surface.

Each surface is composed of rectangles. Imagine a line drawn from the centre of each rectangle projecting at right angles from its surface. This line can be defined as having an angle with two components, one from the horizontal (the x-y plane) and the other from the vertical plane (x-z or y-z).

If the surface is drawn in Mode 1 or 0 to give a choice of colours and the colours were selected to give a range of shades, each rectangle could be filled with a colour dependent on the values of the two angles.

In this way a surface could be generated that appeared to be solid and shaded as if there were a single light source.

If you find filling in the rectangles difficult, interesting effects can be obtained by just drawing the lines in a colour dependent on their angle from the horizontal.

CWTA

★ PUBLISHER: Computing with the Amstrad
★ YEAR: 1987
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LICENCE: LISTING
★ AUTHOR: IAN SHARPE

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» 3D  Surface  Plotter    (Computing  with  the  Amstrad)    ENGLISHDATE: 2020-09-12
DL: 20 fois
TYPE: ZIP
SIZE: 5Ko
NOTE: 40 Cyls
.HFE: NON

Je participe au site:
» Newfile(s) upload/Envoye de fichier(s)
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Jpg - 3D (Amstrad Magazine)
» Applications » 3D Mini-Painter (CPC Amstrad International)
» Applications » Turbo Pascal 3D
» Applications » 3D Mapper
» Applications » Focus - 3D Graphik (CPC Amstrad International)
» Applications » 3D Megacode

QUE DIT LA LOI FRANÇAISE:

L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 253 millisecondes et consultée 151 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.