Bsoft  2.1.0
Bernard's software package
model_poly_spiral.h File Reference

Functions to generate polyhedra using the spiral algorithm. More...

#include "rwmodel.h"

Go to the source code of this file.

Functions

Bmodel * model_poly_spiral (Bstring &seq, int valence, int requirements)
 Generates a polyhedron using the spiral algorithm. More...
 
int model_polyhedron_check (Bmodel *model, int valence)
 Checks a polyhedron for accuracy and completeness. More...
 
Bmodel * model_poly_gen_sequence (Bstring &seq, int valence, int enantiomorph, int requirements, int nm)
 Generates a polyhedron using a given sequence. More...
 
Bmodel * model_poly_gen_sequence (Bstring &seq, int valence, int enantiomorph, int requirements, int nm, double *table)
 Generates a polyhedron using a given sequence. More...
 
Bmodel * model_poly_gen_permutations (int vertices, int valence, int enantiomorph)
 All polyhedra are generated for a given number of vertices. More...
 
Bmodel * model_poly_gen_cone (int tip, int body, int base, int valence, int enantiomorph, int requirements)
 A cone tip with 5 pentagons and a base with 7 pentagons are use to generate polyhedra. More...
 
Bmodel * model_poly_gen_lozenge (int ttop, int tbody, int valence, int enantiomorph, int requirements)
 Two icosahedral tips are set up and polyhedra generated by rotating the 2 tips. More...
 
Bmodel * model_poly_gen_coffin (int ttop, int tbody, int tbase, int valence, int enantiomorph, int requirements)
 An icosahedral tip and a 6-fold base is set up and polyhedra generated by rotating the tip and base. More...
 
Bmodel * model_poly_gen_coffin_loose (int ttop, int tbody, int tbase, int valence, int enantiomorph, int requirements)
 An icosahedral tip and a 6-fold base is set up and polyhedra generated by permuting the tip and base. More...
 
Bmodel * model_poly_gen_coffin_jiggle (int ttop, int tbody, int tbase, int valence, int enantiomorph, int requirements)
 An icosahedral tip and a 6-fold base is set up and polyhedra generated by moving pentagons around. More...
 
Bmodel * model_poly_gen_3part (Bstring stip, Bstring sbody, Bstring sbase, int valence, int enantiomorph, int requirements)
 Generates several polyhedra by permuting the first and last parts of a three-part sequence. More...
 
Bmodel * model_poly_gen_move_pentagons (Bstring &seq, int valence, int enantiomorph, int requirements)
 Generates many polyhedrons using a given sequence and moving pentagons around. More...
 

Detailed Description

Functions to generate polyhedra using the spiral algorithm.

Author
Bernard Heymann
Date
Created: 20071127
Modified: 20080414

Definition in file model_poly_spiral.h.

Function Documentation

◆ model_poly_gen_3part()

Bmodel* model_poly_gen_3part ( Bstring  stip,
Bstring  sbody,
Bstring  sbase,
int  valence,
int  enantiomorph,
int  requirements 
)

Generates several polyhedra by permuting the first and last parts of a three-part sequence.

A recursive algorithm is used to generate several models by shifting the 
positions of pentagons in a sequence. 
Parameters
stiptip sequence (permuted).
sbodybody sequence (all hexagons).
sbasebase/end sequence (permuted).
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 814 of file model_poly_spiral.cpp.

◆ model_poly_gen_coffin()

Bmodel* model_poly_gen_coffin ( int  ttop,
int  tbody,
int  tbase,
int  valence,
int  enantiomorph,
int  requirements 
)

An icosahedral tip and a 6-fold base is set up and polyhedra generated by rotating the tip and base.

Parameters
ttopnumber of polygons between pentagons in the tip.
tbodynumber of body rings.
tbasenumber of polygons between pentagons in the base
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 665 of file model_poly_spiral.cpp.

◆ model_poly_gen_coffin_jiggle()

Bmodel* model_poly_gen_coffin_jiggle ( int  ttop,
int  tbody,
int  tbase,
int  valence,
int  enantiomorph,
int  requirements 
)

An icosahedral tip and a 6-fold base is set up and polyhedra generated by moving pentagons around.

Parameters
ttopnumber of polygons between pentagons in the tip.
tbodynumber of body rings.
tbasenumber of polygons between pentagons in the base
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 770 of file model_poly_spiral.cpp.

◆ model_poly_gen_coffin_loose()

Bmodel* model_poly_gen_coffin_loose ( int  ttop,
int  tbody,
int  tbase,
int  valence,
int  enantiomorph,
int  requirements 
)

An icosahedral tip and a 6-fold base is set up and polyhedra generated by permuting the tip and base.

Parameters
ttopnumber of polygons between pentagons in the tip.
tbodynumber of body rings.
tbasenumber of polygons between pentagons in the base
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 732 of file model_poly_spiral.cpp.

◆ model_poly_gen_cone()

Bmodel* model_poly_gen_cone ( int  tip,
int  body,
int  base,
int  valence,
int  enantiomorph,
int  requirements 
)

A cone tip with 5 pentagons and a base with 7 pentagons are use to generate polyhedra.

Parameters
tipnumber of vertices in the tip.
bodynumber of vertices in the body.
basenumber of vertices in the base.
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 557 of file model_poly_spiral.cpp.

◆ model_poly_gen_lozenge()

Bmodel* model_poly_gen_lozenge ( int  ttop,
int  tbody,
int  valence,
int  enantiomorph,
int  requirements 
)

Two icosahedral tips are set up and polyhedra generated by rotating the 2 tips.

Parameters
ttopnumber of polygons between pentagons in the tip.
tbodynumber of body rings.
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 598 of file model_poly_spiral.cpp.

◆ model_poly_gen_move_pentagons()

Bmodel* model_poly_gen_move_pentagons ( Bstring &  seq,
int  valence,
int  enantiomorph,
int  requirements 
)

Generates many polyhedrons using a given sequence and moving pentagons around.

A recursive algorithm is used to generate several models by shifting the 
positions of pentagons in a sequence. 
Parameters
&seqpolygon sequence.
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 915 of file model_poly_spiral.cpp.

◆ model_poly_gen_permutations()

Bmodel* model_poly_gen_permutations ( int  vertices,
int  valence,
int  enantiomorph 
)

All polyhedra are generated for a given number of vertices.

Parameters
verticesnumber of vertices.
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 494 of file model_poly_spiral.cpp.

◆ model_poly_gen_sequence() [1/2]

Bmodel* model_poly_gen_sequence ( Bstring &  seq,
int  valence,
int  enantiomorph,
int  requirements,
int  nm 
)

Generates a polyhedron using a given sequence.

A single model is generated based on the sequence. 
Parameters
&seqpolygon sequence.
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
nmcurrent number of models (before creating this one).
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 399 of file model_poly_spiral.cpp.

◆ model_poly_gen_sequence() [2/2]

Bmodel* model_poly_gen_sequence ( Bstring &  seq,
int  valence,
int  enantiomorph,
int  requirements,
int  nm,
double *  table 
)

Generates a polyhedron using a given sequence.

A single model is generated based on the sequence. 
A table is used to keep track of sets of eigenvalues of previous models
to avoid generating redundant models. 
Parameters
&seqpolygon sequence.
valencevertex valence.
enantiomorphflag to generate enantiomorphs.
requirementspolyhedron requirements.
nmcurrent number of models (before creating this one).
*tabletable for sets of eigenvalues.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 419 of file model_poly_spiral.cpp.

◆ model_poly_spiral()

Bmodel* model_poly_spiral ( Bstring &  seq,
int  valence,
int  requirements 
)

Generates a polyhedron using the spiral algorithm.

Polygons are added based on the given sequence.
The success of the algorithm is checked using the indicated requirements:
    0       only a polyhedron consistency check is done
    1       the exact number of vertices must be obtained
    2       only a polyhedron with isolated pentagons is accepted
The generation fails when an incorrect number of vertices are added
or some of the vertices have incorrect valency. 
Parameters
&seqpolygon sequence.
valencevertex valence.
requirementspolyhedron requirements.
Returns
Bmodel* new model, NULL if generation failed.

Definition at line 274 of file model_poly_spiral.cpp.

◆ model_polyhedron_check()

int model_polyhedron_check ( Bmodel *  model,
int  valence 
)

Checks a polyhedron for accuracy and completeness.

Every component must have the required number of links = valence.
Every component must have the required number of polygons = valence.
The polyhedron must adhere to Euler's formula:
    components + polygons - links = 2
Parameters
*modelmodel structure.
valencevertex valence.
Returns
int number of failed conditions.

Definition at line 336 of file model_poly_spiral.cpp.