Java API by
Zvi Har’El

kaleido
Class Polyhedron

java.lang.Object
  extended by kaleido.Polyhedron
Direct Known Subclasses:
Output

public class Polyhedron
extends Object

The class Polyhedron contains the fields which describe a uniform polyhedron and its duals and the method necessary to compute them from the basic input, which is the Wythoff symbol of the polyhedron.

Version:
$Id: Polyhedron.java,v 1.75 2007/02/09 20:07:06 rl Exp $
Author:
Zvi Har’El
See Also:
Class source code

Field Summary
(package private)  int[][] adj
          The vertex-vertex adjacency matrix.
(package private)  boolean[] anti
          A boolean array of length E.
(package private) static double BIG_EPSILON
          The minimum difference in the coordinates between two distinct vertices.
(package private)  String config
          The printable vertex configuration.
private  int cx
           
private  int cy
           
(package private)  int D
          The density of the polyhedron.
(package private) static double DBL_EPSILON
          The difference between 1.0 and the minimum double greater than 1.0.
(package private)  boolean drawn
           
(package private)  String dual
          The dual name, standard or manifuctured.
(package private)  int[][] e
          The edge list.
(package private)  int E
          The edge count.
(package private)  int even
          Marks the removed face in a polyhedron of type pqr|, where one of the rationals has an even denominator.
(package private)  Vector3D[] f
          The face coordinates.
(package private)  int F
          The face count.
(package private)  int[] Fi
          The face counts by type.
(package private)  int[] firstrot
          Temporary storage for vertex generation.
(package private)  int[] ftype
          The face types.
(package private)  int g
          The order of the symmetry group of the polyhedron.
(package private)  double gon
          The type of the polygon serving as a base for a dihedral polyhedron.
(package private)  boolean hemi
          Marks polyhedra of a “hemi” type.
(package private)  int[][] incid
          The vertex-face incidence matrix.
(package private)  int index
          The index of the polyhedron in the standard list.
(package private)  int K
          The type of the symmetry group of the polyhedron.
(package private)  double[] m
          The number of faces at a vertex of each type.
(package private)  int M
          The vertex valency.
(package private)  double minr
          The smallest nonzero inradius of the polyhedron.
(package private)  double[] n
          The number of sides of a face of each type.
(package private)  int N
          The number of faces types.
(package private)  String name
          The polyhedron name, standard or manifuctured.
private  Vector3D[] newv
           
private  Vector3D[] oldv
           
(package private)  boolean onesided
          Marks one-sided, i.e., non-oriantable, polyhedra.
(package private)  Rational[] p
          The four elements of the Wythoff formula, with the vertical bar represented by a zero.
private  int radius
           
(package private)  int[] rot
          The vertex configuration.
(package private)  boolean[] snub
          Marks the snub triangles in the vertex configuration.
(package private)  Vector3D[] v
          The vertex coordinates.
(package private)  int V
          The vertex count.
(package private)  String wythoff
          The printable Wythoff symbol.
(package private)  double[] γ
          The fundamental angles in radians.
(package private)  int χ
          Euler characteristic of the polyhedron.
 
Constructor Summary
Polyhedron(int i)
           
Polyhedron(String s)
           
 
Method Summary
(package private)  void configuration()
          Generate a printable vertex configuration symbol.
(package private)  void count()
          Compute edge and face counts, and update D and χ.
(package private)  void decompose()
          Decompose Schwarz triangle into N right triangles and compute the vertex count V and the vertex valency M.
(package private)  void dihedral(double gon, String name, String dual)
           
(package private)  void draw(Scope applet, Graphics g, Vector3D a, Vector3D b, boolean pen)
           
(package private)  void edgelist(boolean uniform)
          Computes edge list of the polyhedron or its dual.
(package private)  void exceptions()
          Handle the exceptional cases which need postprocessing.
(package private)  void faces()
          Compute polyhedron faces (dual vertices) and incidence matrices.
(package private)  void guessname()
          Get the polyhedron name, using standard list or guesswork.
(package private) static int mod(int i, int j)
          compute the mathematical modulus function.
(package private)  void moebius()
          Using Wythoff symbol (p|qr, pq|r, pqr| or |pqr), find the Moebius triangle (2 3 K) (or (2 2 n)) of the Schwarz triangle (pqr), the order g of its symmetry group, its Euler characteristic χ, and its covering density D.
(package private)  void newton()
          Solve the fundamental right spherical triangles.
(package private)  void paint(Scope applet, Graphics g, double angle, boolean uniform)
          Draw a polyhedron.
(package private)  void parse(String s)
          Parse input symbol: Wythoff symbol or an index to Uniform.list.
(package private) static Object resize(Object o, int l)
          Resize an array.
(package private)  void vertices()
          Compute polyhedron vertices and vertex adjecency lists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

int index
The index of the polyhedron in the standard list.

See Also:
Uniform.list

p

Rational[] p
The four elements of the Wythoff formula, with the vertical bar represented by a zero.

See Also:
Uniform.Entry.wythoff, parse(java.lang.String)

M

int M
The vertex valency. May be big for dihedral polyhedra.


N

int N
The number of faces types. Atmost 5.


V

int V
The vertex count.


E

int E
The edge count.


F

int F
The face count.


χ

int χ
Euler characteristic of the polyhedron. It is given by Euler’s formula V - E + F = χ. It is two for convex polyhedra.


D

int D
The density of the polyhedron. This is the number of times the spherical projection of the polyhedron covers the sphere. It is one for convex polyhedra.


g

int g
The order of the symmetry group of the polyhedron.

See Also:
moebius()

K

int K
The type of the symmetry group of the polyhedron. The possible values are 2, 3, 4 and 5 for the dihedral, tetrahedral, octahedral and icosahedral groups, respectively.


hemi

boolean hemi
Marks polyhedra of a “hemi” type. Such polyhedra contain equatorial faces, whose spherical projection is a hemisphere.

See Also:
decompose()

onesided

boolean onesided
Marks one-sided, i.e., non-oriantable, polyhedra.

See Also:
decompose()

snub

boolean[] snub
Marks the snub triangles in the vertex configuration. An array of length M


anti

boolean[] anti
A boolean array of length E. It is not null only for the duals of the uniform polyhedra of the “hemi” type, which have ideal vertices.

See Also:
edgelist(boolean)

gon

double gon
The type of the polygon serving as a base for a dihedral polyhedron.


minr

double minr
The smallest nonzero inradius of the polyhedron.


γ

double[] γ
The fundamental angles in radians. An array of length N.


m

double[] m
The number of faces at a vertex of each type. An array of length N.


n

double[] n
The number of sides of a face of each type. An array of length N.


even

int even
Marks the removed face in a polyhedron of type pqr|, where one of the rationals has an even denominator.

See Also:
decompose()

Fi

int[] Fi
The face counts by type. An array of length N.


firstrot

int[] firstrot
Temporary storage for vertex generation. An array of length V.


ftype

int[] ftype
The face types. An array of length F.


rot

int[] rot
The vertex configuration. A array of length M with elements in the range 0..N-1.


adj

int[][] adj
The vertex-vertex adjacency matrix. A M x V matrix with elements in the range 0..V-1.


e

int[][] e
The edge list. A 2 x E matrix.


incid

int[][] incid
The vertex-face incidence matrix. A M x V matrix with elements in the range 0..F-1.


config

String config
The printable vertex configuration.


name

String name
The polyhedron name, standard or manifuctured.


dual

String dual
The dual name, standard or manifuctured.


wythoff

String wythoff
The printable Wythoff symbol.


f

Vector3D[] f
The face coordinates. An array of length F.


v

Vector3D[] v
The vertex coordinates. An array of length V.


DBL_EPSILON

static final double DBL_EPSILON
The difference between 1.0 and the minimum double greater than 1.0. The exact value is 2^-52, approximately 2.2204460492503131e-16.


BIG_EPSILON

static final double BIG_EPSILON
The minimum difference in the coordinates between two distinct vertices.

See Also:
Constant Field Values

drawn

boolean drawn

cx

private int cx

cy

private int cy

radius

private int radius

oldv

private Vector3D[] oldv

newv

private Vector3D[] newv
Constructor Detail

Polyhedron

Polyhedron(int i)

Polyhedron

Polyhedron(String s)
Method Detail

parse

void parse(String s)
Parse input symbol: Wythoff symbol or an index to Uniform.list. The symbol is a # followed by a number, or a three fractions and a bar in some order. We allow no bars only if it result from the input symbol #80.


moebius

void moebius()
Using Wythoff symbol (p|qr, pq|r, pqr| or |pqr), find the Moebius triangle (2 3 K) (or (2 2 n)) of the Schwarz triangle (pqr), the order g of its symmetry group, its Euler characteristic χ, and its covering density D.

g is the number of copies of (2 3 K) covering the sphere, i.e.,

            g * π * (1/2 + 1/3 + 1/K - 1) = 4 * π
 
D is the number of times g copies of (pqr) cover the sphere, i.e.
            D * 4 * π = g * π * (1/p + 1/q + 1/r - 1)
 
χ is V - E + F, where F = g is the number of triangles, E = 3*g/2 is the number of triangle edges, and V = Vp+ Vq+ Vr, with Vp = g/(2*np) being the number of vertices with angle π/p (np is the numerator of p).


decompose

void decompose()
Decompose Schwarz triangle into N right triangles and compute the vertex count V and the vertex valency M. V is computed from the number g of Schwarz triangles in the cover, divided by the number of triangles which share a vertex. It is halved for one-sided polyhedra, because the kaleidoscopic construction really produces a double orientable covering of such polyhedra. All q′ q|r are of the “hemi” type, i.e. have equatorial {2r} faces, and therefore are (except 3/2 3|3 and the dihedra 2 2|r) one-sided. A well known example is 3/2 3|4, the “one-sided heptahedron”. Also, all p q r| with one even denominator have a crossed parallelogram as a vertex figure, and thus are one-sided as well.


guessname

void guessname()
Get the polyhedron name, using standard list or guesswork. Ideally, we should try to locate the Wythoff symbol in the standard list (unless, of course, it is dihedral), after doing few normalizations, such as sorting angles and splitting isoceles triangles.


dihedral

void dihedral(double gon,
              String name,
              String dual)

newton

void newton()
Solve the fundamental right spherical triangles.


exceptions

void exceptions()
Handle the exceptional cases which need postprocessing. Postprocess pqr| where r has an even denominator (cf. Coxeter et al. Sec.9). Remove the {2r} and add a retrograde {2p} and retrograde {2q}. Postprocess the last polyhedron |3/2 5/3 3 5/2 by taking a |5/3 3 5/2, replacing the three snub triangles by four equatorial squares and adding the missing {3/2} (retrograde triangle, cf. Coxeter et al. Sec. 11).


count

void count()
Compute edge and face counts, and update D and χ. Update D in the few cases the density of the polyhedron is meaningful but different than the density of the corresponding Schwarz triangle (cf. Coxeter et al., p. 418 and p. 425). In these cases, spherical faces of one type are concave (bigger than a hemisphere), and the actual density is the number of these faces less the computed density. Note that if j != 0, the assignment γ[j] = asin(...) implies γ[j] cannot be obtuse. Also, compute χ for the only non-Wythoffian polyhedron.


configuration

void configuration()
Generate a printable vertex configuration symbol.


vertices

void vertices()
Compute polyhedron vertices and vertex adjecency lists. The vertices adjacent to v[i] are v[adj[0][i], v[adj[1][i], ... v[adj[M-1][i], ordered counterclockwise. The algorith is a BFS on the vertices, in such a way that the vetices adjacent to a givem vertex are obtained from its BFS parent by a cyclic sequence of rotations. firstrot[i] points to the first rotaion in the sequence when applied to v[i]. Note that for non-snub polyhedra, the rotations at a child are opposite in sense when compared to the rotations at the parent. Thus, we fill adj[*][i] from the end to signify clockwise rotations. The firstrot[] array is not needed for display thus it is freed after being used for face computations below.


faces

void faces()
Compute polyhedron faces (dual vertices) and incidence matrices. For orientable polyhedra, we can distinguish between the two faces meeting at a given directed edge and identify the face on the left and the face on the right, as seen from the outside. For one-sided polyhedra, the vertex figure is a papillon (in Coxeter et al. terminology, a crossed parallelogram) and the two faces meeting at an edge can be identified as the side face (n[1] or n[2]) and the diagonal face (n[0] or n[3]).


edgelist

void edgelist(boolean uniform)
Computes edge list of the polyhedron or its dual. If the polyhedron is of the “hemi” type, each edge og the dual has one finite vertex and one ideal vertex. We make sure the latter is always the out-vertex, so that the edge becomes a ray (half-line). Each ideal vertex is represented by a unit vector, and the direction of the ray is either parallel or anti-parallel this vector. We flag this in the array anti[E].


paint

void paint(Scope applet,
           Graphics g,
           double angle,
           boolean uniform)
Draw a polyhedron. To enable drawing the duals of hemi-polyhedra, which have ideal vertices as the polar reciprocals of hemispherical faces, anti[V] may be given. anti[i] is set if the ray from the v[e[0][i]] to the ideal vertex v[e[1][i]] is anti-parallel to the (unit) Vector representing that vertex. In a finite polyhedron, anti should be null.


draw

void draw(Scope applet,
          Graphics g,
          Vector3D a,
          Vector3D b,
          boolean pen)

mod

static int mod(int i,
               int j)
compute the mathematical modulus function.


resize

static Object resize(Object o,
                     int l)
Resize an array.


Java API by
Zvi Har’El

Copyright © Zvi Har’El
$Date: 2007/10/15 13:50:30$