Antiprism 0.23
|
Make a uniform polygon. More...
#include <polygons.h>
Public Member Functions | |
polygon (int N, int D=1) | |
Constructor. | |
virtual | ~polygon () |
Destructor. | |
void | set_radius (double r) |
Set the circumradius. | |
virtual bool | set_radius2 (double r, char *msg=0) |
Set second radius. | |
void | set_edge (double len) |
Set the edge (polygon side) length. | |
double | get_edge () |
Get the edge (polygon side) length. | |
double | angle () |
Get the angle that an edge makes at the centre. | |
int | get_num_sides () |
Get the number of sides of the (component) polygon. | |
int | get_step () |
Get the number of vertices stepped by a side of the (component) polygon. | |
int | get_parts () |
Get the number of component parts of a polygon. | |
void | add_polygon (geom_if &geom, double ht=0) |
Add a polygon aligned with the xy plane and at a given z-height. | |
virtual void | make_poly (geom_if &geom) |
Make a polygon based polyhedron. | |
virtual bool | set_height (double ht, char *msg=0) |
Set the height. | |
double | get_height () |
Get the height. | |
virtual bool | set_height2 (double ht, char *msg=0) |
Set second height. | |
virtual bool | set_edge2 (double len2, char *msg=0) |
Set the edge length of the non-polygon edges. | |
virtual bool | set_subtype (int typ, char *msg=0) |
Set the subtype of the polygon based polyhedron. | |
virtual bool | set_twist_angle (double ang=NAN, char *msg=0) |
Set the twist angle of the polygon based polyhedron. | |
virtual bool | set_twist_angle2 (double ang=NAN, char *msg=0) |
Set the second twist angle of the polygon based polyhedron. | |
virtual void | make_poly_part (geom_if &geom) |
Make a part of (or a complete) polygon-based polyhedron. | |
void | dump () |
Dump polygon data to stderr. | |
Protected Attributes | |
int | num_sides |
The number of sides of the polygon (n of {n/d}) | |
int | step |
The number of verts stepped by an side (m of {n/d}) | |
int | parts |
The number of parts (polygon may be compound). | |
double | radius |
The polygon circumradius. | |
double | radius2 |
A second radius. | |
double | height |
The primary height of a polyhedron. | |
double | height2 |
A second height used for a polyhedron. | |
double | twist_angle |
An angle to twist a polyhedron. | |
double | twist_angle2 |
A second angle to twist a polyhedron. | |
int | subtype |
The subtype of a polygon based polyhedron. | |
int | max_subtype |
The highest number for a subtype. |
Make a uniform polygon.
polygon::polygon | ( | int | N, |
int | D = 1 |
||
) |
Constructor.
Polygon in form {N/D} (with N/D not necessarily in lowest form.)
N | number of sides to the (compound) polygon. |
D | the number of vertices stepped by an edge (default 1) |
void polygon::add_polygon | ( | geom_if & | geom, |
double | ht = 0 |
||
) |
Add a polygon aligned with the xy plane and at a given z-height.
geom | the geometry to add the polygon to. |
ht | the height on the z-axis to place the polygon. |
double polygon::angle | ( | ) | [inline] |
Get the angle that an edge makes at the centre.
double polygon::get_edge | ( | ) | [inline] |
Get the edge (polygon side) length.
double polygon::get_height | ( | ) | [inline] |
Get the height.
int polygon::get_num_sides | ( | ) | [inline] |
Get the number of sides of the (component) polygon.
int polygon::get_parts | ( | ) | [inline] |
Get the number of component parts of a polygon.
If the polygon step is not in lowest form the polygon will be compound and have more than one part.
int polygon::get_step | ( | ) | [inline] |
Get the number of vertices stepped by a side of the (component) polygon.
void polygon::make_poly | ( | geom_if & | geom | ) | [virtual] |
Make a polygon based polyhedron.
geom | a geometry to return the polyhedron. |
virtual void polygon::make_poly_part | ( | geom_if & | geom | ) | [inline, virtual] |
Make a part of (or a complete) polygon-based polyhedron.
Make a non-compound polyhedron, using num_sides
and step
for {n/d}. If parts
is greater than 1
then polygon::make_poly will make a compound by repeating this polyhedron parts
times.
geom | a geometry to return the polyhedron. |
Reimplemented in dihedron, prism, antiprism, snub_antiprism, pyramid, dipyramid, cupola, orthobicupola, gyrobicupola, and crown_poly.
void polygon::set_edge | ( | double | len | ) | [inline] |
Set the edge (polygon side) length.
len | the edge length. |
bool polygon::set_edge2 | ( | double | len2, |
char * | msg = 0 |
||
) | [inline, virtual] |
Set the edge length of the non-polygon edges.
These are the vertical edges of a prism, the slanting edges of a pyramid, etc.
len2 | the edge length of the non-polygon edges. |
msg | a string with length at least MSG_SZ to hold the error message if the edge length was not valid. |
true
if the edge length was valid, otherwise false
and msg
contains the error messge. Reimplemented in prism, antiprism, snub_antiprism, pyramid, cupola, and crown_poly.
bool polygon::set_height | ( | double | ht, |
char * | msg = 0 |
||
) | [inline, virtual] |
Set the height.
ht | the height. |
msg | a string with length at least MSG_SZ to hold the error message if the height was not valid. |
true
if the height was valid, otherwise false
and msg
contains the error messge. Reimplemented in antiprism, snub_antiprism, and crown_poly.
bool polygon::set_height2 | ( | double | ht, |
char * | msg = 0 |
||
) | [inline, virtual] |
Set second height.
ht | the height. |
msg | a string with length at least MSG_SZ to hold the error message if the height was not valid. |
true
if the height was valid, otherwise false
and msg
contains the error messge. void polygon::set_radius | ( | double | r | ) | [inline] |
Set the circumradius.
r | the circumradius. |
bool polygon::set_radius2 | ( | double | r, |
char * | msg = 0 |
||
) | [inline, virtual] |
Set second radius.
r | the radius. |
msg | a string with length at least MSG_SZ to hold the error message if the height was not valid. |
true
if the radius was valid, otherwise false
and msg
contains the error messge. bool polygon::set_subtype | ( | int | typ, |
char * | msg = 0 |
||
) | [virtual] |
Set the subtype of the polygon based polyhedron.
Some polygon based polyhedra come in several forms, and setting the sub-type can select a particular form.
typ | the sub-type number. |
msg | a string with length at least MSG_SZ to hold the error message if the edge length was not valid. |
true
if the sub-type was valid, otherwise false
and msg
contains the error messge. bool polygon::set_twist_angle | ( | double | ang = NAN , |
char * | msg = 0 |
||
) | [inline, virtual] |
Set the twist angle of the polygon based polyhedron.
Some polyhedra can be transformed by a twist, controlled by this angle. NAN indicates that no twist should be considered.
ang | the angle of twist (default: NAN for no twist). |
msg | a string with length at least MSG_SZ to hold the error message if the edge length was not valid. |
true
if the polyhedron could be twisted, otherwise false
and msg
contains the error messge. Reimplemented in prism, antiprism, pyramid, cupola, and crown_poly.
bool polygon::set_twist_angle2 | ( | double | ang = NAN , |
char * | msg = 0 |
||
) | [inline, virtual] |
Set the second twist angle of the polygon based polyhedron.
Some polyhedra can be transformed by a second twist, controlled by this angle. NAN indicates that no twist should be considered.
ang | the angle of twist (default: NAN for no twist). |
msg | a string with length at least MSG_SZ to hold the error message if the edge length was not valid. |
true
if the polyhedron could be twisted, otherwise false
and msg
contains the error messge. Reimplemented in antiprism.