sandbox/Antoonvh/scatter2.h
A Scattering bview function
the scatter
function can be used to scatter Particles
in bview. The formulation
is inspired by other bview functions in draw.h.
trace
void scatter (Particles p, float s = 3, float pc[3] = {0,0,0}) {
* view = draw();
bview #if dimension == 2
(0., 0., view->lc*view->fov/24.); //from draw_lines()
glTranslatef #endif
(pc[0], pc[1], pc[2]);
glColor3f(s*view->samples);
glPointSize(GL_POINTS);
glBegin (p) {
foreach_particle_in#if dimension == 2
(view, x, y);
glvertex2d #else // dimension == 3
(view, x, y, z);
glvertex3d #endif
}
();
glEnd->ni++;
view}
Curve
From A. Castillo’s sandbox.
void draw_curve(Particles p, float lw = 5, float lc[3] = {0,0,0}, bool noloop = false){
(lc[0], lc[1], lc[2]);
glColor3f(lw);
glLineWidth= pl[(int)p];
particles pp (p) {
foreach_particle_in(GL_LINES);
glBeginint in = _j_particle < pn[p] - 1 ? _j_particle + 1 : noloop ? _j_particle : 0;
(x, y, z);
glVertex3f(pp[in].x, pp[in].y, pp[in].z);
glVertex3f();
glEnd}
}