13.01.2013 Views

Hands On DarkBASIC Pro - Digital Skills

Hands On DarkBASIC Pro - Digital Skills

Hands On DarkBASIC Pro - Digital Skills

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FIG-31.13<br />

Creating a Triangle Object<br />

Positioning an Object<br />

FIG-31.14<br />

The POSITION<br />

OBJECT Statement<br />

Notice that, unlike any of the other objects, a triangle can be placed anywhere in<br />

3D space.<br />

Other than the triangle, every object is created with it’s centre at the point (0,0,0).<br />

However, once an object has been created, <strong>DarkBASIC</strong> <strong>Pro</strong> offers several ways of<br />

moving an object to another position.<br />

The POSITION OBJECT Statement<br />

<strong>On</strong>e way to move an object is to use the POSITION OBJECT statement. The object<br />

is moved so that its centre is at the position specified. The statement has the format<br />

shown in FIG-31.14.<br />

In the diagram:<br />

y-axis<br />

objno is the integer value previously assigned to the object.<br />

x,y,z are real values representing the position to which the<br />

object is to be moved. It is the centre of the object that is<br />

placed at this position.<br />

For example, if we wanted the centre of the cube we had created previously to be<br />

moved to position (9,0,0), then we would use the statement:<br />

POSITION OBJECT 1,9,0,0<br />

(2,0,3)<br />

(5,0,3)<br />

x-axis<br />

(3.5,6,7)<br />

, , ,<br />

The result of executing this statement is shown in FIG-31.15.<br />

z-axis<br />

POSITION OBJECT objno<br />

x y z<br />

762 <strong>DarkBASIC</strong> <strong>Pro</strong>: 3D Primitives

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!