+/*
+c = 1.0 = distance from center to vertex
+b = distance to hex side
+a = distance along hex side
+
+A = angle at point center, this is the polar coord angle
+B = angle from vertex, this is 60 degrees
+C = Other angle, which is 180 - 60 - A = 120 - A
+
+sin B = sin 60 = sqrt(3) / 2
+cos B = cos 60 = 1/2
+
+b = c * sin B / ( sin A cos B + sin B cos A)
+
+c * sin B / ( sin A cos B + sin B cos A)
+
+0.5 * sqrt3
+-------------
+sinA 0.5 + sqrt3 * 0.5 cosA
+
+sqrt3
+-------------
+sinA + sqrt3 cosA
+
+b=
+3
+-------------
+cosA + sqrt3 sinA
+
+x = b cosA
+y = b sinA
+*/
+
+#define RD (180.0 / M_PI)
+/* angle ranges from 0-6 */
+/* distance is 0 at origin, 1.0 at the hex side */
+
+/* return the polar distance ? */
+double HL_polar(double angle, double distance, double *x, double *y) {
+ double A, B, C, b, c;
+ double sinB, sinC;
+#if 0
+ double sqrt3;
+
+ sqrt3 = sqrt(3.0);
+#endif
+
+ /* convert angle to radians */
+ angle = angle * M_PI / 3.0;
+
+ /* calculate the distance along the ray to the hex side */
+
+ A = fmod(angle, M_PI/3.0); /* constrain to within an equilateral */
+ B = M_PI / 3.0;
+ C = M_PI - A - B;
+
+ sinB = sin(B);
+ sinC = sin(C);
+
+ c = 1.0;
+ c = HL_vertexv[0];
+#if 0
+ /* provided for completeness, but we don't use the value */
+ sinA = sin(A);
+ a = c * sinA / sinC;
+#endif
+ b = c * sinB / sinC;
+
+ if (x) {
+ *x = b * cos(angle);
+ }
+
+ if (y) {
+ *y = b * sin(angle);
+ }
+
+ return b;
+}
+