mjbWorld program - blobBean

blobBean is an extension of ifsBean. I am experimenting with this as a way to model non-rigid shapes.

The vertex coordinates are recalculated at each frame. When blobBean starts it adds a propertyChange Listener with rootBean. This is called by s_canvas which overloads the postRender() method of canvas3D. This calls back blobBean.propertyChange() every frame, which calls relax(), every frame, to recalculate the coordinates.

blobBean adds two new parameters to ifsBean, these allow you to specify which nodes can move, and which edges take part in the calculations.

nodeIndex is an array of indexes to the coordinates that can be moved. If a coord is referenced by coordIndex but not nodeIndex, then it is rendered, but does not move. If a coord is referenced in nodeIndex, but not in coordIndex, then it is just used for structure, but cant be seen. If its referenced by both then its rendered and can move.

Edges is an array of edges. Each edge specifies the indexes of the coords at each end (from and to), it also contains its nominal length. The length is calculated when the edge is first created. The coords referenced by the edge to and from fields may, or may not, be referenced in nodeIndex. In other words edges can connect moving and fixed coords.

The normals are calculated each frame, because if the coordinates move the normals are different. So and normals read from a file are ignored, also blobBean does not save normals.

This is like a 3D version of the GraphLayout demonstration program that comes with the JDK

Classes written for this program Java3D classes (scene graph structure)

VRML2 definition:

Blob {

as for IFS with the addition of:

field MFInt32 nodeIndex
field MFEdge edges

}


VRML2 format

When an blob is saved it looks like this:

#VRML V2.0 utf8
Transform {
children [
Shape
{
geometry Blob {
coord Coordinate {
point
[
0.5 -0.5 0.5,
0.5 0.5 0.5,
-0.5 0.5 0.5,
-0.5 -0.5 0.5,
-0.5 -0.5 -0.5,
-0.5 0.5 -0.5,
0.5 0.5 -0.5,
0.5 -0.5 -0.5,
]

}
coordIndex [
0, 1, 2, 3, -1,
4, 5, 6, 7, -1,
7, 6, 1, 0, -1,
3, 2, 5, 4, -1,
1, 6, 5, 2, -1,
3, 4, 7, 0, -1,
]

texCoord TextureCoordinate {
point
[
1.0 0.0,
1.0 1.0,
0.0 1.0,
0.0 0.0,
1.0 0.0,
1.0 1.0,
0.0 1.0,
0.0 0.0,
]

}
texCoordIndex [
0, 1, 2, 3, -1,
4, 5, 6, 7, -1,
7, 6, 1, 0, -1,
3, 2, 5, 4, -1,
1, 6, 5, 2, -1,
3, 4, 7, 0, -1,
]
nodeIndex [
0, 1, 2, 3, 4, 5, 6
] edges [ 0 1, 1 2, 2 3, 3 0, 4 5, 5 6, 6 7, 7 4, 1 6, 2 5, 3 4, 0 7 ]
}
}
]
}

metadata block
see also:

 

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.

cover This book introduces 3D concepts, VRML, Java3D, MPEG4/BIFS, and X3D. It is a very good introduction to the theory, The writers have an in depth knowledge due to their involvement in the standards making. This is a good book to help you choose which 3D open standards to use and to give you a good insight into these standards. It is probably not for those who want a basic introduction to 3D or for these who want a step-by-step programming in 3D book.

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.

 

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

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