Subversion Repositories gelsvn

Rev

Rev 416 | Rev 434 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 416 Rev 417
Line 668... Line 668...
668
	{
668
	{
669
		istringstream a0(args[0]);
669
		istringstream a0(args[0]);
670
		a0 >> noise_amplitude;
670
		a0 >> noise_amplitude;
671
	}
671
	}
672
	
672
	
673
	srand(0);
673
	gel_srand(0);
674
	for(VertexIter vi = active_mesh().vertices_begin(); vi != active_mesh().vertices_end(); ++vi)
674
	for(VertexIter vi = active_mesh().vertices_begin(); vi != active_mesh().vertices_end(); ++vi)
675
	{
675
	{
676
		Vec3f v;
676
		Vec3f v;
677
		do {
677
		do {
678
			v = Vec3f(rand(),rand(),rand());
678
			v = Vec3f(gel_rand(),gel_rand(),gel_rand());
679
			v /= RAND_MAX;
679
			v /= GEL_RAND_MAX;
680
		} while(sqr_length(v) > 1.0);
680
		} while(sqr_length(v) > 1.0);
681
		v -= Vec3f(0.5);
681
		v -= Vec3f(0.5);
682
		v *= 2.0;
682
		v *= 2.0;
683
		v *= noise_amplitude;
683
		v *= noise_amplitude;
684
		v *= avg_length;
684
		v *= avg_length;
Line 708... Line 708...
708
	vector<Vec3f> normals(active_mesh().no_vertices());
708
	vector<Vec3f> normals(active_mesh().no_vertices());
709
	int i=0;
709
	int i=0;
710
	for(VertexIter vi = active_mesh().vertices_begin(); vi != active_mesh().vertices_end(); ++vi,++i)
710
	for(VertexIter vi = active_mesh().vertices_begin(); vi != active_mesh().vertices_end(); ++vi,++i)
711
		normals[i] = normal(vi);
711
		normals[i] = normal(vi);
712
	i=0;
712
	i=0;
713
	srandom(0);
713
	gel_srand(0);
714
	for(VertexIter vi = active_mesh().vertices_begin(); vi != active_mesh().vertices_end(); ++vi,++i)
714
	for(VertexIter vi = active_mesh().vertices_begin(); vi != active_mesh().vertices_end(); ++vi,++i)
715
	{
715
	{
716
		float rval = 0.5-random()/float(RAND_MAX);
716
		float rval = 0.5-gel_rand()/float(GEL_RAND_MAX);
717
		vi->pos += normals[i]*rval*noise_amplitude*avg_length*2.0;
717
		vi->pos += normals[i]*rval*noise_amplitude*avg_length*2.0;
718
	}
718
	}
719
	return "";
719
	return "";
720
}
720
}
721
 
721