| Bsoft 2.0.5 Bernard's software package

Functions
model_create.h File Reference

Library routines used for model creation. More...

`#include "rwmodel.h"`
`#include "symmetry.h"`

Go to the source code of this file.

## Functions
Bcomponent * | model_add_component (Bmodel *model, Bstring &id, Bstring &type, Vector3< double > loc)
| Adds a component 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 sphere 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...

## Detailed Description

Library routines used for model creation.

Author
  Bernard Heymann

Date
  Created: 20090714
  Modified: 20180314

Definition in file model_create.h.

## Function Documentation

## ◆ model_add_component()

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.

## ◆ model_create_circle()

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.

## ◆ model_create_cylinder()

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.

## ◆ model_create_dodecahedron()

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.

## ◆ model_create_ellipse()

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.

## ◆ model_create_ellipsoid()

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.

## ◆ model_create_fibonacci_sphere()

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.

## ◆ model_create_icosahedron()

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.

## ◆ model_create_plane()

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.

## ◆ model_create_shell()

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.

## ◆ model_create_spindle()

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.

## ◆ model_helix()

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.

## ◆ model_platonic()

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.

## ◆ model_random() [1/2]

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.

## ◆ model_random() [2/2]

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.

## ◆ model_random_gaussian()

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.

## ◆ model_random_shell() [1/2]

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.

## ◆ model_random_shell() [2/2]

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.