예제 #1
0
void random_axis_quat(union quat *q, float angle)
{
	union vec3 v;

	random_point_on_sphere(1.0, &v.v.x, &v.v.y, &v.v.z);
	quat_init_axis_v(q, &v, angle);
}
예제 #2
0
void random_quat(union quat *q)
{
	float angle;
	union vec3 v;

	random_point_on_sphere(1.0, &v.v.x, &v.v.y, &v.v.z);
	angle = (float) snis_randn(360) * M_PI / 180.0;
	quat_init_axis_v(q, &v, angle);

}
예제 #3
0
static void add_craters(const int nc)
{
	int i;

	printf("adding craters:");
	for (i = 0; i < nc; i++) {
		union vec3 p;
		random_point_on_sphere(1.0, &p.v.x, &p.v.y, &p.v.z);
		add_crater(i, p, 1.0, 0.005f);
		printf("o"); fflush(stdout);
	}
	printf("\n");
}
예제 #4
0
static void add_bumps(const int initial_bumps)
{
	int i;
	float h;

	if (nbumps == 1) /* If we're not doing any recursive bumps, then make the bumps taller */
		h = 0.3;
	else
		h = 0.1;
	printf("adding bumps:");
	for (i = 0; i < initial_bumps; i++) {
		union vec3 p;
		float r = 0.5 * (snis_random_float() + 1.0f) * initial_bump_size;

		random_point_on_sphere(1.0, &p.v.x, &p.v.y, &p.v.z);
		recursive_add_bump(p, r, h, shrink_factor, rlimit);
		printf(".");
		fflush(stdout);
	}
	printf("\n");
}