Index: cpp/frams/_demos/geometry/apices_test.cpp
===================================================================
--- cpp/frams/_demos/geometry/apices_test.cpp	(revision 191)
+++ cpp/frams/_demos/geometry/apices_test.cpp	(revision 191)
@@ -0,0 +1,57 @@
+// This file is a part of the Framsticks GDK.
+// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
+// Refer to http://www.framsticks.com/ for further information.
+
+#include "geometrytestutils.h"
+#include <frams/model/geometry/meshbuilder.h>
+#include <frams/model/model.h>
+#include <frams/util/3d.h>
+#include <stdio.h>
+
+void test(Model &model, const double density)
+{
+	// Creating and preparing result Model object.
+	Model resultModel;
+	resultModel.open();
+	GeometryTestUtils::addAnchorToModel(resultModel);
+	
+	// Creating instance of Iterator class (MeshBuilder::ModelApices in this case). Object is
+	// placed in stack memory, thus there is no heap memory allocation and creation is fast.
+	MeshBuilder::ModelApices iterator(density);
+	
+	// Once created, iterator can be used many times, but must be initialized before every time.
+	iterator.initialize(&model);
+	
+	// Creating iterator output object in stack memory.
+	Pt3D point;
+	
+	// Method tryGetNext checks if next point exists and optionally updates fields of Pt3D object.
+	while (iterator.tryGetNext(point))
+	{
+		// Processing points created by iterator. In this case, they are added to result model as
+		// small spheres.
+		GeometryTestUtils::addPointToModel(point, resultModel);
+	}
+	
+	// After Iterator initialization there are two alternative ways of using it.
+	//
+	// First adds all points to the specified list:
+	// SListTempl<Pt3D> list;
+	// iterator.addAllPointsToList(list);
+	//
+	// Second executes specified operation for each point:
+	// Operation func;
+	// iterator.forEach(func);
+	// In this case, Operation is derived class of MeshBuilder::Callback class.
+	
+	// Finishing result Model and printing its genotype.
+	resultModel.close();
+	puts((const char*)resultModel.getF0Geno().toString());
+}
+
+int main(int argc, char *argv[])
+{
+	return GeometryTestUtils::execute(
+		"Creates new model built of small spheres at input model apices and prints its genotype.",
+		argc, argv, test);
+}
Index: cpp/frams/_demos/geometry/geometrytestutils.cpp
===================================================================
--- cpp/frams/_demos/geometry/geometrytestutils.cpp	(revision 191)
+++ cpp/frams/_demos/geometry/geometrytestutils.cpp	(revision 191)
@@ -0,0 +1,307 @@
+// This file is a part of the Framsticks GDK.
+// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
+// Refer to http://www.framsticks.com/ for further information.
+
+#include "geometrytestutils.h"
+
+#include "../genotypeloader.h"
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+int printGenotypesList(const char *file)
+{
+	long count = 0;
+	long totalSize = 0;
+	MiniGenotypeLoader loader(file);
+	MiniGenotype *genotype;
+	
+	while (genotype = loader.loadNextGenotype())
+	{
+		count++;
+		totalSize += genotype->genotype.len();
+		
+		fprintf(stderr, "%d. (%6d chars) %s\n", count, genotype->genotype.len(),
+			(const char*)genotype->name);
+	}
+	
+	if (loader.getStatus() == MiniGenotypeLoader::OnError)
+	{
+		fprintf(stderr, "Error: %s\n", (const char*)loader.getError());
+		return 2;
+	}
+	else
+	{
+		fprintf(stderr, "\ntotal: %d items, %d chars\n", count, totalSize);
+		return 0;
+	}
+}
+
+class TestInvoker
+{
+	public:
+		virtual void operator()(Model &model) = 0;
+};
+
+int executeTestUsingLoadedModel(const char *file, const char *genoId, TestInvoker &test)
+{
+	const char* genoName = genoId;
+	const int genoIndex = isdigit(genoId[0]) ? atol(genoId) : 0;
+	long count = 0;
+	MiniGenotypeLoader loader(file);
+	MiniGenotype *genotype;
+	
+	while (genotype = loader.loadNextGenotype())
+	{
+		count++;
+		
+		if ((genoIndex == count) || (strcmp((const char*)genotype->name, genoName) == 0))
+		{
+			Model model(genotype->genotype);
+			
+			if (!model.isValid())
+			{
+				fprintf(stderr, "Cannot build Model from this genotype!\n");
+				return 4;
+			}
+			
+			test(model);
+			return 0;
+		}
+	}
+	
+	if (loader.getStatus() == MiniGenotypeLoader::OnError)
+	{
+		fprintf(stderr, "Error: %s\n", (const char*)loader.getError());
+		return 2;
+	}
+	else
+	{
+		fprintf(stderr, "Genotype %s not found in %s\n", genoId, file);
+		return 3;
+	}
+}
+
+int executeTestUsingRandomModel(int shape, TestInvoker &test)
+{
+	Model model;
+	model.open();
+
+	if ((shape < 1) || (shape > 3))
+	{
+		shape = (rand()%3) + 1;
+	}
+
+	Part *part = model.addNewPart(Part::Shape(shape));
+	GeometryTestUtils::randomizePositionScaleAndOrient(part);
+
+	model.close();
+	test(model);
+	GeometryTestUtils::describePart(part, stdout);
+}
+
+class ModelBasedTestInvoker: public TestInvoker
+{
+	private:
+		void (*test)(Model &);
+	public:
+		ModelBasedTestInvoker(void (*_test)(Model &)):
+			test(_test)
+		{}
+		void operator()(Model &model)
+		{
+			test(model);
+		}
+};
+
+int GeometryTestUtils::execute(const SString header, int argc, char *argv[], void (*test)(Model &))
+{
+	srand(time(NULL));
+	
+	if ((argc == 3) && (strcmp("-l", argv[1]) == 0))
+	{
+		return printGenotypesList(argv[2]);
+	}
+	
+	if ((argc == 4) && (strcmp("-l", argv[1]) == 0))
+	{
+		ModelBasedTestInvoker invoker(test);
+		return executeTestUsingLoadedModel(argv[2], argv[3], invoker);
+	}
+	
+	if ((argc == 2) && (strcmp("-c", argv[1]) == 0))
+	{
+		ModelBasedTestInvoker invoker(test);
+		return executeTestUsingRandomModel(-1, invoker);
+	}
+	
+	if ((argc == 3) && (strcmp("-c", argv[1]) == 0) && isdigit(argv[2][0]))
+	{
+		int shape = atol(argv[2]);
+		ModelBasedTestInvoker invoker(test);
+		return executeTestUsingRandomModel(shape, invoker);
+	}
+	
+	fprintf(stderr,
+		"%s\n\n"
+		"argument lists:\n"
+		"-l FILENAME            - to print list of models in file\n"
+		"-l FILENAME GENO_ID    - to load model from file and run test\n"
+		"-c [SHAPE]             - to create simple random model and run test\n\n"
+		"FILENAME - name of file containing named f0 genotypes\n"
+		"GENO_ID - either genotype name or index (1-based)\n"
+		"SHAPE - 1=ellipsoid, 2=cuboid, 3=cylinder, others or none=random\n",
+		(const char*)header);
+	return 1;
+}
+
+class ModelAndDensityBasedTestInvoker: public TestInvoker
+{
+	private:
+		void (*test)(Model &, const double);
+		double density;
+	public:
+		ModelAndDensityBasedTestInvoker(void (*_test)(Model &, const double), double _density):
+			test(_test),
+			density(_density)
+		{}
+		
+		void operator()(Model &model)
+		{
+			test(model, density);
+		}
+};
+
+int GeometryTestUtils::execute(const SString header, int argc, char *argv[],
+	void (*test)(Model &, const double))
+{
+	srand(time(NULL));
+	
+	if ((argc == 3) && (strcmp("-l", argv[1]) == 0))
+	{
+		return printGenotypesList(argv[2]);
+	}
+
+	if ((argc == 5) && (strcmp("-l", argv[1]) == 0) && isdigit(argv[4][0]))
+	{
+		double density = atol(argv[4]);
+		ModelAndDensityBasedTestInvoker invoker(test, density);
+		return executeTestUsingLoadedModel(argv[2], argv[3], invoker);
+	}
+	
+	if ((argc == 3) && (strcmp("-c", argv[1]) == 0) && isdigit(argv[2][0]))
+	{
+		double density = atol(argv[2]);
+		ModelAndDensityBasedTestInvoker invoker(test, density);
+		return executeTestUsingRandomModel(-1, invoker);
+	}
+	
+	if ((argc == 4) && (strcmp("-c", argv[1]) == 0) && isdigit(argv[2][0]) && isdigit(argv[3][0]))
+	{
+		double density = atol(argv[2]);
+		int shape = atol(argv[3]);
+		ModelAndDensityBasedTestInvoker invoker(test, density);
+		return executeTestUsingRandomModel(shape, invoker);
+	}
+	
+	fprintf(stderr,
+		"%s\n\n"
+		"argument lists:\n"
+		"-l FILENAME                    - to print list of models in file\n"
+		"-l FILENAME GENO_ID DENSITY    - to load model from file and run test\n"
+		"-c DENSITY [SHAPE]             - to create simple random model and run test\n\n"
+		"FILENAME - name of file containing named f0 genotypes\n"
+		"GENO_ID - either genotype name or index (1-based)\n"
+		"DENSITY - minimal number of samples per unit\n"
+		"SHAPE - 1=ellipsoid, 2=cuboid, 3=cylinder, others or none=random",
+		(const char*)header);
+	return 1;
+}
+
+void GeometryTestUtils::addAnchorToModel(Model &model)
+{
+	Part *part = model.addNewPart(Part::SHAPE_ELLIPSOID);
+	
+	part->p = Pt3D(0);
+	part->scale = Pt3D(0.1);
+	part->vcolor = Pt3D(1.0, 0.0, 1.0);
+	
+	addAxesToModel(Pt3D(0.5), Orient(Orient_1), Pt3D(0.0), model);
+}
+
+void GeometryTestUtils::addPointToModel(const Pt3D &markerLocation, Model &model)
+{
+	Part *anchor = model.getPart(0);
+	Part *part = model.addNewPart(Part::SHAPE_ELLIPSOID);
+	
+	part->p = Pt3D(markerLocation);
+	part->scale = Pt3D(0.05);
+	part->vcolor = Pt3D(1.0, 1.0, 0.0);
+	
+	model.addNewJoint(anchor, part, Joint::SHAPE_SOLID);
+}
+
+void GeometryTestUtils::addAxesToModel(const Pt3D &sizes, const Orient &axes, const Pt3D &center,
+	Model &model)
+{
+	Part *anchor = model.getPart(0);
+	Part *part;
+	
+	part = model.addNewPart(Part::SHAPE_CUBOID);
+	part->scale = Pt3D(sizes.x, 0.05, 0.05);
+	part->setOrient(axes);
+	part->p = center;
+	part->vcolor = Pt3D(1.0, 0.0, 0.0);
+	model.addNewJoint(anchor, part, Joint::SHAPE_SOLID);
+	
+	part = model.addNewPart(Part::SHAPE_CUBOID);
+	part->scale = Pt3D(0.05, sizes.y, 0.05);
+	part->setOrient(axes);
+	part->p = center;
+	part->vcolor = Pt3D(0.0, 1.0, 0.0);
+	model.addNewJoint(anchor, part, Joint::SHAPE_SOLID);
+	
+	part = model.addNewPart(Part::SHAPE_CUBOID);
+	part->scale = Pt3D(0.05, 0.05, sizes.z);
+	part->setOrient(axes);
+	part->p = center;
+	part->vcolor = Pt3D(0.0, 0.0, 1.0);
+	model.addNewJoint(anchor, part, Joint::SHAPE_SOLID);
+}
+
+void GeometryTestUtils::mergeModels(Model &target, Model &source)
+{
+	Part *targetAnchor = target.getPart(0);
+	Part *sourceAnchor = source.getPart(0);
+	
+	target.moveElementsFrom(source);
+	
+	target.addNewJoint(targetAnchor, sourceAnchor, Joint::SHAPE_SOLID);
+}
+
+double frand(double from, double width)
+{
+	return from + width * ((rand()%10000) / 10000.0);
+}
+
+void GeometryTestUtils::randomizePositionScaleAndOrient(Part *part)
+{
+	part->p = Pt3D(frand(1.5, 1.0), frand(1.5, 1.0), frand(1.5, 1.0));
+	part->scale = Pt3D(frand(0.1, 0.9), frand(0.1, 0.9), frand(0.1, 0.9));
+	part->setRot(Pt3D(frand(0.0, M_PI), frand(0.0, M_PI), frand(0.0, M_PI)));
+}
+
+void GeometryTestUtils::describePart(const Part *part, FILE *output)
+{
+	fprintf(output, "# shape=%d\n", part->shape);
+	fprintf(output, "# x=%f\n", part->p.x);
+	fprintf(output, "# y=%f\n", part->p.y);
+	fprintf(output, "# z=%f\n", part->p.z);
+	fprintf(output, "# sx=%f\n", part->scale.x);
+	fprintf(output, "# sy=%f\n", part->scale.y);
+	fprintf(output, "# sz=%f\n", part->scale.z);
+	fprintf(output, "# rx=%f\n", part->rot.x);
+	fprintf(output, "# ry=%f\n", part->rot.y);
+	fprintf(output, "# rz=%f\n", part->rot.z);
+}
Index: cpp/frams/_demos/geometry/geometrytestutils.h
===================================================================
--- cpp/frams/_demos/geometry/geometrytestutils.h	(revision 191)
+++ cpp/frams/_demos/geometry/geometrytestutils.h	(revision 191)
@@ -0,0 +1,113 @@
+// This file is a part of the Framsticks GDK.
+// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
+// Refer to http://www.framsticks.com/ for further information.
+
+#ifndef _GEOMETRYTESTUTILS_H_
+#define _GEOMETRYTESTUTILS_H_
+
+#include <frams/model/model.h>
+#include <frams/model/modelparts.h>
+#include <frams/util/3d.h>
+#include <frams/util/sstring.h>
+
+/**
+ * @brief Geometry module testing utilities.
+ * @details Contains functions frequently used by tests, such as loading or generating random Model,
+ *     or adding markers of points to a Model.
+ * @author Radosław Gołębiewski
+ */
+namespace GeometryTestUtils
+{
+	/**
+	 * @brief Execution entry point for test based on specified input model.
+	 * @details Parses call arguments and performs one of following tasks: printing usage message;
+	 *     printing list of genotypes in specified file; creating Model from loaded genotype and
+	 *     executing test; creating random Model and executing test.
+	 * @param[in] header Header of usage message. This text should contain test description.
+	 * @param[in] argc Number of call arguments.
+	 * @param[in] argv Call arguments.
+	 * @param[in] test Pointer to function implementing test.
+	 * @returns Result code: 0 - no error, 1 - incorrect arguments (usage message printed),
+	 *     2 - cannot open file, 3 - cannot find genotype, 4 - incorrect genotype.
+	 */
+	int execute(const SString header, int argc, char *argv[], void (*test)(Model &));
+	
+	/**
+	 * @brief Execution entry point for test based on specified input model and density.
+	 * @details Parses call arguments and performs one of following tasks: printing usage message;
+	 *     printing list of genotypes in specified file; creating Model from loaded genotype and
+	 *     executing test using specified density; creating random Model and executing test using
+	 *     specified density.
+	 * @param[in] header Header of usage message. This text should contain test description.
+	 * @param[in] argc Number of call arguments.
+	 * @param[in] argv Call arguments.
+	 * @param[in] test Pointer to function implementing test.
+	 * @returns Result code: 0 - no error, 1 - incorrect arguments (usage message printed),
+	 *     2 - cannot open file, 3 - cannot find genotype, 4 - incorrect genotype.
+	 */
+	int execute(const SString header, int argc, char *argv[], void (*test)(Model &, const double));
+	
+	/**
+	 * @brief Adds anchor to the specified Model.
+	 * @details An anchor has two functions. First is to provide Model consistency. Some functions in
+	 *     GeometryTestUtils namespace requires Model passed to them as an argument to contain at
+	 *     least one Part. All new Parts are bonded to the rest of Model using Joint connecting them
+	 *     with first Part of Model. Second is to provide reference which helps to understand Model
+	 *     position, scale and orientation. Anchor is built from four Parts: small sphere placed in
+	 *     global coordinate system origin and three cuboids visualising global coordinate system
+	 *     axes.
+	 * @see addAxesToModel.
+	 * @param[in] model Owner of Parts to be created.
+	 */
+	void addAnchorToModel(Model &model);
+	
+	/**
+	 * @brief Adds point marker to Model.
+	 * @details Marker of point is a small sphere (radius = 0.05).
+	 * @param[in] point Location of marker.
+	 * @param[in] model Owner of Part to be created, must contain at least one part.
+	 */
+	void addPointToModel(const Pt3D &point, Model &model);
+	
+	/**
+	 * @brief Adds axes markers to Model.
+	 * @details Axes markers are three streched (one of scales = 0.5, others = 0.05) and colored
+	 *     cuboids. Cuboid visualising OX axis is red, OY - green, and OZ - blue.
+	 * @param[in] sizes Axes visual lengths.
+	 * @param[in] axes Axes orientation, relatively to global coordinate system axes.
+	 * @param[in] center Axes intersection point, relatively to global coordinate system origin.
+	 * @param[in] model Owner of Parts to be created, must contain at least one part.
+	 */
+	void addAxesToModel(const Pt3D &sizes, const Orient &axes, const Pt3D &center, Model &model);
+	
+	/**
+	 * @brief Merges two Models.
+	 * @details Moves all parts from source Model to target Model and - to provide Model
+	 *     consistency - creates Joint between firsts Parts of each of them. Each model must contain
+	 *     at least one Part.
+	 * @param[in] target Target Model, must contain at least one part.
+	 * @param[in] source Source Model, must contain at least one part.
+	 */
+	void mergeModels(Model &target, Model &source);
+	
+	/**
+	 * @brief Randomizes position, scale and rotations of Part.
+	 * @details Sets coords of Part position to random values from range (1.5, 2.5), scales to
+	 *     random values from range (0.1, 1.0), and rotations around each axis to random values from
+	 *     range (0, M_PI).
+	 * @param[in] part Part which position, scale and orient should be randomized.
+	 */
+	void randomizePositionScaleAndOrient(Part *part);
+	
+	/**
+	 * @brief Prints description of given Part to specified file.
+	 * @details Prints shape ("shape"), position ("x", "y", "z"), scale ("sx", "sy", "sz") and
+	 *     rotations ("rx", "ry", "rz") of given Part. Each value is printed in separate line using
+	 *     following syntax: "# NAME=VALUE".
+	 * @param[in] part Part to be described.
+	 * @param[in] output Output file.
+	 */
+	void describePart(const Part *part, FILE *output);
+}
+
+#endif
Index: cpp/frams/_demos/geometry/info_test.cpp
===================================================================
--- cpp/frams/_demos/geometry/info_test.cpp	(revision 191)
+++ cpp/frams/_demos/geometry/info_test.cpp	(revision 191)
@@ -0,0 +1,93 @@
+// This file is a part of the Framsticks GDK.
+// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
+// Refer to http://www.framsticks.com/ for further information.
+
+#include "geometrytestutils.h"
+#include <frams/model/geometry/geometryutils.h>
+#include <frams/model/geometry/modelgeometryinfo.h>
+#include <frams/model/model.h>
+#include <frams/util/3d.h>
+#include <stdio.h>
+
+void test(Model &model, const double density)
+{
+	// EXAMPLES ------------------------------------------------------------------------------------
+	
+	// Calculating approximate volume of model. Parameter density describes minimal number of points
+	// created for each unit of length. It means, that for each cubic unit of bounding box of model,
+	// at least density^3 points will be created.
+	double volume = ModelGeometryInfo::volume(model, density);
+	
+	
+	// Calculating approximate surface area of model. Parameter density describes minimal number of
+	// points created for each unit of length. It means, that for each square unit of surface area
+	// of parts of model, at least density^2 points will be created.
+	double area = ModelGeometryInfo::area(model, density);
+	
+	
+	// Creating output variables.
+	Pt3D sizes;
+	Orient axes;
+	// Calculating approximate sizes and axes of model. These values are calculated together because
+	// they depends on each other. Sizes are distances between furthest points on model surface
+	// measured along corresponding axes. Fields sizes.x and axes.x describes the 'length' of 3D
+	// model. Fields sizes.y and axes.y desctibes 'width' of 2D model created by projecting original
+	// 3D model onto plane defined by axes.x vector. Fields sizes.z and axes.z destribes 'height' of
+	// model. Axes are perpendicular to each other. Parameter density describes minimal number of
+	// points created for each unit of length. It means, that for each square unit of surface area
+	// of parts of model, at least density^2 points will be created.
+	ModelGeometryInfo::findSizesAndAxesOfModel(model, density, sizes, axes);
+	
+	
+	// Creating output variables.
+	Pt3D lowerBoundary, upperBoundary;
+	// Calculationg bounding box of model. Result is stored in variables lowerBoundary and
+	// upperBoundary.
+	ModelGeometryInfo::boundingBox(model, lowerBoundary, upperBoundary);
+	
+	// PRINTING RESULT -----------------------------------------------------------------------------
+	
+	// Creating and preparing result Model object.
+	Model resultModel;
+	resultModel.open();
+	GeometryTestUtils::addAnchorToModel(resultModel);
+	
+	// Adding bounding markers of bounding box apices.
+	for (Octants::Octant o = Octants::FIRST; o < Octants::NUMBER; o = Octants::Octant(o+1))
+	{
+		Pt3D apex;
+		apex.x = Octants::isPositiveX(o) ? upperBoundary.x : lowerBoundary.x;
+		apex.y = Octants::isPositiveY(o) ? upperBoundary.y : lowerBoundary.y;
+		apex.z = Octants::isPositiveZ(o) ? upperBoundary.z : lowerBoundary.z;
+		GeometryTestUtils::addPointToModel(apex, resultModel);
+	}
+	
+	// Adding markers of axes (intersection of axes is in the center of bounding box).
+	Pt3D intersection = (lowerBoundary + upperBoundary) * 0.5;
+	GeometryTestUtils::addAxesToModel(sizes, axes, intersection, resultModel);
+	
+	// Merging with original model.
+	GeometryTestUtils::mergeModels(resultModel, model);
+	
+	// Finishing result Model and printing its genotype.
+	resultModel.close();
+	puts((const char*)resultModel.getF0Geno().toString());
+	
+	// Printing calculated values.
+	printf("# volume=%f\n", volume);
+	printf("# area=%f\n", area);
+	printf("# sizes.x=%f sizes.y=%f sizes.z=%f\n", sizes.x, sizes.y, sizes.z);
+	printf("# axes.x=(%f, %f, %f)\n", axes.x.x, axes.x.y, axes.x.z);
+	printf("# axes.y=(%f, %f, %f)\n", axes.y.x, axes.y.y, axes.y.z);
+	printf("# axes.z=(%f, %f, %f)\n", axes.z.x, axes.z.y, axes.z.z);
+	printf("# box.x=[%f, %f]\n", lowerBoundary.x, upperBoundary.x);
+	printf("# box.y=[%f, %f]\n", lowerBoundary.y, upperBoundary.y);
+	printf("# box.z=[%f, %f]\n", lowerBoundary.z, upperBoundary.z);
+}
+
+int main(int argc, char *argv[])
+{
+	return GeometryTestUtils::execute(
+		"Calculates approximate values of surface area, volume, sizes and axes of model. Adds to "
+		"model markers of bounding box apices and axes.", argc, argv, test);
+}
Index: cpp/frams/_demos/geometry/surface_test.cpp
===================================================================
--- cpp/frams/_demos/geometry/surface_test.cpp	(revision 191)
+++ cpp/frams/_demos/geometry/surface_test.cpp	(revision 191)
@@ -0,0 +1,57 @@
+// This file is a part of the Framsticks GDK.
+// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
+// Refer to http://www.framsticks.com/ for further information.
+
+#include "geometrytestutils.h"
+#include <frams/model/geometry/meshbuilder.h>
+#include <frams/model/model.h>
+#include <frams/util/3d.h>
+#include <stdio.h>
+
+void test(Model &model, const double density)
+{
+	// Creating and preparing result Model object.
+	Model resultModel;
+	resultModel.open();
+	GeometryTestUtils::addAnchorToModel(resultModel);
+	
+	// Creating instance of Iterator class (MeshBuilder::ModelSurface in this case). Object is
+	// placed in stack memory, thus there is no heap memory allocation and creation is fast.
+	MeshBuilder::ModelSurface iterator(density);
+	
+	// Once created, iterator can be used many times, but must be initialized before every time.
+	iterator.initialize(&model);
+	
+	// Creating iterator output object in stack memory.
+	Pt3D point;
+	
+	// Method tryGetNext checks if next point exists and optionally updates fields of Pt3D object.
+	while (iterator.tryGetNext(point))
+	{
+		// Processing points created by iterator. In this case, they are added to result model as
+		// small spheres.
+		GeometryTestUtils::addPointToModel(point, resultModel);
+	}
+	
+	// After Iterator initialization there are two alternative ways of using it.
+	//
+	// First adds all points to the specified list:
+	// SListTempl<Pt3D> list;
+	// iterator.addAllPointsToList(list);
+	//
+	// Second executes specified operation for each point:
+	// Operation func;
+	// iterator.forEach(func);
+	// In this case, Operation is derived class of MeshBuilder::Callback class.
+	
+	// Finishing result Model and printing its genotype.
+	resultModel.close();
+	puts((const char*)resultModel.getF0Geno().toString());
+}
+
+int main(int argc, char *argv[])
+{
+	return GeometryTestUtils::execute(
+		"Creates new model built of small spheres covering surface of input model and prints its "
+		"genotype.", argc, argv, test);
+}
Index: cpp/frams/_demos/geometry/volume_test.cpp
===================================================================
--- cpp/frams/_demos/geometry/volume_test.cpp	(revision 191)
+++ cpp/frams/_demos/geometry/volume_test.cpp	(revision 191)
@@ -0,0 +1,49 @@
+// This file is a part of the Framsticks GDK.
+// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
+// Refer to http://www.framsticks.com/ for further information.
+
+#include "geometrytestutils.h"
+#include <frams/model/geometry/geometryutils.h>
+#include <frams/model/geometry/meshbuilder.h>
+#include <frams/model/model.h>
+#include <stdio.h>
+
+void test(Model &model, const double density)
+{
+	// Creating and preparing result Model object.
+	Model resultModel;
+	resultModel.open();
+	GeometryTestUtils::addAnchorToModel(resultModel);
+	
+	// Creating instance of Iterator class (MeshBuilder::ModelApices in this case). Object is
+	// placed in stack memory, thus there is no heap memory allocation and creation is fast.
+	MeshBuilder::BoundingBoxVolume iterator(density);
+	
+	// Once created, iterator can be used many times, but must be initialized before every time.
+	iterator.initialize(model);
+	
+	// Creating output variable.
+	Pt3D point;
+	
+	// Method tryGetNext checks if next point exists and optionally updates fields of Pt3D object.
+	while (iterator.tryGetNext(point))
+	{
+		// Processing points created by iterator. In this case, they are added to result model as
+		// small spheres only if they are placed inside or on surface of input model.
+		if (GeometryUtils::isPointInsideModel(point, model))
+		{
+			GeometryTestUtils::addPointToModel(point, resultModel);
+		}
+	}
+	
+	// Finishing result Model and printing its genotype.
+	resultModel.close();
+	puts((const char*)resultModel.getF0Geno().toString());
+}
+
+int main(int argc, char *argv[])
+{
+	return GeometryTestUtils::execute(
+		"Creates new model built of small spheres filling volume of input model and prints its "
+		"genotype.", argc, argv, test);
+}
