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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FIG-31.58<br />

As you've just discovered, the UNION statement only works predictably with cubes<br />

and boxes. Other shapes give unpredictable results (although the cone is close).<br />

The PERFORM CSG DIFFERENCE Statement<br />

The PERFORM CSG<br />

DIFFERENCE Statement<br />

FIG-31.59<br />

The PERFORM CSG<br />

INTERSECTION<br />

Statement<br />

The PERFORM CSG DIFFERENCE statement removes from object 1 the volume<br />

it shares in common with object 2. The statement has the format shown in<br />

FIG-31.58.<br />

In the diagram:<br />

objno1 is an integer value specifying the ID of the first<br />

3D object to be used in the difference operation.<br />

objno2 is an integer value specifying the ID of the second<br />

3D object to be used in the difference operation.<br />

As before, the second object is unaffected by the operation and would normally be<br />

deleted. Also, we are again restricted to cubes and boxes if we are to obtain<br />

consistent results.<br />

Activity 31.29<br />

Restore your last project to its original code (as shown in LISTING-31.13).<br />

Change the union operation to a difference operation and observe the new<br />

shape created.<br />

Modify the width and depth of the box to be 35.<br />

The PERFORM CSG INTERSECTION Statement<br />

The PERFORM CSG INTERSECTION statement does not perform intersection as<br />

defined at the beginning of this chapter, but it does create a different shape from<br />

that produced by the PERFORM CSG DIFFERENCE statement and so is worth<br />

looking at. The statement has the format shown in FIG-31.59.<br />

In the diagram:<br />

PERFORM CSG DIFFERENCE<br />

objno1 objno2<br />

PERFORM CSG INTERSECTION<br />

objno1 objno2<br />

objno1 is an integer value specifying the ID of the first<br />

3D object to be used in the intersection operation.<br />

objno2 is an integer value specifying the ID of the second<br />

3D object to be used in the intersection operation.<br />

Again, the second object would normally be deleted and we are restricted to cubes<br />

and boxes if we are to obtain predictable results.<br />

790 <strong>DarkBASIC</strong> <strong>Pro</strong>: 3D Primitives<br />

,<br />

,

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

Saved successfully!

Ooh no, something went wrong!