Jump to content

User:Cyp/Java

From Wikipedia, the free encyclopedia

Polyhedra.html

[edit]

For drawing an old version of the polyhedrons at platonic solid and archimedean solid. Can't draw the ones at catalan solid.

<html><head><title>Polyhedra</title><body>
<applet width=200 height=200 code="Polyhedra.class" codebase="."></applet>
</html>

Polyhedra.java

[edit]

import java.awt.*;
import java.applet.*;

//-a,-b,-c, -a,-b,c, -a,b,-c, -a,b,c, a,-b,-c, a,-b,c, a,b,-c, a,b,c,
//-c,-a,-b, -c,-a,b, -c,a,-b, -c,a,b, c,-a,-b, c,-a,b, c,a,-b, c,a,b,
//-b,-c,-a, -b,-c,a, -b,c,-a, -b,c,a, b,-c,-a, b,-c,a, b,c,-a, b,c,a,

public class Polyhedra extends Applet{
  double g=1.6180339887498948482045868343656381177203; //(1+Math.sqrt(5))/2;
  double d=0.6180339887498948482045868343656381177203; //1/g;
  double s=1.4142135623730950488016887242096980785696; //Math.sqrt(2);
  double q=2.6180339887498948482045868343656381177203; //(1+Math.sqrt(5))/2+1;
  double j=3.2360679774997896964091736687312762354406; //(1+Math.sqrt(5));
  double w=(Math.pow(Math.sqrt(297)+17, 1/3.)-Math.pow(Math.sqrt(297)-17, 1/3.)-1)/3; //w+w*w+w*w*w==1
  double w2=Math.pow((g+Math.sqrt(g-5/27.))/2, 1/3.)+Math.pow((g-Math.sqrt(g-5/27.))/2, 1/3.); //w2*w2*w2-2*w2==g
  double aa=w2-1/w2;
  double bb=w2*g+q+g/w2;
  double tetrav[]={
-1,-s,0, -1,s,0, 1,0,-s, 1,0,s};
  int tetrat[]={
0,1,3, 3,1,2, 1,0,2, 3,2,0};
  double hexav[]={
-1,-1,-1, -1,-1,1, -1,1,-1, -1,1,1, 1,-1,-1, 1,-1,1, 1,1,-1, 1,1,1};
  int hexat[]={
0,2,3,1, 2,6,7,3, 0,4,6,2, 3,7,5,1, 0,1,5,4, 6,4,5,7};
  double octav[]={
-1,0,0, 1,0,0, 0,-1,0, 0,1,0, 0,0,-1, 0,0,1};
  int octat[]={
0,4,3, 3,4,1, 1,4,2, 2,4,0, 3,5,0, 0,5,2, 2,5,1, 1,5,3};
  double dodecav[]={
0,-d,-g, 0,-d,g, 0,d,-g, 0,d,g, -d,-g,0, -d,g,0, d,-g,0, d,g,0, -g,0,-d, g,0,-d, -g,0,d, g,0,d, -1,-1,-1, -1,-1,1, -1,1,-1, -1,1,1, 1,-1,-1, 1,-1,1, 1,1,-1, 1,1,1};
  int dodecat[]={
0,2,14,8,12, 0,16,9,18,2, 4,6,16,0,12, 2,18,7,5,14, 13,4,12,8,10, 6,17,11,9,16, 15,10,8,14,5, 18,9,11,19,7, 1,17,6,4,13, 5,7,19,3,15, 13,10,15,3,1, 19,11,17,1,3};
  double icosav[]={
0,-1,-g, 0,-1,g, 0,1,-g, 0,1,g, -1,-g,0, -1,g,0, 1,-g,0, 1,g,0, -g,0,-1, g,0,-1, -g,0,1, g,0,1};
  int icosat[]={
0,2,8, 2,0,9, 4,0,8, 4,6,0, 6,9,0, 5,8,2, 5,2,7, 7,2,9, 10,4,8, 10,8,5, 6,11,9, 9,11,7, 10,5,3, 10,1,4, 1,11,6, 3,7,11, 1,6,4, 3,5,7, 3,11,1, 1,10,3};
  double icosidodecav[]={
-j,0,0, j,0,0, 0,-j,0, 0,j,0, 0,0,-j, 0,0,j,
-1,-g,-q, -1,-g,q, -1,g,-q, -1,g,q, 1,-g,-q, 1,-g,q, 1,g,-q, 1,g,q,
-g,-q,-1, -g,q,-1, g,-q,-1, g,q,-1, -g,-q,1, -g,q,1, g,-q,1, g,q,1,
-q,-1,-g, q,-1,-g, -q,-1,g, q,-1,g, -q,1,-g, q,1,-g, -q,1,g, q,1,g
};
  int icosidodecat[]={
3,17,21,3, 3,27,23,1, 3,1,25,29, 3,21,29,13, 3,12,27,17, 3,10,16,23, 3,20,11,25, 3,9,13,5, 3,19,9,28, 3,26,8,15,
3,15,3,19, 3,7,5,11, 3,18,24,7, 3,2,14,18, 3,2,20,16, 3,4,6,10, 3,6,22,14, 3,8,4,12, 3,0,22,26, 3,0,28,24,
5,17,27,1,29,21, 5,1,23,16,20,25, 5,4,10,23,27,12, 5,5,13,29,25,11, 5,3,21,13,9,19, 5,8,12,17,3,15,
5,0,26,15,19,28, 5,24,28,9,5,7, 5,0,24,18,14,22, 5,2,18,7,11,20, 5,10,6,14,2,16, 5,8,26,22,6,4
};
  double cuboctav[]={
-1,-1,0, -1,1,0, 1,-1,0, 1,1,0,
0,-1,-1, 0,-1,1, 0,1,-1, 0,1,1,
-1,0,-1, 1,0,-1, -1,0,1, 1,0,1
};
  int cuboctat[]={
3,3,11,7, 3,9,3,6, 3,11,2,5, 3,4,2,9, 3,7,10,1, 3,1,8,6, 3,0,10,5, 3,4,8,0,
4,3,9,2,11, 4,11,5,10,7, 4,7,1,6,3, 4,10,0,8,1, 4,6,8,4,9, 4,4,0,5,2
};
  double truncicosav[]={
0,-1,-3*g, 0,-1,3*g, 0,1,-3*g, 0,1,3*g,
-3*g,0,-1, 3*g,0,-1, -3*g,0,1, 3*g,0,1,
-1,-3*g,0, -1,3*g,0, 1,-3*g,0, 1,3*g,0,

-2,-(g+q),-g, -2,-(g+q),g, -2,(g+q),-g, -2,(g+q),g, 2,-(g+q),-g, 2,-(g+q),g, 2,(g+q),-g, 2,(g+q),g,
-g,-2,-(g+q), g,-2,-(g+q), -g,-2,(g+q), g,-2,(g+q), -g,2,-(g+q), g,2,-(g+q), -g,2,(g+q), g,2,(g+q),
-(g+q),-g,-2, -(g+q),g,-2, (g+q),-g,-2, (g+q),g,-2, -(g+q),-g,2, -(g+q),g,2, (g+q),-g,2, (g+q),g,2,

-1,-(2+g),-2*g, -1,-(2+g),2*g, -1,(2+g),-2*g, -1,(2+g),2*g, 1,-(2+g),-2*g, 1,-(2+g),2*g, 1,(2+g),-2*g, 1,(2+g),2*g,
-2*g,-1,-(2+g), 2*g,-1,-(2+g), -2*g,-1,(2+g), 2*g,-1,(2+g), -2*g,1,-(2+g), 2*g,1,-(2+g), -2*g,1,(2+g), 2*g,1,(2+g),
-(2+g),-2*g,-1, -(2+g),2*g,-1, (2+g),-2*g,-1, (2+g),2*g,-1, -(2+g),-2*g,1, -(2+g),2*g,1, (2+g),-2*g,1, (2+g),2*g,1
};
  int truncicosat[]={
6,9,11,19,43,39,15, 6,55,31,5,7,35,59, 6,27,43,19,59,35,51, 6,11,9,14,38,42,18, 6,20,44,28,52,12,36,
6,0,2,24,48,44,20, 6,48,24,38,14,53,29, 6,0,21,45,49,25,2, 6,12,8,10,16,40,36, 6,18,42,25,49,31,55,
6,23,47,34,58,17,41, 6,1,3,27,51,47,23, 6,21,40,16,54,30,45, 6,7,5,30,54,58,34, 6,39,26,50,33,57,15,
6,3,1,22,46,50,26, 6,57,33,6,4,29,53, 6,6,32,56,52,28,4, 6,22,37,13,56,32,46, 6,37,41,17,10,8,13,
5,59,19,11,18,55, 5,35,7,34,47,51, 5,3,26,39,43,27, 5,44,48,29,4,28, 5,20,36,40,21,0, 5,38,24,2,25,42,
5,14,9,15,57,53, 5,10,17,58,54,16, 5,22,1,23,41,37, 5,49,45,30,5,31, 5,50,46,32,6,33, 5,13,8,12,52,56
};
  double trunctetrav[]={
3,1,1, 1,3,1, 1,1,3,  3,-1,-1, -1,3,-1, -1,-1,3,  -3,-1,1, 1,-3,-1, -1,1,-3,  -3,1,-1, -1,-3,1, 1,-1,-3
};
  int trunctetrat[]={
6,11,3,0,1,4,8, 6,3,7,10,5,2,0, 6,6,10,7,11,8,9, 6,9,4,1,2,5,6,
3,0,2,1, 3,8,4,9, 3,6,5,10, 3,7,3,11
};
  double trunchexav[]={
-(s-1),-1,-1, -(s-1),-1,1, -(s-1),1,-1, -(s-1),1,1, (s-1),-1,-1, (s-1),-1,1, (s-1),1,-1, (s-1),1,1,
-1,-(s-1),-1, 1,-(s-1),-1, -1,-(s-1),1, 1,-(s-1),1, -1,(s-1),-1, 1,(s-1),-1, -1,(s-1),1, 1,(s-1),1,
-1,-1,-(s-1), -1,1,-(s-1), 1,-1,-(s-1), 1,1,-(s-1), -1,-1,(s-1), -1,1,(s-1), 1,-1,(s-1), 1,1,(s-1)
};
  int trunchexat[]={
8,5,22,18,4,0,16,20,1, 8,21,14,10,20,16,8,12,17, 8,14,3,7,15,11,5,1,10, 8,6,19,23,7,3,21,17,2, 8,0,4,9,13,6,2,12,8, 8,13,9,18,22,11,15,23,19,
3,11,22,5, 3,18,9,4, 3,3,14,21, 3,2,17,12, 3,10,1,20, 3,7,23,15, 3,13,19,6, 3,0,8,16
};
  double truncoctav[]={
-2,-1,0, -2,1,0, 2,-1,0, 2,1,0,
0,-2,-1, 0,-2,1, 0,2,-1, 0,2,1,
-1,0,-2, 1,0,-2, -1,0,2, 1,0,2,
-1,-2,0, -1,2,0, 1,-2,0, 1,2,0,
0,-1,-2, 0,-1,2, 0,1,-2, 0,1,2,
-2,0,-1, 2,0,-1, -2,0,1, 2,0,1
};
  int truncoctat[]={
6,17,11,23,2,14,5, 6,14,2,21,9,16,4, 6,7,15,3,23,11,19, 6,0,12,4,16,8,20, 6,19,10,22,1,13,7, 6,17,5,12,0,22,10, 6,1,20,8,18,6,13, 6,6,18,9,21,3,15,
4,12,5,14,4, 4,2,23,3,21, 4,13,6,15,7, 4,8,16,9,18, 4,0,20,1,22, 4,11,17,10,19
};
  double truncdodecav[]={
(0),-(3-g),-(5*g), (0),-(3-g),(5*g), (0),(3-g),-(5*g), (0),(3-g),(5*g),
-(5*g),(0),-(3-g), (5*g),(0),-(3-g), -(5*g),(0),(3-g), (5*g),(0),(3-g),
-(3-g),-(5*g),(0), -(3-g),(5*g),(0), (3-g),-(5*g),(0), (3-g),(5*g),(0),

-(3-g),-(2+g),-(4+2*g), -(3-g),-(2+g),(4+2*g), -(3-g),(2+g),-(4+2*g), -(3-g),(2+g),(4+2*g), (3-g),-(2+g),-(4+2*g), (3-g),-(2+g),(4+2*g), (3-g),(2+g),-(4+2*g), (3-g),(2+g),(4+2*g),
-(4+2*g),-(3-g),-(2+g), (4+2*g),-(3-g),-(2+g), -(4+2*g),-(3-g),(2+g), (4+2*g),-(3-g),(2+g), -(4+2*g),(3-g),-(2+g), (4+2*g),(3-g),-(2+g), -(4+2*g),(3-g),(2+g), (4+2*g),(3-g),(2+g),
-(2+g),-(4+2*g),-(3-g), -(2+g),(4+2*g),-(3-g), (2+g),-(4+2*g),-(3-g), (2+g),(4+2*g),-(3-g), -(2+g),-(4+2*g),(3-g), -(2+g),(4+2*g),(3-g), (2+g),-(4+2*g),(3-g), (2+g),(4+2*g),(3-g),

-(2+g),-(-2+4*g),-(1+3*g), -(2+g),-(-2+4*g),(1+3*g), -(2+g),(-2+4*g),-(1+3*g), -(2+g),(-2+4*g),(1+3*g), (2+g),-(-2+4*g),-(1+3*g), (2+g),-(-2+4*g),(1+3*g), (2+g),(-2+4*g),-(1+3*g), (2+g),(-2+4*g),(1+3*g),
-(1+3*g),-(2+g),-(-2+4*g), (1+3*g),-(2+g),-(-2+4*g), -(1+3*g),-(2+g),(-2+4*g), (1+3*g),-(2+g),(-2+4*g), -(1+3*g),(2+g),-(-2+4*g), (1+3*g),(2+g),-(-2+4*g), -(1+3*g),(2+g),(-2+4*g), (1+3*g),(2+g),(-2+4*g),
-(-2+4*g),-(1+3*g),-(2+g), -(-2+4*g),(1+3*g),-(2+g), (-2+4*g),-(1+3*g),-(2+g), (-2+4*g),(1+3*g),-(2+g), -(-2+4*g),-(1+3*g),(2+g), -(-2+4*g),(1+3*g),(2+g), (-2+4*g),-(1+3*g),(2+g), (-2+4*g),(1+3*g),(2+g)
};
  int truncdodecat[]={
10,24,48,53,29,33,57,50,26,6,4, 10,53,38,14,18,42,55,31,11,9,29, 10,39,57,33,9,11,35,59,43,19,15, 10,40,45,21,25,49,42,18,2,0,16,
10,28,52,44,20,4,6,22,46,56,32, 10,5,7,27,51,59,35,31,55,49,25, 10,8,32,56,37,13,17,41,58,34,10, 10,17,1,3,19,43,51,27,23,47,41,
10,47,23,7,5,21,45,54,30,34,58, 10,37,46,22,26,50,39,15,3,1,13, 10,24,20,44,36,12,0,2,14,38,48, 10,36,52,28,8,10,30,54,40,16,12,
3,33,29,9, 3,50,57,39, 3,53,48,38, 3,11,31,35, 3,25,21,5, 3,42,49,55, 3,7,23,27, 3,40,54,45, 3,52,36,44, 3,8,28,32,
3,22,6,26, 3,20,24,4, 3,51,43,59, 3,56,46,37, 3,13,1,17, 3,41,47,58, 3,3,15,19, 3,14,2,18, 3,12,16,0, 3,10,34,30
};
  double rhombicuboctav[]={
-(1+s),-1,-1, -(1+s),-1,1, -(1+s),1,-1, -(1+s),1,1, (1+s),-1,-1, (1+s),-1,1, (1+s),1,-1, (1+s),1,1,
-1,-(1+s),-1, 1,-(1+s),-1, -1,-(1+s),1, 1,-(1+s),1, -1,(1+s),-1, 1,(1+s),-1, -1,(1+s),1, 1,(1+s),1,
-1,-1,-(1+s), -1,1,-(1+s), 1,-1,-(1+s), 1,1,-(1+s), -1,-1,(1+s), -1,1,(1+s), 1,-1,(1+s), 1,1,(1+s)
};
  int rhombicuboctat[]={
4,5,7,6,4, 4,5,22,23,7, 4,6,7,15,13, 4,4,6,19,18, 4,9,11,5,4, 4,21,20,1,3, 4,3,1,0,2, 4,2,12,14,3, 4,17,2,0,16,
4,0,1,10,8, 4,10,11,9,8, 4,8,9,18,16, 4,16,18,19,17, 4,11,10,20,22, 4,22,20,21,23, 4,23,21,14,15, 4,12,17,19,13, 4,13,15,14,12,
3,11,22,5, 3,7,23,15, 3,6,13,19, 3,9,4,18, 3,14,21,3, 3,16,0,8, 3,17,12,2, 3,1,20,10
};
  double snubhexa1v[]={
-1,-w,1/w, -1,w,-1/w, 1,-w,-1/w, 1,w,1/w,
1/w,-1,-w, -1/w,-1,w, -1/w,1,-w, 1/w,1,w,
-w,1/w,-1, w,-1/w,-1, -w,-1/w,1, w,1/w,1,

-1,-1/w,-w, -1,1/w,w, 1,-1/w,w, 1,1/w,-w,
-w,-1,-1/w, w,-1,1/w, w,1,-1/w, -w,1,1/w,
-1/w,-w,-1, 1/w,w,-1, -1/w,w,1, 1/w,-w,1
};
  int snubhexa1t[]={
4,9,12,10,14, 4,16,2,18,1, 4,3,17,0,19, 4,15,11,13,8, 4,22,5,20,6, 4,23,7,21,4,
3,12,5,10, 3,12,20,5, 3,5,0,10, 3,10,0,17, 3,22,0,5, 3,11,15,7, 3,19,11,3, 3,11,7,3,
3,9,14,4, 3,14,23,4, 3,10,17,14, 3,14,17,23, 3,15,21,7, 3,7,23,3, 3,20,12,16, 3,1,18,8,
3,23,17,3, 3,6,20,1, 3,12,9,16, 3,20,16,1, 3,9,2,16, 3,9,4,2, 3,4,21,2, 3,18,21,15,
3,18,15,8, 3,8,6,1, 3,6,8,13, 3,22,6,13, 3,11,19,13, 3,13,19,22, 3,22,19,0, 3,21,18,2
};
  double snubhexa2v[]={
1,-w,1/w, 1,w,-1/w, -1,-w,-1/w, -1,w,1/w,
-1/w,-1,-w, 1/w,-1,w, 1/w,1,-w, -1/w,1,w,
w,1/w,-1, -w,-1/w,-1, w,-1/w,1, -w,1/w,1,

1,-1/w,-w, 1,1/w,w, -1,-1/w,w, -1,1/w,-w,
w,-1,-1/w, -w,-1,1/w, -w,1,-1/w, w,1,1/w,
1/w,-w,-1, -1/w,w,-1, 1/w,w,1, -1/w,-w,1
};
  int snubhexa2t[]={
4,9,14,10,12, 4,18,2,16,1, 4,3,19,0,17, 4,15,8,13,11, 4,22,6,20,5, 4,23,4,21,7,
3,12,10,5, 3,12,5,20, 3,5,10,0, 3,10,17,0, 3,22,5,0, 3,11,7,15, 3,19,3,11, 3,11,3,7,
3,9,4,14, 3,14,4,23, 3,10,14,17, 3,14,23,17, 3,15,7,21, 3,7,3,23, 3,20,16,12, 3,1,8,18,
3,23,3,17, 3,6,1,20, 3,12,16,9, 3,20,1,16, 3,9,16,2, 3,9,2,4, 3,4,2,21, 3,18,15,21,
3,18,8,15, 3,8,1,6, 3,6,13,8, 3,22,13,6, 3,11,13,19, 3,13,22,19, 3,22,0,19, 3,21,2,18
};
  double rhombicosadodecav[]={
-1,-1,-g*q, -1,-1,g*q, -1,1,-g*q, -1,1,g*q, 1,-1,-g*q, 1,-1,g*q, 1,1,-g*q, 1,1,g*q,
-g*q,-1,-1, g*q,-1,-1, -g*q,-1,1, g*q,-1,1, -g*q,1,-1, g*q,1,-1, -g*q,1,1, g*q,1,1,
-1,-g*q,-1, -1,g*q,-1, 1,-g*q,-1, 1,g*q,-1, -1,-g*q,1, -1,g*q,1, 1,-g*q,1, 1,g*q,1,

-q,-g,-j, -q,-g,j, -q,g,-j, -q,g,j, q,-g,-j, q,-g,j, q,g,-j, q,g,j,
-j,-q,-g, j,-q,-g, -j,-q,g, j,-q,g, -j,q,-g, j,q,-g, -j,q,g, j,q,g,
-g,-j,-q, -g,j,-q, g,-j,-q, g,j,-q, -g,-j,q, -g,j,q, g,-j,q, g,j,q,

-(2+g),0,-q, -(2+g),0,q, (2+g),0,-q, (2+g),0,q,
-q,-(2+g),0, q,-(2+g),0, -q,(2+g),0, q,(2+g),0,
0,-q,-(2+g), 0,q,-(2+g), 0,-q,(2+g), 0,q,(2+g)
};
  int rhombicosadodecat[]={
5,44,58,46,22,20, 5,1,25,49,27,3, 5,57,43,19,17,41, 5,21,23,47,59,45, 5,31,51,29,5,7, 5,10,34,52,32,8,
5,48,24,0,2,26, 5,12,36,54,38,14, 5,6,4,28,50,30, 5,15,39,55,37,13, 5,33,53,35,11,9, 5,40,16,18,42,56,

4,34,44,20,52, 4,44,25,1,58, 4,3,27,45,59, 4,5,1,3,7, 4,25,34,10,49, 4,27,49,14,38,
4,20,22,18,16, 4,18,53,33,42, 4,6,30,43,57, 4,2,57,41,26, 4,4,6,2,0, 4,47,31,7,59,
4,55,39,47,23, 4,5,29,46,58, 4,31,39,15,51, 4,52,16,40,32, 4,12,48,26,36, 4,36,41,17,54,
4,38,54,21,45, 4,21,17,19,23, 4,55,19,43,37, 4,30,50,13,37, 4,33,9,50,28, 4,14,10,8,12,
4,9,11,15,13, 4,11,35,29,51, 4,53,22,46,35, 4,56,42,28,4, 4,24,40,56,0, 4,48,8,32,24,

3,34,25,44, 3,58,1,5, 3,27,38,45, 3,52,20,16, 3,22,53,18, 3,2,6,57, 3,3,59,7, 3,19,55,23, 3,47,39,31, 3,29,35,46,
3,14,49,10, 3,41,36,26, 3,54,17,21, 3,37,43,30, 3,0,56,4, 3,9,13,50, 3,33,28,42, 3,12,8,48, 3,11,51,15, 3,24,32,40
};
  double trunccuboctav[]={
-1,-(1+s),-(1+s+s), -1,-(1+s),(1+s+s), -1,(1+s),-(1+s+s), -1,(1+s),(1+s+s), 1,-(1+s),-(1+s+s), 1,-(1+s),(1+s+s), 1,(1+s),-(1+s+s), 1,(1+s),(1+s+s),
-(1+s+s),-1,-(1+s), (1+s+s),-1,-(1+s), -(1+s+s),-1,(1+s), (1+s+s),-1,(1+s), -(1+s+s),1,-(1+s), (1+s+s),1,-(1+s), -(1+s+s),1,(1+s), (1+s+s),1,(1+s),
-(1+s),-(1+s+s),-1, -(1+s),(1+s+s),-1, (1+s),-(1+s+s),-1, (1+s),(1+s+s),-1, -(1+s),-(1+s+s),1, -(1+s),(1+s+s),1, (1+s),-(1+s+s),1, (1+s),(1+s+s),1,

-1,-(1+s+s),-(1+s), -1,-(1+s+s),(1+s), -1,(1+s+s),-(1+s), -1,(1+s+s),(1+s), 1,-(1+s+s),-(1+s), 1,-(1+s+s),(1+s), 1,(1+s+s),-(1+s), 1,(1+s+s),(1+s),
-(1+s),-1,-(1+s+s), (1+s),-1,-(1+s+s), -(1+s),-1,(1+s+s), (1+s),-1,(1+s+s), -(1+s),1,-(1+s+s), (1+s),1,-(1+s+s), -(1+s),1,(1+s+s), (1+s),1,(1+s+s),
-(1+s+s),-(1+s),-1, -(1+s+s),(1+s),-1, (1+s+s),-(1+s),-1, (1+s+s),(1+s),-1, -(1+s+s),-(1+s),1, -(1+s+s),(1+s),1, (1+s+s),-(1+s),1, (1+s+s),(1+s),1
};
  int trunccuboctat[]={
8,5,1,34,38,3,7,39,35, 8,12,41,45,14,10,44,40,8, 8,37,6,2,36,32,0,4,33,
8,23,31,27,21,17,26,30,19, 8,24,16,20,25,29,22,18,28, 8,43,13,9,42,46,11,15,47,

6,3,38,14,45,21,27, 6,1,25,20,44,10,34, 6,11,46,22,29,5,35, 6,15,39,7,31,23,47,
6,2,26,17,41,12,36, 6,37,13,43,19,30,6, 6,8,40,16,24,0,32, 6,9,33,4,28,18,42,

4,7,3,27,31, 4,38,34,10,14, 4,5,29,25,1, 4,39,15,11,35, 4,36,12,8,32, 4,6,30,26,2,
4,47,23,19,43, 4,40,44,20,16, 4,0,24,28,4, 4,9,13,37,33, 4,41,17,21,45, 4,46,42,18,22
};
  double truncicosidodecav[]={
-d,-d,-(3+g), -d,-d,(3+g), -d,d,-(3+g), -d,d,(3+g), d,-d,-(3+g), d,-d,(3+g), d,d,-(3+g), d,d,(3+g),
-(3+g),-d,-d, -(3+g),-d,d, -(3+g),d,-d, -(3+g),d,d, (3+g),-d,-d, (3+g),-d,d, (3+g),d,-d, (3+g),d,d,
-d,-(3+g),-d, -d,-(3+g),d, -d,(3+g),-d, -d,(3+g),d, d,-(3+g),-d, d,-(3+g),d, d,(3+g),-d, d,(3+g),d,

-2*d,-g,-(g+q), -2*d,-g,(g+q), -2*d,g,-(g+q), -2*d,g,(g+q), 2*d,-g,-(g+q), 2*d,-g,(g+q), 2*d,g,-(g+q), 2*d,g,(g+q),
-(g+q),-2*d,-g, -(g+q),-2*d,g, -(g+q),2*d,-g, -(g+q),2*d,g, (g+q),-2*d,-g, (g+q),-2*d,g, (g+q),2*d,-g, (g+q),2*d,g,
-g,-(g+q),-2*d, -g,-(g+q),2*d, -g,(g+q),-2*d, -g,(g+q),2*d, g,-(g+q),-2*d, g,-(g+q),2*d, g,(g+q),-2*d, g,(g+q),2*d,

-d,-q,-(j+d), -d,-q,(j+d), -d,q,-(j+d), -d,q,(j+d), d,-q,-(j+d), d,-q,(j+d), d,q,-(j+d), d,q,(j+d),
-(j+d),-d,-q, -(j+d),-d,q, -(j+d),d,-q, -(j+d),d,q, (j+d),-d,-q, (j+d),-d,q, (j+d),d,-q, (j+d),d,q,
-q,-(j+d),-d, -q,-(j+d),d, -q,(j+d),-d, -q,(j+d),d, q,-(j+d),-d, q,-(j+d),d, q,(j+d),-d, q,(j+d),d,

-(j-1),-2,-(2+g), -(j-1),-2,(2+g), -(j-1),2,-(2+g), -(j-1),2,(2+g), (j-1),-2,-(2+g), (j-1),-2,(2+g), (j-1),2,-(2+g), (j-1),2,(2+g),
-(2+g),-(j-1),-2, -(2+g),-(j-1),2, -(2+g),(j-1),-2, -(2+g),(j-1),2, (2+g),-(j-1),-2, (2+g),-(j-1),2, (2+g),(j-1),-2, (2+g),(j-1),2,
-2,-(2+g),-(j-1), -2,-(2+g),(j-1), -2,(2+g),-(j-1), -2,(2+g),(j-1), 2,-(2+g),-(j-1), 2,-(2+g),(j-1), 2,(2+g),-(j-1), 2,(2+g),(j-1),

-g,-3,-j, -g,-3,j, -g,3,-j, -g,3,j, g,-3,-j, g,-3,j, g,3,-j, g,3,j,
-j,-g,-3, -j,-g,3, -j,g,-3, -j,g,3, j,-g,-3, j,-g,3, j,g,-3, j,g,3,
-3,-j,-g, -3,-j,g, -3,j,-g, -3,j,g, 3,-j,-g, 3,-j,g, 3,j,-g, 3,j,g
};
  int truncicosidodecat[]={
10,44,92,100,52,48,96,88,40,16,20, 10,68,69,117,85,37,13,12,36,84,116, 10,8,9,33,81,113,65,64,112,80,32,
10,21,17,41,89,97,49,53,101,93,45, 10,10,34,82,114,66,67,115,83,35,11, 10,77,29,5,7,31,79,111,63,61,109,
10,90,98,50,54,102,94,46,22,18,42, 10,51,99,91,43,19,23,47,95,103,55, 10,119,71,70,118,86,38,14,15,39,87,
10,74,106,58,56,104,72,24,0,2,26, 10,57,59,107,75,27,3,1,25,73,105, 10,76,108,60,62,110,78,30,6,4,28,

6,44,20,21,45,69,68, 6,63,39,15,13,37,61, 6,12,14,38,62,60,36, 6,80,112,88,96,72,104, 6,16,40,64,65,41,17,
6,34,10,8,32,56,58, 6,9,11,35,59,57,33, 6,114,82,106,74,98,90, 6,101,77,109,85,117,93, 6,116,84,108,76,100,92,
6,75,107,83,115,91,99, 6,7,3,27,51,55,31, 6,43,67,66,42,18,19, 6,23,22,46,70,71,47, 6,103,95,119,87,111,79,
6,118,94,102,78,110,86, 6,50,26,2,6,30,54, 6,0,24,48,52,28,4, 6,1,5,29,53,49,25, 6,113,81,105,73,97,89,

4,20,16,17,21, 4,92,44,68,116, 4,109,61,37,85, 4,69,45,93,117, 4,41,65,113,89, 4,56,32,80,104,
4,10,11,9,8, 4,82,34,58,106, 4,101,53,29,77, 4,42,66,114,90, 4,40,88,112,64, 4,27,75,99,51,
4,107,59,35,83, 4,91,115,67,43, 4,55,103,79,31, 4,47,71,119,95, 4,19,18,22,23, 4,46,94,118,70,
4,14,12,13,15, 4,87,39,63,111, 4,60,108,84,36, 4,110,62,38,86, 4,98,74,26,50, 4,2,0,4,6,
4,1,3,7,5, 4,73,25,49,97, 4,96,48,24,72, 4,100,76,28,52, 4,81,33,57,105, 4,102,54,30,78
};
  double snubdodeca1v[]={
-2*aa,-2,2*bb, -2*aa,2,-2*bb, 2*aa,-2,-2*bb, 2*aa,2,2*bb,
2*bb,-2*aa,-2, -2*bb,-2*aa,2, -2*bb,2*aa,-2, 2*bb,2*aa,2,
-2,2*bb,-2*aa, 2,-2*bb,-2*aa, -2,-2*bb,2*aa, 2,2*bb,2*aa,

-(aa+bb*d+g),-(-aa*g+bb+d),(aa*d+bb*g-1), -(aa+bb*d+g),(-aa*g+bb+d),-(aa*d+bb*g-1), (aa+bb*d+g),-(-aa*g+bb+d),-(aa*d+bb*g-1), (aa+bb*d+g),(-aa*g+bb+d),(aa*d+bb*g-1),
(aa*d+bb*g-1),-(aa+bb*d+g),-(-aa*g+bb+d), -(aa*d+bb*g-1),-(aa+bb*d+g),(-aa*g+bb+d), -(aa*d+bb*g-1),(aa+bb*d+g),-(-aa*g+bb+d), (aa*d+bb*g-1),(aa+bb*d+g),(-aa*g+bb+d),
-(-aa*g+bb+d),(aa*d+bb*g-1),-(aa+bb*d+g), (-aa*g+bb+d),-(aa*d+bb*g-1),-(aa+bb*d+g), -(-aa*g+bb+d),-(aa*d+bb*g-1),(aa+bb*d+g), (-aa*g+bb+d),(aa*d+bb*g-1),(aa+bb*d+g),

-(-aa*d+bb*g+1),-(-aa+bb*d-g),(aa*g+bb-d), -(-aa*d+bb*g+1),(-aa+bb*d-g),-(aa*g+bb-d), (-aa*d+bb*g+1),-(-aa+bb*d-g),-(aa*g+bb-d), (-aa*d+bb*g+1),(-aa+bb*d-g),(aa*g+bb-d),
(aa*g+bb-d),-(-aa*d+bb*g+1),-(-aa+bb*d-g), -(aa*g+bb-d),-(-aa*d+bb*g+1),(-aa+bb*d-g), -(aa*g+bb-d),(-aa*d+bb*g+1),-(-aa+bb*d-g), (aa*g+bb-d),(-aa*d+bb*g+1),(-aa+bb*d-g),
-(-aa+bb*d-g),(aa*g+bb-d),-(-aa*d+bb*g+1), (-aa+bb*d-g),-(aa*g+bb-d),-(-aa*d+bb*g+1), -(-aa+bb*d-g),-(aa*g+bb-d),(-aa*d+bb*g+1), (-aa+bb*d-g),(aa*g+bb-d),(-aa*d+bb*g+1),

-(-aa*d+bb*g-1),-(aa-bb*d-g),(aa*g+bb+d), -(-aa*d+bb*g-1),(aa-bb*d-g),-(aa*g+bb+d), (-aa*d+bb*g-1),-(aa-bb*d-g),-(aa*g+bb+d), (-aa*d+bb*g-1),(aa-bb*d-g),(aa*g+bb+d),
(aa*g+bb+d),-(-aa*d+bb*g-1),-(aa-bb*d-g), -(aa*g+bb+d),-(-aa*d+bb*g-1),(aa-bb*d-g), -(aa*g+bb+d),(-aa*d+bb*g-1),-(aa-bb*d-g), (aa*g+bb+d),(-aa*d+bb*g-1),(aa-bb*d-g),
-(aa-bb*d-g),(aa*g+bb+d),-(-aa*d+bb*g-1), (aa-bb*d-g),-(aa*g+bb+d),-(-aa*d+bb*g-1), -(aa-bb*d-g),-(aa*g+bb+d),(-aa*d+bb*g-1), (aa-bb*d-g),(aa*g+bb+d),(-aa*d+bb*g-1),

-(aa+bb*d-g),-(aa*g-bb+d),(aa*d+bb*g+1), -(aa+bb*d-g),(aa*g-bb+d),-(aa*d+bb*g+1), (aa+bb*d-g),-(aa*g-bb+d),-(aa*d+bb*g+1), (aa+bb*d-g),(aa*g-bb+d),(aa*d+bb*g+1),
(aa*d+bb*g+1),-(aa+bb*d-g),-(aa*g-bb+d), -(aa*d+bb*g+1),-(aa+bb*d-g),(aa*g-bb+d), -(aa*d+bb*g+1),(aa+bb*d-g),-(aa*g-bb+d), (aa*d+bb*g+1),(aa+bb*d-g),(aa*g-bb+d),
-(aa*g-bb+d),(aa*d+bb*g+1),-(aa+bb*d-g), (aa*g-bb+d),-(aa*d+bb*g+1),-(aa+bb*d-g), -(aa*g-bb+d),-(aa*d+bb*g+1),(aa+bb*d-g), (aa*g-bb+d),(aa*d+bb*g+1),(aa+bb*d-g),
};
  int snubdodeca1t[]={
5,7,19,31,43,55, 5,15,27,39,51,3, 5,52,4,16,28,40, 5,46,58,10,22,34, 5,9,21,33,45,57, 5,5,17,29,41,53,
5,2,14,26,38,50, 5,6,18,30,42,54, 5,47,59,11,23,35, 5,8,20,32,44,56, 5,12,24,36,48,0, 5,1,13,25,37,49,

3,7,27,19, 3,19,27,15, 3,7,52,27, 3,52,39,27, 3,4,52,7,     3,31,19,23, 3,40,39,52, 3,58,46,40, 3,58,40,28, 3,9,58,28,
3,9,28,21, 3,21,28,16, 3,21,16,14, 3,14,16,26, 3,26,16,4,   3,46,39,40, 3,51,39,46, 3,34,51,46, 3,51,0,3, 3,58,9,10,
3,12,34,22, 3,12,22,17, 3,24,12,17, 3,5,24,17, 3,54,24,5,   3,6,54,5, 3,17,22,29, 3,22,10,29, 3,33,21,14, 3,2,33,14,
3,49,33,2, 3,1,2,50, 3,1,50,32, 3,5,53,6, 3,24,54,36,       3,36,54,42, 3,36,42,47, 3,47,42,59, 3,42,30,59, 3,59,30,8,
3,8,30,20, 3,20,30,18, 3,20,18,13, 3,13,18,25, 3,32,13,1,   3,2,1,49, 3,44,32,50, 3,4,7,55, 3,26,4,55, 3,38,26,55,
3,38,55,43, 3,38,44,50, 3,32,20,13, 3,38,43,44, 3,44,43,56, 3,56,43,31, 3,8,11,59, 3,11,8,56, 3,11,56,31, 3,11,31,23,
3,23,19,15, 3,23,15,35, 3,35,15,3, 3,35,3,48, 3,48,3,0,     3,47,35,48, 3,47,48,36, 3,0,34,12, 3,0,51,34, 3,10,9,57,
3,10,57,29, 3,29,57,41, 3,41,57,45, 3,41,37,53, 3,49,45,33, 3,45,37,41, 3,37,25,53, 3,25,18,6, 3,25,6,53, 3,49,37,45
};
  double snubdodeca2v[]={
2*aa,-2,2*bb, 2*aa,2,-2*bb, -2*aa,-2,-2*bb, -2*aa,2,2*bb,
-2*bb,-2*aa,-2, 2*bb,-2*aa,2, 2*bb,2*aa,-2, -2*bb,2*aa,2,
2,2*bb,-2*aa, -2,-2*bb,-2*aa, 2,-2*bb,2*aa, -2,2*bb,2*aa,

(aa+bb*d+g),-(-aa*g+bb+d),(aa*d+bb*g-1), (aa+bb*d+g),(-aa*g+bb+d),-(aa*d+bb*g-1), -(aa+bb*d+g),-(-aa*g+bb+d),-(aa*d+bb*g-1), -(aa+bb*d+g),(-aa*g+bb+d),(aa*d+bb*g-1),
-(aa*d+bb*g-1),-(aa+bb*d+g),-(-aa*g+bb+d), (aa*d+bb*g-1),-(aa+bb*d+g),(-aa*g+bb+d), (aa*d+bb*g-1),(aa+bb*d+g),-(-aa*g+bb+d), -(aa*d+bb*g-1),(aa+bb*d+g),(-aa*g+bb+d),
(-aa*g+bb+d),(aa*d+bb*g-1),-(aa+bb*d+g), -(-aa*g+bb+d),-(aa*d+bb*g-1),-(aa+bb*d+g), (-aa*g+bb+d),-(aa*d+bb*g-1),(aa+bb*d+g), -(-aa*g+bb+d),(aa*d+bb*g-1),(aa+bb*d+g),

(-aa*d+bb*g+1),-(-aa+bb*d-g),(aa*g+bb-d), (-aa*d+bb*g+1),(-aa+bb*d-g),-(aa*g+bb-d), -(-aa*d+bb*g+1),-(-aa+bb*d-g),-(aa*g+bb-d), -(-aa*d+bb*g+1),(-aa+bb*d-g),(aa*g+bb-d),
-(aa*g+bb-d),-(-aa*d+bb*g+1),-(-aa+bb*d-g), (aa*g+bb-d),-(-aa*d+bb*g+1),(-aa+bb*d-g), (aa*g+bb-d),(-aa*d+bb*g+1),-(-aa+bb*d-g), -(aa*g+bb-d),(-aa*d+bb*g+1),(-aa+bb*d-g),
(-aa+bb*d-g),(aa*g+bb-d),-(-aa*d+bb*g+1), -(-aa+bb*d-g),-(aa*g+bb-d),-(-aa*d+bb*g+1), (-aa+bb*d-g),-(aa*g+bb-d),(-aa*d+bb*g+1), -(-aa+bb*d-g),(aa*g+bb-d),(-aa*d+bb*g+1),

(-aa*d+bb*g-1),-(aa-bb*d-g),(aa*g+bb+d), (-aa*d+bb*g-1),(aa-bb*d-g),-(aa*g+bb+d), -(-aa*d+bb*g-1),-(aa-bb*d-g),-(aa*g+bb+d), -(-aa*d+bb*g-1),(aa-bb*d-g),(aa*g+bb+d),
-(aa*g+bb+d),-(-aa*d+bb*g-1),-(aa-bb*d-g), (aa*g+bb+d),-(-aa*d+bb*g-1),(aa-bb*d-g), (aa*g+bb+d),(-aa*d+bb*g-1),-(aa-bb*d-g), -(aa*g+bb+d),(-aa*d+bb*g-1),(aa-bb*d-g),
(aa-bb*d-g),(aa*g+bb+d),-(-aa*d+bb*g-1), -(aa-bb*d-g),-(aa*g+bb+d),-(-aa*d+bb*g-1), (aa-bb*d-g),-(aa*g+bb+d),(-aa*d+bb*g-1), -(aa-bb*d-g),(aa*g+bb+d),(-aa*d+bb*g-1),

(aa+bb*d-g),-(aa*g-bb+d),(aa*d+bb*g+1), (aa+bb*d-g),(aa*g-bb+d),-(aa*d+bb*g+1), -(aa+bb*d-g),-(aa*g-bb+d),-(aa*d+bb*g+1), -(aa+bb*d-g),(aa*g-bb+d),(aa*d+bb*g+1),
-(aa*d+bb*g+1),-(aa+bb*d-g),-(aa*g-bb+d), (aa*d+bb*g+1),-(aa+bb*d-g),(aa*g-bb+d), (aa*d+bb*g+1),(aa+bb*d-g),-(aa*g-bb+d), -(aa*d+bb*g+1),(aa+bb*d-g),(aa*g-bb+d),
(aa*g-bb+d),(aa*d+bb*g+1),-(aa+bb*d-g), -(aa*g-bb+d),-(aa*d+bb*g+1),-(aa+bb*d-g), (aa*g-bb+d),-(aa*d+bb*g+1),(aa+bb*d-g), -(aa*g-bb+d),(aa*d+bb*g+1),(aa+bb*d-g),
};
  int snubdodeca2t[]={
5,7,55,43,31,19, 5,15,3,51,39,27, 5,52,40,28,16,4, 5,46,34,22,10,58, 5,9,57,45,33,21, 5,5,53,41,29,17,
5,2,50,38,26,14, 5,6,54,42,30,18, 5,47,35,23,11,59, 5,8,56,44,32,20, 5,12,0,48,36,24, 5,1,49,37,25,13,

3,7,19,27, 3,19,15,27, 3,7,27,52, 3,52,27,39, 3,4,7,52,     3,31,23,19, 3,40,52,39, 3,58,40,46, 3,58,28,40, 3,9,28,58,
3,9,21,28, 3,21,16,28, 3,21,14,16, 3,14,26,16, 3,26,4,16,   3,46,40,39, 3,51,46,39, 3,34,46,51, 3,51,3,0, 3,58,10,9,
3,12,22,34, 3,12,17,22, 3,24,17,12, 3,5,17,24, 3,54,5,24,   3,6,5,54, 3,17,29,22, 3,22,29,10, 3,33,14,21, 3,2,14,33,
3,49,2,33, 3,1,50,2, 3,1,32,50, 3,5,6,53, 3,24,36,54,       3,36,42,54, 3,36,47,42, 3,47,59,42, 3,42,59,30, 3,59,8,30,
3,8,20,30, 3,20,18,30, 3,20,13,18, 3,13,25,18, 3,32,1,13,   3,2,49,1, 3,44,50,32, 3,4,55,7, 3,26,55,4, 3,38,55,26,
3,38,43,55, 3,38,50,44, 3,32,13,20, 3,38,44,43, 3,44,56,43, 3,56,31,43, 3,8,59,11, 3,11,56,8, 3,11,31,56, 3,11,23,31,
3,23,15,19, 3,23,35,15, 3,35,3,15, 3,35,48,3, 3,48,0,3,     3,47,48,35, 3,47,36,48, 3,0,12,34, 3,0,34,51, 3,10,57,9,
3,10,29,57, 3,29,41,57, 3,41,45,57, 3,41,53,37, 3,49,33,45, 3,45,41,37, 3,37,53,25, 3,25,6,18, 3,25,53,6, 3,49,45,37
};


/*-!,-@,#, -!,@,-#, !,-@,-#, !,@,#,
#,-!,-@, -#,-!,@, -#,!,-@, #,!,@,
-@,#,-!, @,-#,-!, -@,-#,!, @,#,!,

!,-@,#, !,@,-#, -!,-@,-#, -!,@,#,
-#,-!,-@, #,-!,@, #,!,-@, -#,!,@,
@,#,-!, -@,-#,-!, @,-#,!, -@,#,!,*/


boolean DEBUG=/*/true;/*/false;/**/

  public void paint(Graphics g) {
    g.setColor(new Color(0xffffff));
    g.fillRect(0, 0, 200, 200);
    double n=Math.random();
 /*   if(n<.2) drawfig(g, tetrav, tetrat, 3);
    else if(n<.4) drawfig(g, hexav, hexat, 4);
    else if(n<.6) drawfig(g, octav, octat, 3);
    else if(n<.8) drawfig(g, dodecav, dodecat, 5);
    else drawfig(g, icosav, icosat, 3);
    */
    //drawfig(g, tetrav, tetrat, 3);
    //drawfig(g, hexav, hexat, 4);
    //drawfig(g, octav, octat, 3);
    //drawfig(g, dodecav, dodecat, 5);
    //drawfig(g, icosav, icosat, 3);
    //drawfig(g, icosidodecav, icosidodecat, -1);
    //drawfig(g, cuboctav, cuboctat, -1);
    //drawfig(g, truncicosav, truncicosat, -1);
    //drawfig(g, trunctetrav, trunctetrat, -1);
    //drawfig(g, trunchexav, trunchexat, -1);
    //drawfig(g, truncoctav, truncoctat, -1);
    //drawfig(g, truncdodecav, truncdodecat, -1);
    //drawfig(g, rhombicuboctav, rhombicuboctat, -1);
    //drawfig(g, snubhexa1v, snubhexa1t, -1);
    //drawfig(g, snubhexa2v, snubhexa2t, -1);
    //drawfig(g, rhombicosadodecav, rhombicosadodecat, -1);
    //drawfig(g, trunccuboctav, trunccuboctat, -1);
    //drawfig(g, truncicosidodecav, truncicosidodecat, -1);
    //drawfig(g, snubdodeca1v, snubdodeca1t, -1);
    drawfig(g, snubdodeca2v, snubdodeca2t, -1);
  }
  void drawfig(Graphics g, double vs[], int ts[], int m) {
    int z=m, y=m; if(m==-1) m=1;
    double tr[]=randmat();
    for(int back=(DEBUG?1:-1);back<=1;back+=2) for(int t=0;t*m<ts.length;++t) {
      if(z==-1) { y=(int)ts[t]; ++t; }
      double f, td[];
      double a1=vs[ts[t*m  ]*3], a2=vs[ts[t*m  ]*3+1], a3=vs[ts[t*m  ]*3+2];
      f=1/Math.sqrt(a1*a1+a2*a2+a3*a3); a1*=f; a2*=f; a3*=f; td=trans(a1, a2, a3, tr); a1=td[0]; a2=td[1]; a3=td[2];
      double b1=vs[ts[t*m+1]*3], b2=vs[ts[t*m+1]*3+1], b3=vs[ts[t*m+1]*3+2];
      f=1/Math.sqrt(b1*b1+b2*b2+b3*b3); b1*=f; b2*=f; b3*=f; td=trans(b1, b2, b3, tr); b1=td[0]; b2=td[1]; b3=td[2];
      double c1=vs[ts[t*m+2]*3], c2=vs[ts[t*m+2]*3+1], c3=vs[ts[t*m+2]*3+2];
      f=1/Math.sqrt(c1*c1+c2*c2+c3*c3); c1*=f; c2*=f; c3*=f; td=trans(c1, c2, c3, tr); c1=td[0]; c2=td[1]; c3=td[2];
      double d1=b1-a1, d2=b2-a2, d3=b3-a3;
      double e1=c1-a1, e2=c2-a2, e3=c3-a3;
      double f1=e2*d3-d2*e3, f2=e3*d1-d3*e1, f3=e1*d2-d1*e2;
      double da1=a1/(4+a3), da2=a2/(4+a3),
             db1=b1/(4+b3)-da1, db2=b2/(4+b3)-da2,
             dc1=c1/(4+c3)-da1, dc2=c2/(4+c3)-da2;
      if(back*(db1*dc2-dc1*db2)/*f3*/>0) {
        g.setColor(new Color((float)Math.random(), (float)Math.random(), (float)Math.random(), (float)(/*.85+.15*/ .75+.25*Math.random())/*(float)(back<0?.90:0.90)*/));
        int xa[]=new int[y], ya[]=new int[y];
        xa[0]=(int)(a1*3/(4+a3)*100+100); xa[1]=(int)(b1*3/(4+b3)*100+100); xa[2]=(int)(c1*3/(4+c3)*100+100);
        ya[0]=(int)(a2*3/(4+a3)*100+100); ya[1]=(int)(b2*3/(4+b3)*100+100); ya[2]=(int)(c2*3/(4+c3)*100+100);
        for(int w=0/*3*/;w<y;++w) {
          a1=vs[ts[t*m+w]*3]; a2=vs[ts[t*m+w]*3+1]; a3=vs[ts[t*m+w]*3+2];
          f=1/Math.sqrt(a1*a1+a2*a2+a3*a3); a1*=f; a2*=f; a3*=f; td=trans(a1, a2, a3, tr); a1=td[0]; a2=td[1]; a3=td[2];
          xa[w]=(int)(a1*3/(4+a3)*100+100); ya[w]=(int)(a2*3/(4+a3)*100+100);
        }
        g.fillPolygon(xa, ya, y);
        
      }if(z==-1) t+=y-1;
    }if(!DEBUG)return;
    g.setColor(new Color(0, 0, 0)); //g.drawString("Hello", 10, 10);
    for(int num=0;num<vs.length/3;++num) {
      double a1=vs[num*3], a2=vs[num*3+1], a3=vs[num*3+2];
      double f, td[];
      f=1/Math.sqrt(a1*a1+a2*a2+a3*a3); a1*=f; a2*=f; a3*=f; td=trans(a1, a2, a3, tr); a1=td[0]; a2=td[1]; a3=td[2];
      //double da1=a1/(4+a3), da2=a2/(4+a3);
      if(a3<0){//1* db1*dc2-dc1*db2 /*f3*/<0) {
        /*a3=0;*/ g.drawString(""+num, (int)(a1*3/(4+a3)*100+100), (int)(a2*3/(4+a3)*100+100));
        g.fillRect((int)(a1*3/(4+a3)*100+100)-1, (int)(a2*3/(4+a3)*100+100)-1, 3, 3);
      }
    }
  }
  double[] randmat() {
    double[] r=new double[9];
    double s, x, y, z;
    int i, j;
    for(i=0;i<3;++i) {
      x=Math.random()*2-1;
      y=Math.random()*2-1;
      z=Math.random()*2-1;
      s=x*x+y*y+z*z;
      if(s>1) { --i; continue; }
      for(j=0;j<i;++j) {
        s=x*r[j*3  ]
         +y*r[j*3+1]
         +z*r[j*3+2];
        x-=s*r[j*3  ];
        y-=s*r[j*3+1];
        z-=s*r[j*3+2];
      }
      s=x*x+y*y+z*z;
      if(s==0) { --i; continue; }
      s=Math.sqrt(s);
      x/=s; y/=s; z/=s;
      r[i*3  ]=x;
      r[i*3+1]=y;
      r[i*3+2]=z;
    }
    if(r[0]*r[4]*r[8]+r[1]*r[5]*r[6]+r[2]*r[3]*r[7]-r[0]*r[5]*r[7]-r[1]*r[3]*r[8]-r[2]*r[4]*r[6]<0) {
      r[0]=-r[0];
      r[1]=-r[1];
      r[2]=-r[2];
    }
    return(r);
  }
  double[] trans(double x, double y, double z, double[] t) {
    return(new double[]{x*t[0]+y*t[1]+z*t[2],
                        x*t[3]+y*t[4]+z*t[5],
                        x*t[6]+y*t[7]+z*t[8]});
  }
}

Graph.html

[edit]

If I use this again, I'll probably convert it to c, first. Probably easier than trying to remember how to compile java, anyway.

<html><head><title>Graph</title><body bgcolor=#fe07f2> <applet width=201 height=201 code="Graph.class" codebase="."></applet> </html>

Graph.java

[edit]
import java.awt.*;
import java.applet.*;
public class Graph extends Applet {
  double minx=-10, miny=-10, maxx=10, maxy=10, stex=1, stey=1;
  double addx, addy, scax, scay, delx, dely;
  int sx, sy;
  float cr, cg, cb;
  float gr[];
  void drawfunction(function fx, function fy, double st, double en) {
    double x, y, dx, dy, tx, ty, a, s;
    for(a=st;a<=en;) {
      drawdot(xinpd(tx=fx.y(a)), yinpd(ty=fy.y(a)));
      x=fx.dydx(a)*scax; y=fy.dydx(a)*scay;
      s=Math.sqrt(x*x+y*y);
      do { dx=tx-fx.y(a+.1/s); dy=ty-fy.y(a+.1/s); if(dx*dx*scax*scax+dy*dy*scay*scay<.127201965) break; s*=2; } while(true);
      a+=.1/s;
    }
  }
  void drawfunction(function f) {
    double x, y, s;
    for(x=minx;x<maxx;) {
      drawdot(xinpd(x), yinpd(y=f.y(x)));
      s=f.dydx(x)*scay/scax; s=Math.sqrt(1+s*s); if(y>maxy-dely*1||y<miny+dely*1||y!=y||s!=s) s=1; //if(s>1000) s=1000;
      x+=.1/scax/s;
    }
  }
  void drawgrid() {
    double z;
    for(z= stey;z<=maxy;z+=stey) drawhorz(yinp(z));
    for(z=-stey;z>=miny;z-=stey) drawhorz(yinp(z));
    for(z= stex;z<=maxx;z+=stex) drawvert(xinp(z));
    for(z=-stex;z>=minx;z-=stex) drawvert(xinp(z));
  }
  void drawaxes() {
    drawhorz(yinp(0));
    drawvert(xinp(0));
  }
  void drawhorz(int y) {
    int x;
    for(x=0;x<sx;++x) {
      subp(x, y-1, cr/2, cg/2, cb/2);
      subp(x, y  , cr  , cg  , cb  );
      subp(x, y+1, cr/2, cg/2, cb/2);
    }
  }
  void drawvert(int x) {
    int y;
    for(y=0;y<sy;++y) {
      subp(x-1, y, cr/2, cg/2, cb/2);
      subp(x  , y, cr  , cg  , cb  );
      subp(x+1, y, cr/2, cg/2, cb/2);
    }
  }
  void drawdot(double x, double y) {
    if(x!=x||y!=y) return;
    int ix=(int)x, iy=(int)y;
    float ox=(float)(1+ix-x), oy=(float)(1+iy-y);
    float px=1-ox, py=1-oy;
    subp(ix-1, iy-1, cr*ox*oy*.05f, cg*ox*oy*.05f, cb*ox*oy*.05f);
    subp(ix  , iy-1, cr   *oy*.05f, cg   *oy*.05f, cb   *oy*.05f);
    subp(ix+1, iy-1, cr*px*oy*.05f, cg*px*oy*.05f, cb*px*oy*.05f);
    subp(ix-1, iy  , cr*ox   *.05f, cg*ox   *.05f, cb*ox   *.05f);
    subp(ix  , iy  , cr      *.05f, cg      *.05f, cb      *.05f);
    subp(ix+1, iy  , cr*px   *.05f, cg*px   *.05f, cb*px   *.05f);
    subp(ix-1, iy+1, cr*ox*py*.05f, cg*ox*py*.05f, cb*ox*py*.05f);
    subp(ix  , iy+1, cr   *py*.05f, cg   *py*.05f, cb   *py*.05f);
    subp(ix+1, iy+1, cr*px*py*.05f, cg*px*py*.05f, cb*px*py*.05f);
  }
  int xinp(double x) {
    return((int)((x+addx)*scax));
  }
  int yinp(double y) {
    return((int)((y+addy)*scay));
  }
  double xinpd(double x) {
    return(((x+addx)*scax));
  }
  double yinpd(double y) {
    return(((y+addy)*scay));
  }
  void subp(int x, int y, float r, float g, float b) {
    if(x<0||y<0||x>=sx||y>=sy) return;
    setp(x, y, getpr(x, y)-r, getpg(x, y)-g, getpb(x, y)-b);
  }
  void fixp(int x, int y) {
    if(x<0||y<0||x>=sx||y>=sy) return;
    float r=getpr(x, y), g=getpg(x, y), b=getpb(x, y);
    if(r<=0) r=0; else if(r>=1) r=1; if(g<=0) g=0; else if(g>=1) g=1; if(b<=0) b=0; else if(b>=1) b=1;
    setp(x, y, r, g, b);
  }
  void setp(int x, int y, float r, float g, float b) {
    if(x<0||y<0||x>=sx||y>=sy) return;
    gr[(x+y*sx)*3]=r; gr[(x+y*sx)*3+1]=g; gr[(x+y*sx)*3+2]=b;
  }
  float getpr(int x, int y) {
    return(gr[(x+y*sx)*3]);
  }
  float getpg(int x, int y) {
    return(gr[(x+y*sx)*3+1]);
  }
  float getpb(int x, int y) {
    return(gr[(x+y*sx)*3+2]);
  }
  void setc(float r, float g, float b) {
    cr=r; cg=g; cb=b;
  }
  void cals() {
    delx=maxx-minx; dely=miny-maxy;
    scax=(sx-1)/delx; scay=(sy-1)/dely;
    addx=-minx+.5/scax; addy=-maxy+.5/scay;
  }
  public void init() {
    int x, y;
    sx=getSize().width; sy=getSize().height; gr=new float[sx*sy*3];
    cals();
    for(y=0;y<sy;++y) for(x=0;x<sx;++x) setp(x, y, 1, 1, 1);


    minx=-10/3.; miny=-10/3.; maxx=10/3.; maxy=10/3.; stex=1; stey=1; cals();
    setc(.6f, .6f, .6f);
    drawfunction(new erf(1));
    setc(.1f, .8f, .8f);
    drawfunction(new erf(2));
    setc(.8f, .1f, .8f);
    drawfunction(new erf(3));
    setc(.8f, .8f, .1f);
    drawfunction(new erf(4));
    setc(.1f, .1f, .8f);
    drawfunction(new erf(5));
/*    setc(.8f, .1f, .1f);
    drawfunction(new expinvsqlau(5));
    setc(.1f, .8f, .1f);
    drawfunction(new expinvsqlau(6));
    setc(.1f, .1f, .1f);
    drawfunction(new expinvsqlau(7));
    setc(.6f, .1f, .81f);
    drawfunction(new expinvsqlau(50));*/
/*
    minx=-1.25; miny=-1.25; maxx=1.25; maxy=1.25; stex=.1; stey=.1; cals();
    setc(.025f, .025f, .025f);
    drawgrid(); stex=1; stey=1;
    setc(.3f, .6f, .8f);
    drawfunction(new fresC(), new fresS(), -2, 2);

    minx=-50; miny=-1.25; maxx=5; maxy=1.25; stex=1; stey=1; cals();
    setc(.1f, .8f, .8f);
    drawfunction(new fresS());
    setc(.8f, .1f, .8f);
    drawfunction(new fresC());

    minx=-1.5; miny=-2.5; maxx=3.5; maxy=2.5; stex=1; stey=1; cals();
    setc(.3f, .6f, .8f);
    drawfunction(new paray(new arecip(2)), new parax(new arecip(2)), .05, 50);

    minx=-2.5; miny=-1.5; maxx=2.5; maxy=3.5; stex=1; stey=1; cals();
    setc(.6f, .6f, .6f);
    drawfunction(new expinvsq());
    setc(.1f, .8f, .8f);
    drawfunction(new expinvsqlau(1));
    setc(.8f, .1f, .8f);
    drawfunction(new expinvsqlau(2));
    setc(.8f, .8f, .1f);
    drawfunction(new expinvsqlau(3));
    setc(.1f, .1f, .8f);
    drawfunction(new expinvsqlau(4));
    setc(.8f, .1f, .1f);
    drawfunction(new expinvsqlau(5));
    setc(.1f, .8f, .1f);
    drawfunction(new expinvsqlau(6));
    setc(.1f, .1f, .1f);
    drawfunction(new expinvsqlau(7));
    setc(.6f, .1f, .81f);
    drawfunction(new expinvsqlau(50));

    double ax=0, ay=0;//double ax=new multisin().y(123), ay=new multicos().y(123);
    minx=ax-5/3.; miny=ay-5/3.; maxx=ax+5/3.; maxy=ay+5/3.; stex=.1; stey=.1; cals();
    setc(.025f, .025f, .025f);
    drawgrid(); stex=1; stey=1;
    setc(.3f, .6f, .8f);
    drawfunction(new multisin(), new multicos(), -3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825, 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825);

    minx=-10; miny=-10; maxx=10; maxy=10; stex=1; stey=1; cals();
    setc(.6f, .6f, .6f);
    drawfunction(new sin());
    setc(.1f, .8f, .8f);
    drawfunction(new sintay(1));
    setc(.8f, .1f, .8f);
    drawfunction(new sintay(2));
    setc(.8f, .8f, .1f);
    drawfunction(new sintay(3));
    setc(.1f, .1f, .8f);
    drawfunction(new sintay(4));
    setc(.8f, .1f, .1f);
    drawfunction(new sintay(5));
    setc(.1f, .8f, .1f);
    drawfunction(new sintay(6));
    setc(.1f, .1f, .1f);
    drawfunction(new sintay(7));

    minx=-2.5; miny=-.5; maxx=2.5; maxy=4.5; stex=1; stey=1; cals();
    setc(.3f, .6f, .8f);
    drawfunction(new expinvsq());

    minx=-2.5; miny=-.5; maxx=2.5; maxy=4.5; stex=1; stey=1; cals();
    setc(.3f, .6f, .8f);
    drawfunction(new expinv());

    minx=-1; miny=-7; maxx=9; maxy=3; stex=1; stey=1; cals();
    setc(.3f, .6f, .8f);
    drawfunction(new ln());

    minx=-5; miny=-1; maxx=5; maxy=9; stex=1; stey=1; cals();
    setc(.3f, .6f, .8f);
    drawfunction(new exp());

    minx=-5; miny=-5; maxx=5; maxy=5; stex=1; stey=1; cals();
    setc(.1f, .8f, .8f);
    drawfunction(new sinh());
    setc(.8f, .1f, .8f);
    drawfunction(new cosh());
    setc(.8f, .8f, .1f);
    drawfunction(new tanh());

    minx=-5; miny=-5; maxx=5; maxy=5; stex=1; stey=1; cals();
    setc(.1f, .8f, .8f);
    drawfunction(new csch());
    setc(.8f, .1f, .8f);
    drawfunction(new sech());
    setc(.8f, .8f, .1f);
    drawfunction(new coth());
*/

    setc(.8f, .8f, .8f);
    drawaxes();
    setc(.1f, .1f, .1f);
    drawgrid();
    for(y=0;y<sy;++y) for(x=0;x<sx;++x) fixp(x, y);
  }
  public void paint(Graphics g) {
    int x, y;
    for(y=0;y<sy;++y) for(x=0;x<sx;++x) {
      g.setColor(new Color(gr[(x+y*sx)*3], gr[(x+y*sx)*3+1], gr[(x+y*sx)*3+2]));
      g.fillRect(x, y, 1, 1);
    }
  }
}

abstract class function {
  abstract double y(double x);
  abstract double dydx(double x);
}

class sinh extends function {
  double y(double x) {
    return((Math.exp(x)-Math.exp(-x))/2);
  }
  double dydx(double x) {
    return((Math.exp(x)+Math.exp(-x))/2);
  }
}

class cosh extends function {
  double y(double x) {
    return((Math.exp(x)+Math.exp(-x))/2);
  }
  double dydx(double x) {
    return((Math.exp(x)-Math.exp(-x))/2);
  }
}

class tanh extends function {
  double y(double x) {
    return((Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x)));
  }
  double dydx(double x) {
    return(1-y(x)*y(x));
  }
}



class csch extends function {
  double y(double x) {
    return(1/((Math.exp(x)-Math.exp(-x))/2));
  }
  double dydx(double x) {
    return(-((Math.exp(x)+Math.exp(-x))/2)*y(x)*y(x));
  }
}

class sech extends function {
  double y(double x) {
    return(1/((Math.exp(x)+Math.exp(-x))/2));
  }
  double dydx(double x) {
    return(-((Math.exp(x)-Math.exp(-x))/2)*y(x)*y(x));
  }
}

class coth extends function {
  double y(double x) {
    return(1/((Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x))));
  }
  double dydx(double x) {
    return(1-y(x)*y(x));
  }
}


class exp extends function {
  double y(double x) {
    return(Math.exp(x));
  }
  double dydx(double x) {
    return(Math.exp(x));
  }
}


class ln extends function {
  double y(double x) {
    return(Math.log(x));
  }
  double dydx(double x) {
    return(1/x);
  }
}


class expinv extends function {
  double y(double x) {
    return(Math.exp(-1/x));
  }
  double dydx(double x) {
    return(Math.exp(-1/x)/x/x);
  }
}


class expinvsq extends function {
  double y(double x) {
    return(Math.exp(-1/x/x));
  }
  double dydx(double x) {
    return(2*Math.exp(-1/x/x)/x/x/x);
  }
}


class sin extends function {
  double y(double x) {
    return(Math.sin(x));
  }
  double dydx(double x) {
    return(Math.cos(x));
  }
}

class sintay extends function {
  int n;
  sintay(int nn) { n=nn; }
  double y(double x) {
    double f=1, r=0, t;
    int j, k=1, i;
    for(j=0;j<n;++j) {
      for(i=0,t=1;i<k;++i) t*=x;
      r+=t*f;
      ++k; f/=k; ++k; f/=-k;
    }
    return(r);
  }
  double dydx(double x) {
    double f=1, r=0, t;
    int j, k=1, i;
    for(j=0;j<n;++j) {
      for(i=0,t=1;i<k-1;++i) t*=x;
      r+=t*f*k;
      ++k; f/=k; ++k; f/=-k;
    }
    return(r);
  }
}

/*
class multisin extends function {
  double y(double x) {
    double r=0, f=1;
    int p=2;
    for(;p<100;++p) if(isp(p)) {
      r+=Math.sin(x*p)*p*f;
      f/=-1.1;
    }
    return(r);
  }
  boolean isp(int p) {
    for(int x=2;x<p;++x) if(p/x*x==p) return(false);
    return(true);
  }
  double dydx(double x) {
    double r=0, f=1;
    int p=2;
    for(;p<100;++p) if(isp(p)) {
      r+=Math.cos(x*p)*p*p*f;
      f/=-1.1;
    }
    return(r);
  }
}


class multicos extends function {
  double y(double x) {
    double r=0, f=1;
    int p=2;
    for(;p<100;++p) if(isp(p)) {
      r+=Math.cos(x*p)*p*f;
      f/=-1.1;
    }
    return(r);
  }
  boolean isp(int p) {
    for(int x=2;x<p;++x) if(p/x*x==p) return(false);
    return(true);
  }
  double dydx(double x) {
    double r=0, f=1;
    int p=2;
    for(;p<100;++p) if(isp(p)) {
      r-=Math.sin(x*p)*p*p*f;
      f/=-1.1;
    }
    return(r);
  }
}
*/

class multisin extends function {
  double y(double x) {
    double r=0, f=1;
    int p=1, q=-1;
    for(;p<100000;q-=(p-=q)) {
      r+=Math.sin(x*p)/q;
      f/=-2;
    }
    return(r);
  }
  double dydx(double x) {
    double r=0, f=1;
    int p=1, q=-1;
    for(;p<100000;q-=(p-=q)) {
      r+=Math.cos(x*p)*p/q;
      f/=-2;
    }
    return(r);
  }
}


class multicos extends function {
  double y(double x) {
    double r=0, f=1;
    int p=1, q=-1;
    for(;p<100000;q-=(p-=q)) {
      r+=Math.cos(x*p)/q;
      f/=-2;
    }
    return(r);
  }
  double dydx(double x) {
    double r=0, f=1;
    int p=1, q=-1;
    for(;p<100000;q-=(p-=q)) {
      r-=Math.sin(x*p)*p/q;
      f/=-2;
    }
    return(r);
  }
}


class parax extends function {
  function r;
  parax(function rr) { r=rr; }
  double y(double x) {
    return(r.y(x)*Math.sin(x));
  }
  double dydx(double x) {
    return(r.dydx(x)*Math.sin(x)+r.y(x)*Math.cos(x));
  }
}

class paray extends function {
  function r;
  paray(function rr) { r=rr; }
  double y(double x) {
    return(r.y(x)*Math.cos(x));
  }
  double dydx(double x) {
    return(r.dydx(x)*Math.cos(x)-r.y(x)*Math.sin(x));
  }
}


class expinvsqlau extends function {
  int n;
  expinvsqlau(int nn) { n=nn; }
  double y(double x) {
    double f=1, r=0, t;
    int j, k=0, i;
    for(j=0;j<n+1;++j) {
      for(i=0,t=1;i<k;++i) t/=-x*x;
      r+=t*f;
      ++k; f/=k;
    }
    return(r);
  }
  double dydx(double x) {
    double f=1, r=0, t;
    int j, k=0, i;
    for(j=0;j<n+1;++j) {
      for(i=0,t=1;i<k;++i) t/=-x*x;
      r+=-2*j*t*f/x;
      ++k; f/=k;
    }
    return(r);
  }
}

class recip extends function {
  double y(double x) {
    return(1/x);
  }
  double dydx(double x) {
    return(-1/x/x);
  }
}

class arecip extends function {
  double a;
  arecip(double aa) { a=aa; }
  double y(double x) {
    return(a/x);
  }
  double dydx(double x) {
    return(-a/x/x);
  }
}

class fresS extends function {
  double y(double x) {
    double t=0, x4=-x*x*x*x, b=x*x*x, p=-10;
    for(int n=0;(t-p>.00001||p-t>.00001)&&n<1000;++n) {
      p=t; t+=b/(4*n+3); b*=x4/((2*n+2)*(2*n+3));
    }
    return(t);
  }
  double dydx(double x) {
    return(Math.sin(x*x));
  }
}

class fresC extends function {
  double y(double x) {
    double t=0, x4=-x*x*x*x, b=x, p=-10;
    for(int n=0;(t-p>.00001||p-t>.00001)&&n<1000;++n) {
      p=t; t+=b/(4*n+1); b*=x4/((2*n+1)*(2*n+2));
    }
    return(t);
  }
  double dydx(double x) {
    return(Math.cos(x*x));
  }
}

class erf extends function {
  int e;
  double w=1/Math.sqrt(3.141592653589793238462643383);
  erf(int ee) { e=ee; for(;ee>1;--ee) w*=ee; }
  double y(double x) {
    double t=0, x4=-Math.pow(x, e), b=x*w, p=-10;
    for(int n=0;(t-p>.00001||p-t>.00001)&&n<1000;++n) {
      p=t; t+=b/(e*n+1); b*=x4/(n+1);
    }
    return(t);
  }
  double dydx(double x) {
    return(w*Math.exp(-Math.pow(x, e)));
  }
}

class check extends function {
  erf a=new erf(3);
  double y(double x) {
    return(1+(a.y(x+.001)-a.y(x-.001))*500-a.dydx(x));
  }
  double dydx(double x) {
    return(0);
  }
}