![]() |
Bsoft 2.1.4
Bernard's software package
|
Library routines used for model creation. More...
Functions | |
Bcomponent * | model_add_component (Bmodel *model, Bstring &id, Bstring &type, Vector3< double > loc) |
Adds a component to a model. More... | |
Bcomponent * | model_add_components (Bmodel *model, Bstring &id, Bstring &type, vector< Vector3< double > > loc) |
Adds a set of components to a model. More... | |
Bmodel * | model_platonic (Bsymmetry &sym, double radius) |
Generates a platonic polyhedron. More... | |
Bmodel * | model_helix (double radius, double helix_rise, double helix_angle, long ncomp) |
Generates a helix model. More... | |
Bmodel * | model_random (long ncomp, double comp_radius, double max_radius) |
Generates components at random non-overlapping locations and with random views. More... | |
Bmodel * | model_random (long ncomp, double comp_radius, Vector3< double > min, Vector3< double > max) |
Generates components at random non-overlapping locations and with random views. More... | |
Bmodel * | model_random_gaussian (long ncomp, double std) |
Generates components at random gaussian-distributed locations and with random views. More... | |
Bmodel * | model_random_shell (long ncomp, double radius) |
Generates random components on a shell. More... | |
Bmodel * | model_random_shell (long ncomp, double radius, double separation) |
Generates random components on a shell. More... | |
Bmodel * | model_create_shell (long number, double radius, double distance) |
Creates a spherical shell point model. More... | |
Bmodel * | model_create_fibonacci_sphere (long number, double radius) |
Creates a Fibonacci sphere point model. More... | |
Bmodel * | model_create_dodecahedron (double radius, long divisions, double sphere_fraction) |
Creates an dodecahedron point model. More... | |
Bmodel * | model_create_icosahedron (double radius, long divisions, double sphere_fraction) |
Creates an icosahedron point model. More... | |
Bmodel * | model_create_circle (double radius, double z, double distance) |
Creates a circle with the given radius, height, and component separation. More... | |
Bmodel * | model_create_ellipse (Vector3< double > axes, double distance) |
Creates an ellipse with given semiaxes and component separation. More... | |
Bmodel * | model_create_ellipsoid (Vector3< double > axes, double distance) |
Creates an ellipsoid with given semiaxes and component separation. More... | |
Bmodel * | model_create_cylinder (Vector3< double > direction, double radius, double length, double distance) |
Creates a cylinder with the given radius, length, and component separation. More... | |
Bmodel * | model_create_plane (double length, double width, double z, double distance) |
Creates a plane with the given length, width, height, and component separation. More... | |
Bmodel * | model_create_spindle (Vector3< double > direction, double radius, double separation, double packing) |
Creates a spindle packed inside a sphere. More... | |
Bmodel * | model_create_cubic_lattice (Vector3< long > lattice, double separation) |
Creates a cubic lattice with the given length, width, height, and component separation. More... | |
Bmodel * | model_create_hexagonal_lattice (Vector3< long > lattice, double separation) |
Creates a hexagonal lattice with the given length, width, height, and component separation. More... | |
Library routines used for model creation.
Bcomponent * model_add_component | ( | Bmodel * | model, |
Bstring & | id, | ||
Bstring & | type, | ||
Vector3< double > | loc | ||
) |
Adds a component to a model.
*model | model list. |
&id | model identifier. |
&type | component type. |
loc | component location. |
The component is added to the model indicated by the ID, the type and the location given.
Bcomponent * model_add_components | ( | Bmodel * | model, |
Bstring & | id, | ||
Bstring & | type, | ||
vector< Vector3< double > > | loc | ||
) |
Adds a set of components to a model.
*model | model list. |
&id | model identifier. |
&type | component type. |
loc | component locations. |
The component is added to the model indicated by the ID, the type and the location given.
Bmodel * model_create_circle | ( | double | radius, |
double | z, | ||
double | distance | ||
) |
Creates a circle with the given radius, height, and component separation.
radius | radius length. |
z | height. |
distance | separation distance. |
Find angle associated with separation distance using Law of Cosines.
Creates a cubic lattice with the given length, width, height, and component separation.
lattice | lattice dimensions. |
separation | distances between components. |
The components are placed in a cubic arrangement.
Bmodel * model_create_cylinder | ( | Vector3< double > | direction, |
double | radius, | ||
double | length, | ||
double | distance | ||
) |
Creates a cylinder with the given radius, length, and component separation.
direction | cylinder axis direction |
radius | radius length. |
length | cylinder length. |
distance | separation distance. |
Find angle associated with separation distance using Law of Cosines.
Bmodel * model_create_dodecahedron | ( | double | radius, |
long | divisions, | ||
double | sphere_fraction | ||
) |
Creates an dodecahedron point model.
radius | sphere radius. |
divisions | number of divisions from a base dodecahedron. |
sphere_fraction | spherical fraction: 0=dodecahedral, 1=spherical. |
Creates an ellipse with given semiaxes and component separation.
axes | ellipse axis x and y lengths and z height |
distance | separation distance |
Creates an ellipsoid with given semiaxes and component separation.
axes | ellipsoid axis lengths |
distance | separation distance |
Bmodel * model_create_fibonacci_sphere | ( | long | number, |
double | radius | ||
) |
Creates a Fibonacci sphere point model.
number | number of points. |
radius | sphere radius. |
Creates a hexagonal lattice with the given length, width, height, and component separation.
lattice | lattice dimensions. |
separation | distances between components. |
The components are placed in a hexagonal arrangement to simulate the most commonly expected close packing.
Bmodel * model_create_icosahedron | ( | double | radius, |
long | divisions, | ||
double | sphere_fraction | ||
) |
Creates an icosahedron point model.
radius | sphere radius. |
divisions | number of divisions from a base icosahedron. |
sphere_fraction | spherical fraction: 0=dodecahedral, 1=spherical. |
Bmodel * model_create_plane | ( | double | length, |
double | width, | ||
double | z, | ||
double | distance | ||
) |
Creates a plane with the given length, width, height, and component separation.
length | dimension in x. |
width | dimension in y. |
z | height. |
distance | separation distance. |
The components are placed in a hexagonal arrangement to simulate the most commonly expected close packingx.
Bmodel * model_create_shell | ( | long | number, |
double | radius, | ||
double | separation | ||
) |
Creates a spherical shell point model.
number | number of points. |
radius | shell radius. |
separation | distance between points. |
Two of the three arguments need to be given (the other zero). If all three arguments are given, only the radius and distance is used.
Bmodel * model_create_spindle | ( | Vector3< double > | direction, |
double | radius, | ||
double | separation, | ||
double | packing | ||
) |
Creates a spindle packed inside a sphere.
direction | spindle axis direction |
radius | sphere radius. |
separation | separation distance between successive components. |
packing | distance between spindle strands. |
The spindle starts at the minimum Z-pole of the sphere, winding up along the spherical wall to the other pole, and back down inside the first shell. The process is repeated until the whole sphere is packed.
Bmodel * model_helix | ( | double | radius, |
double | helix_rise, | ||
double | helix_angle, | ||
long | ncomp | ||
) |
Generates a helix model.
radius | distance of each vertex from helical axis. |
helix_rise | helical rise. |
helix_angle | helical rotation angle. |
ncomp | number of components. |
Generates a platonic polyhedron.
*sym | symmetry. |
radius | distance of each vertex from origin. |
Polyhedral components are generated on symmetry axes. Symmetry designations supported: T-3 tetrahedron. O-2 truncated octahedron. O-3 cube. O-4 octahedron. I-2 truncated icosahedron. I-3 dodecahedron. I-5 icosahedron.
Bmodel * model_random | ( | long | ncomp, |
double | comp_radius, | ||
double | max_radius | ||
) |
Generates components at random non-overlapping locations and with random views.
ncomp | number of components. |
comp_radius | component radius. |
max_radius | maximum radius of components. |
If a new component overlaps within an existing component, as defined by the component radius, new random coordinates are generated for it.
Bmodel * model_random | ( | long | ncomp, |
double | comp_radius, | ||
Vector3< double > | min, | ||
Vector3< double > | max | ||
) |
Generates components at random non-overlapping locations and with random views.
ncomp | number of components. |
comp_radius | component radius. |
min | minimum bounds. |
max | maximum bounds. |
If a new component overlaps within an existing component, as defined by the component radius, new random coordinates are generated for it.
Bmodel * model_random_gaussian | ( | long | ncomp, |
double | std | ||
) |
Generates components at random gaussian-distributed locations and with random views.
ncomp | number of components. |
std | standard deviation of gaussian distribution. |
Overlapping components are generated.
Bmodel * model_random_shell | ( | long | ncomp, |
double | radius | ||
) |
Generates random components on a shell.
ncomp | number of components. |
radius | shell radius. |
Overlapping components are generated.
Bmodel * model_random_shell | ( | long | ncomp, |
double | radius, | ||
double | separation | ||
) |
Generates random components on a shell.
ncomp | number of components. |
radius | shell radius. |
separation | minimum vertex separation distance. |
The vertices are created with a desired separation, which means that if too many vertices are requested with too large separation, the function may never return. The following must therefore be true: n*(d/r)^2 < 8 where n: number of vertices d: minimum separation distance r: polyhedron radius If this not true, the number of vertices is decreased.