本文整理汇总了C++中FluidSim::get_velocity方法的典型用法代码示例。如果您正苦于以下问题:C++ FluidSim::get_velocity方法的具体用法?C++ FluidSim::get_velocity怎么用?C++ FluidSim::get_velocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluidSim
的用法示例。
在下文中一共展示了FluidSim::get_velocity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
void display(void)
{
if(draw_grid) {
glColor3f(0,0,0);
glLineWidth(1);
draw_grid2d(Vec2f(0,0), sim.dx, sim.ni, sim.nj);
}
if(draw_boundaries) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
draw_circle2d(c0, rad0, 50);
draw_circle2d(c1, rad1, 50);
draw_circle2d(c2, rad2, 50);
draw_circle2d(c3, rad3, 50);
//There's a bug, so draw one more(?)
draw_circle2d(c3, 0, 10);
}
if(draw_particles) {
glColor3f(0,0,0);
glPointSize(3);
draw_points2d(sim.particles);
}
if(draw_velocities) {
for(int j = 0;j < sim.nj; ++j) for(int i = 0; i < sim.ni; ++i) {
Vec2f pos((i+0.5f)*sim.dx,(j+0.5f)*sim.dx);
draw_arrow2d(pos, pos + 0.01f*sim.get_velocity(pos), 0.1f*sim.dx);
}
}
}
示例2: display
void display(void)
{
if(draw_grid) {
glColor3f(0,0,0);
glLineWidth(1);
draw_grid2d(Vec2f(0,0), sim.dx, sim.ni, sim.nj);
}
if(draw_boundaries) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
draw_circle2d(c0, rad0, 50);
//There's a bug, so draw one more(?)
draw_circle2d(c3, 0, 10);
}
if(draw_particles) {
glColor3f(0,0,1);
glPointSize(3);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
draw_points2d(sim.particles);
for(unsigned int p = 0; p < sim.particles.size(); ++p) {
draw_circle2d(sim.particles[p], sim.particle_radius, 20);
}
}
if(draw_velocities) {
glColor3f(1,0,0);
for(int j = 0;j < sim.nj; ++j) for(int i = 0; i < sim.ni; ++i) {
Vec2f pos((i+0.5)*sim.dx,(j+0.5)*sim.dx);
draw_arrow2d(pos, pos + 0.01f*sim.get_velocity(pos), 0.01*sim.dx);
}
}
}