/Users/bernard/b20/bsoft/src/model/model_create.cpp(3)

NAME
/Users/bernard/b20/bsoft/src/model/model_create.cpp - A tool to expand models.

SYNOPSIS

#include 'rwmodel.h'
#include 'model_create.h'
#include 'model_transform.h'
#include 'model_symmetry.h'
#include 'model_util.h'
#include 'random_numbers.h'
#include 'utilities.h'

  Functions
Bcomponent * model_add_component (Bmodel *model, Bstring &id, Bstring &type, Vector3< double > loc)
Adds a component to a model.
Bmodel * model_platonic (Bsymmetry *sym, double radius)
Generates a platonic polyhedron.
Bmodel * model_helix (double radius, double helix_rise, double helix_angle, long ncomp)
Generates a helix model.
Bmodel * model_random (long ncomp, double comp_radius, double max_radius)
Generates components at random non-overlapping locations and with random views.
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.
Bmodel * model_random_gaussian (long ncomp, double std)
Generates components at random gaussian-distributed locations and with random views.
Bmodel * model_random_shell (long ncomp, double radius)
Generates random components on a shell.
Bmodel * model_random_shell (long ncomp, double radius, double separation)
Generates random components on a shell.
Bmodel * model_create_shell (long number, double radius, double distance)
Creates a sphere point model.
Bmodel * model_create_fibonacci_sphere (long number, double radius)
Creates a Fibonacci sphere point model.
long model_subdivide (Bmodel *model, long division)
long model_spherize (Bmodel *model, double sphere_fraction)
Bmodel * model_create_dodecahedron (double radius, long divisions, double sphere_fraction)
Creates an dodecahedron point model.
Bmodel * model_create_icosahedron (double radius, long divisions, double sphere_fraction)
Creates an icosahedron point model.
double ellipsoid_slice_distance_error (Vector3< double > axes, double z1, double z2, double distance)
Calculates how far the slice separation is from ideal.
double ellipsoid_next_z (Vector3< double > axes, double z1, double distance)
Calculates the next slice's z component to evenly space slices.
double ellipse_next_x (Vector3< double > axes, double x1, double distance)
Calculates the next slice's x component to evenly space points.
Bmodel * model_create_circle (double radius, double z, double distance)
Creates a circle with the given radius, height, and component separation.
Bmodel * model_create_ellipse (Vector3< double > axes, double distance)
Creates an ellipse with given semiaxes and component separation.
Bmodel * model_create_ellipsoid (Vector3< double > axes, double distance)
Creates an ellipsoid with given semiaxes and component separation.
Bmodel * model_create_cylinder (Vector3< double > direction, double radius, double length, double distance)
Creates a cylinder with the given radius, length, and component separation.
Bmodel * model_create_plane (double length, double width, double z, double distance)
Creates a plane with the given length, width, height, and component separation.
Bmodel * model_create_spindle (Vector3< double > direction, double radius, double separation, double packing)
Creates a spindle packed inside a sphere.

  Variables
int verbose

Detailed Description

A tool to expand models.

Author:
    Bernard Heymann

Date:
    Created: 20090714

    Modified: 20180314

Definition in file model_create.cpp.

Function Documentation

  double ellipse_next_x (Vector3< double > axes, double x1, double distance)

Calculates the next slice's x component to evenly space points.

Author:
    Jonathan Luo

Parameters:
    axes the ellipse axis lengths and z-height
    x1 ???
    distance separation distance

Returns:
    double next x-coordinate

    Solves the 4th order polynomial by bracketing.

Definition at line 846 of file model_create.cpp.

  double ellipsoid_next_z (Vector3< double > axes, double z1, double distance)

Calculates the next slice's z component to evenly space slices.

Author:
    Jonathan Luo

Parameters:
    axes ellipsoid axis lengths
    z1 previous slice's z
    distance separation distance

Returns:
    double next slice's z-coordinate

Definition at line 806 of file model_create.cpp.

  double ellipsoid_slice_distance_error (Vector3< double > axes, double z1, double z2, double distance)

Calculates how far the slice separation is from ideal.

Author:
    Jonathan Luo

Parameters:
    axes ellipsoid axis lengths
    z1 previous slice z value
    z2 next slice z value
    distance target separation distance

Returns:
    double the distance error (2.0*distance is target sum for the 2 distances)

    For the generalized ellipsoid, the distance between points of 2 slices varies
    if the x and y axes are not equal. The best slice will have a component some
    distance+error separated at the shorter axis and distance-error at the longer axis,
    distributing the error. Solve the ellipsoid equation for those two points and distances.

Definition at line 788 of file model_create.cpp.

  Bcomponent* model_add_component (Bmodel * model, Bstring & id, Bstring & type, Vector3< double > loc)

Adds a component to a model.

Parameters:
    *model model list.
    &id model identifier.
    &type component type.
    loc component location.

Returns:
    Bcomponent* new component.

    The component is added to the model indicated by the ID, the type and
    the location given.

Definition at line 32 of file model_create.cpp.

  Bmodel* model_create_circle (double radius, double z, double distance)

Creates a circle with the given radius, height, and component separation.

Author:
    Jonathan Luo

Parameters:
    radius radius length.
    z height.
    distance separation distance.

Returns:
    Bmodel* new circle model.

    Find angle associated with separation distance using Law of Cosines.

Definition at line 897 of file model_create.cpp.

  Bmodel* model_create_cylinder (Vector3< double > direction, double radius, double length, double distance)

Creates a cylinder with the given radius, length, and component separation.

Author:
    Jonathan Luo

Parameters:
    direction cylinder axis direction
    radius radius length.
    length cylinder length.
    distance separation distance.

Returns:
    Bmodel* new cylinder model.

    Find angle associated with separation distance using Law of Cosines.

Definition at line 1101 of file model_create.cpp.

  Bmodel* model_create_dodecahedron (double radius, long divisions, double sphere_fraction)

Creates an dodecahedron point model.

Parameters:
    radius sphere radius.
    divisions number of divisions from a base dodecahedron.
    sphere_fraction spherical fraction: 0=dodecahedral, 1=spherical.

Returns:
    Bmodel* new sphere model.

Definition at line 675 of file model_create.cpp.

  Bmodel* model_create_ellipse (Vector3< double > axes, double distance)

Creates an ellipse with given semiaxes and component separation.

Author:
    Jonathan Luo

Parameters:
    axes ellipse axis x and y lengths and z height
    distance separation distance

Returns:
    Bmodel* new ellipse model.

Definition at line 947 of file model_create.cpp.

  Bmodel* model_create_ellipsoid (Vector3< double > axes, double distance)

Creates an ellipsoid with given semiaxes and component separation.

Author:
    Jonathan Luo

Parameters:
    axes ellipsoid axis lengths
    distance separation distance

Returns:
    Bmodel* new ellipsoid model.

Definition at line 1011 of file model_create.cpp.

  Bmodel* model_create_fibonacci_sphere (long number, double radius)

Creates a Fibonacci sphere point model.

Parameters:
    number number of points.
    radius sphere radius.

Returns:
    Bmodel* new sphere model.

Definition at line 569 of file model_create.cpp.

  Bmodel* model_create_icosahedron (double radius, long divisions, double sphere_fraction)

Creates an icosahedron point model.

Parameters:
    radius sphere radius.
    divisions number of divisions from a base icosahedron.
    sphere_fraction spherical fraction: 0=dodecahedral, 1=spherical.

Returns:
    Bmodel* new sphere model.

Definition at line 732 of file model_create.cpp.

  Bmodel* model_create_plane (double length, double width, double z, double distance)

Creates a plane with the given length, width, height, and component separation.

Parameters:
    length dimension in x.
    width dimension in y.
    z height.
    distance separation distance.

Returns:
    Bmodel* new circle model.

    The components are placed in a hexagonal arrangement to simulate the
    most commonly expected close packingx.

Definition at line 1170 of file model_create.cpp.

  Bmodel* model_create_shell (long number, double radius, double distance)

Creates a sphere point model.

Parameters:
    number number of points.
    radius sphere radius.
    distance distance between points.

Returns:
    Bmodel* new sphere model.

    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.

Definition at line 472 of file model_create.cpp.

  Bmodel* model_create_spindle (Vector3< double > direction, double radius, double separation, double packing)

Creates a spindle packed inside a sphere.

Parameters:
    direction spindle axis direction
    radius sphere radius.
    separation separation distance between successive components.
    packing distance between spindle strands.

Returns:
    Bmodel* new spindle model.

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.

Definition at line 1229 of file model_create.cpp.

  Bmodel* model_helix (double radius, double helix_rise, double helix_angle, long ncomp)

Generates a helix model.

Parameters:
    radius distance of each vertex from helical axis.
    helix_rise helical rise.
    helix_angle helical rotation angle.
    ncomp number of components.

Returns:
    Bmodel* new model.

Definition at line 153 of file model_create.cpp.

  Bmodel* model_platonic (Bsymmetry * sym, double radius)

Generates a platonic polyhedron.

Parameters:
    *sym symmetry.
    radius distance of each vertex from origin.

Returns:
    Bmodel* new model.

    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.

Definition at line 82 of file model_create.cpp.

  Bmodel* model_random (long ncomp, double comp_radius, double max_radius)

Generates components at random non-overlapping locations and with random views.

Parameters:
    ncomp number of components.
    comp_radius component radius.
    max_radius maximum radius of components.

Returns:
    Bmodel* new model.

    If a new component overlaps within an existing component, as defined
    by the component radius, new random coordinates are generated for it.

Definition at line 201 of file model_create.cpp.

  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.

Parameters:
    ncomp number of components.
    comp_radius component radius.
    min minimum bounds.
    max maximum bounds.

Returns:
    Bmodel* new model.

    If a new component overlaps within an existing component, as defined
    by the component radius, new random coordinates are generated for it.

Definition at line 260 of file model_create.cpp.

  Bmodel* model_random_gaussian (long ncomp, double std)

Generates components at random gaussian-distributed locations and with random views.

Parameters:
    ncomp number of components.
    std standard deviation of gaussian distribution.

Returns:
    Bmodel* new model.

    Overlapping components are generated.

Definition at line 318 of file model_create.cpp.

  Bmodel* model_random_shell (long ncomp, double radius)

Generates random components on a shell.

Parameters:
    ncomp number of components.
    radius shell radius.

Returns:
    Bmodel* new model.

    Overlapping components are generated.

Definition at line 361 of file model_create.cpp.

  Bmodel* model_random_shell (long ncomp, double radius, double separation)

Generates random components on a shell.

Parameters:
    ncomp number of components.
    radius shell radius.
    separation minimum vertex separation distance.

Returns:
    Bmodel* new model.

    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.

Definition at line 415 of file model_create.cpp.

  long model_spherize (Bmodel * model, double sphere_fraction)

Definition at line 652 of file model_create.cpp.

  long model_subdivide (Bmodel * model, long division)

Definition at line 619 of file model_create.cpp.

Variable Documentation

  int verbose

Author

Generated automatically by Doxygen for Bsoft from the source code.