[xiph-commits] r10072 - trunk/planarity
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Mon Sep 26 01:42:20 PDT 2005
Author: xiphmont
Date: 2005-09-26 01:42:18 -0700 (Mon, 26 Sep 2005)
New Revision: 10072
Modified:
trunk/planarity/graph_arrange.c
trunk/planarity/graph_arrange.h
trunk/planarity/graph_generate.c
trunk/planarity/graph_generate.h
trunk/planarity/graph_generate_mesh1.c
trunk/planarity/version.h
Log:
Another puzzle board. Well, OK, actually just a new shape.
Modified: trunk/planarity/graph_arrange.c
===================================================================
--- trunk/planarity/graph_arrange.c 2005-09-26 08:10:34 UTC (rev 10071)
+++ trunk/planarity/graph_arrange.c 2005-09-26 08:42:18 UTC (rev 10072)
@@ -27,6 +27,7 @@
#include <math.h>
#include "graph.h"
+#include "random.h"
#include "gameboard.h"
#include "graph_arrange.h"
@@ -62,3 +63,36 @@
}
}
}
+
+void arrange_verticies_cloud(graph *g){
+ vertex *v = g->verticies;
+ int n = g->vertex_num;
+ int bw=g->orig_width;
+ int bh=g->orig_height;
+ int radiusx=min(bw,bh)*.55;
+ int radiusy=min(bw,bh)*.40;
+ int i;
+
+ // first half form an outer perimiter
+
+ for(i=0;i<n/2;i++){
+ v->x = rint( radiusx * cos( i*M_PI*4./n) + (bw>>1));
+ v->y = rint( radiusy * sin( i*M_PI*4./n) + (bh>>1));
+ v=v->next;
+ }
+
+ // second third form an inner perimiter
+
+ for(;i<n/2+n/3;i++){
+ v->x = rint( radiusx * .7 * cos( i*M_PI*6./n) + (bw>>1));
+ v->y = rint( radiusy * .7 * sin( i*M_PI*6./n) + (bh>>1));
+ v=v->next;
+ }
+
+ for(;i<n;i++){
+ v->x = rint( radiusx * .4 * cos( i*M_PI*12./n) + (bw>>1));
+ v->y = rint( radiusy * .4 * sin( i*M_PI*12./n) + (bh>>1));
+ v=v->next;
+ }
+
+}
Modified: trunk/planarity/graph_arrange.h
===================================================================
--- trunk/planarity/graph_arrange.h 2005-09-26 08:10:34 UTC (rev 10071)
+++ trunk/planarity/graph_arrange.h 2005-09-26 08:42:18 UTC (rev 10072)
@@ -26,3 +26,4 @@
extern void arrange_verticies_circle(graph *g, float off1, float off2);
extern void arrange_verticies_mesh(graph *g, int width, int height);
+extern void arrange_verticies_cloud(graph *g);
Modified: trunk/planarity/graph_generate.c
===================================================================
--- trunk/planarity/graph_generate.c 2005-09-26 08:10:34 UTC (rev 10071)
+++ trunk/planarity/graph_generate.c 2005-09-26 08:42:18 UTC (rev 10072)
@@ -40,21 +40,22 @@
int unlock;
} gen_instance;
-#define FINITE_LEVELS 8
+#define FINITE_LEVELS 9
static gen_instance i_list[FINITE_LEVELS]={
{"mesh1", 1, "A Small Beginning", generate_mesh_1, 1.,1., 1 }, // 1
{"mesh1", 2, "My First Real Level(tm)", generate_mesh_1, 1.,1., 2 }, // 2
{"data" , 0, "My First Mission Impossible(tm)", generate_data, 1.,1.5,3 }, // 3
{"mesh1", 3, "Larger, Not Harder", generate_mesh_1, 1.,1., 3 }, // 4
{"meshC", 5, "The Trick Is It's Easy", generate_mesh_1C, 1.,1., 2 }, // 5
- {"meshM", 6, "If You Squint, It's A Brick", generate_mesh_1M, 1.,1., 1 }, // 6
- {"mesh1", 7, "Round But Straightforward", generate_mesh_1, 1.,1., 4 }, // 7
+ {"meshM", 6, "If You Squint, It's a Brick", generate_mesh_1M, 1.,1., 1 }, // 6
+ {"mesh1", 7, "Round but Straightforward", generate_mesh_1, 1.,1., 4 }, // 7
{"meshS",10, "Tough and Stringy", generate_mesh_1S, 2.,1., 3 }, // 8
+ {"cloud", 9, "More of a Mess Than Usual", generate_mesh_1_cloud, 2.,1., 3 }, // 9
};
#define LOOP_LEVELS 1
static gen_instance i_list_loop[LOOP_LEVELS]={
- {"mesh1", 9, "\"Original\" Board Number %d", generate_mesh_1, 1.,1., 2 }, // n
+ {"mesh1", 10, "\"Original\" Board Number %d", generate_mesh_1, 1.,1., 2 }, // n
};
int generate_find_number(char *id){
Modified: trunk/planarity/graph_generate.h
===================================================================
--- trunk/planarity/graph_generate.h 2005-09-26 08:10:34 UTC (rev 10071)
+++ trunk/planarity/graph_generate.h 2005-09-26 08:42:18 UTC (rev 10072)
@@ -32,5 +32,6 @@
extern void generate_mesh_1M(graph *g, int order);
extern void generate_mesh_1C(graph *g, int order);
extern void generate_mesh_1S(graph *g, int order);
+extern void generate_mesh_1_cloud(graph *g, int order);
extern void generate_data(graph *g, int order);
Modified: trunk/planarity/graph_generate_mesh1.c
===================================================================
--- trunk/planarity/graph_generate_mesh1.c 2005-09-26 08:10:34 UTC (rev 10071)
+++ trunk/planarity/graph_generate_mesh1.c 2005-09-26 08:42:18 UTC (rev 10072)
@@ -281,3 +281,10 @@
randomize_verticies(g);
arrange_verticies_circle(g,0,0);
}
+
+void generate_mesh_1_cloud(graph *g, int order){
+ mesh m;
+ generate_mesh(g,&m,order,40);
+ randomize_verticies(g);
+ arrange_verticies_cloud(g);
+}
Modified: trunk/planarity/version.h
===================================================================
--- trunk/planarity/version.h 2005-09-26 08:10:34 UTC (rev 10071)
+++ trunk/planarity/version.h 2005-09-26 08:42:18 UTC (rev 10072)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Mon Sep 26 04:02:41 EDT 2005] */
+/* DO NOT EDIT: Automated versioning hack [Mon Sep 26 04:40:44 EDT 2005] */
More information about the commits
mailing list