CODINGLISTINGS ★ CAD FOR BEGINNERS PART 1 (AMSTRAD COMPUTER USER) ★

CAD for beginners part 1 (Amstrad Computer User)Coding Listings
★ 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 ★ 

David Robinson of Saxon Computing shows how the CPC464 can produce 3D drawings from simple 2D sections.

Around the end of May I was asked if I'd present a graphics program which I'd evolved during my acquaintance with the CPC464 in the launch issue of AMSTRAD USER. The ideas began to flow, and then grew into a regular column for the magazine on the subject of computer graphics, and so now I have a splendid excuse, at least once a month, to get away from writing business software!

Some graphics applications require so much computing that even the Locomotive BASIC inside your 464 (just about the fastest standard 8 bit BASIC around) can seem a bit slow. Where a program could do with some extra speed I will list the program both in BASIC and PASCAL for those of you with the HiSoft PASCAL 4T compiler.

Every program is accompanied by a full commentary and a list of suggested improvements and extensions for you to try out yourself. Your CPC464 has some very useful graphics features not found on any other micro under £500. These allow us to use techniques more associated with mainframe graphics computers than most micros.

Three other important features are:-

1) a palette of 27 colours to choose from.

2) switchable screen resolution -but using a common coordinate

3) VERY IMPORTANT - the colour resolution is the same as the pixel resolution.

A 3D wire frame plotter

This program of 3D drawings translates a two dimensional cross section into a full 3D shape. To get an idea of how it works, look at Figure la which shows the right half of the cross section of a wine glass. The left half is, of course, a simple mirror image, so the program does not require us to draw both halves. Figure lb shows the 3D projection drawn by the computer from the cross section.

Significant line numbers are as follows:

  • 60 Sets the screen at 320 x 200 resolution.
  • 70-90 Sets up two text windows so that we can keep messages separate from the graphics.
  • 100-110 Initialise 3 arrays storing the coordinates of points in 3D space.
  • 120 Initialise dx% and dy% - the coordinates of your ‘dot cursor' -note that the LOGICAL co-ordinates are always expressed as though there are 640 x 400 dots on the screen even though the actual resolution changes with screen mode. This saves you having to convert all your calculations every time you change screen mode.
  • 160-260 Collect data and draw cross section on the screen. Branches to separate routine at 1600 to complete computation of data for plotting.
  • 300-430 Draws successive cross sections and connects each one to the previous section so as to form a 3D picture.
  • 470-530 End routine.
  • 650-890 Moves your ‘dot cursor' around the screen,
  • 930-1010 Puts data for each point into the arrays x% and y% describing the 2D cross section. Draws 1 ine to previous point.
  • 1060-1140 Accepts data on the amount of detail

(FACES) in the final picture. Rotates the 2D cross section data in 3D space in steps of 360 degrees/FACES.

A point to note is the use of integer variables wherever possible to improve the speed of computation.

You could try to make some improvements to the program along the following lines -

1) Draw a line along the centre of the input screen to mark the centre line for the cross section.

2) The ‘dot cursor' will erase any previously drawn lines whilst on its travels about the screen. See if you can write a routine to prevent this.

Save the program on tape as we shall be using it again in later issues.

ACU

★ PUBLISHER: Amstrad Computer User
★ YEAR: 1984
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: FREEWARE
★ COLLECTION: AMSTRAD COMPUTER USER 1984
★ AUTHOR: David Robinson / Saxon Computing
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» CAD  for  beginners  part  1    (Amstrad  Computer  User)    ENGLISH    LISTINGDATE: 2021-08-15
DL: 129
TYPE: PDF
SiZE: 236Ko
NOTE: 2 pages/PDFlib v1.6

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding Src's » 3D Animated Graphics (Computing With the Amstrad)
» Coding Src's » 3D Loops (Amstrad Action)
» Coding Src's » 3D Demo (Gamemag)
» Coding Src's » The 3D World
» Coding Src's » Graphic - 3D - Cone (Amstrad Computer User)
» Coding Src's » 3D Shape Rotator (Amstrad Action)
Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce programme ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 296 millisecondes et consultée 673 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.