logo back up home forward   further reading more topics »

3D Theory - Equations Model

Shapes could be defined by an inequality, for example simple shapes could be defined as follows:

Sphere

boolean isInside(float x, float y, float z) {return (r*r < x*x+y*y+z*z);}

Cube

Boolean isInside(float x, float y, float z) {return ((x<left) & (x>right) & (y<top) & (y>bottom) & (z<front) & (z>back));}

Other shapes

Other shapes could be made by combining these simple shapes using Boolean operations, for example a Boolean 'or' will create a new shape with an outline covering both shapes. A Boolean 'and' will create a shape with an outline which is the intersection of both shapes. An 'not and' would allow a 'bite' to be taken out of an object in the shape of the other object.

Movement

You could offset or move the object with the following type of method: (see Using this to model physics)

Boolean isInside(float x, float y, float z) {return shapeToBeMoved.isInside(x+xOffset, y+yOffset, z+zOffset);}

Uses of this method


metadata block
see also:

Using this to model physics

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Covers VRML 2 (but not the upcoming X3D standard). A good introduction to all VRML2 node types and how to build them.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

cover Visual Basic .NET for Microsoft Platforms only.

Can this page be improved?

Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page.

 

progam

I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here:

http://sourceforge.net/projects/mjbworld/

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2008 Martin John Baker - All rights reserved.