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

Parameterisation

 


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.

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

Copyright (c) 1998-2015 Martin John Baker - All rights reserved - privacy policy.