void TriStrip::get_strips( Bface* start, vector<TriStrip*>& strips ) { // if starting face was visited already, stop if (!is_cleared(start)) return; // stack is used to record faces adjacent to // the current strip, in order to build additional // strips that align with the current one static Bface_list stack(1024); stack.clear(); stack.push_back(start); BMESHptr mesh = start->mesh(); while (!stack.empty()) { start = stack.back(); stack.pop_back(); if (is_cleared(start)) { TriStrip* strip = mesh->new_tri_strip(); strip->build(start, stack); strips.push_back(strip); } } }
/********************************************************************** * TriStrip: **********************************************************************/ Bface* TriStrip::backup_strip(Bface* f, Bvert*& a) { // we'd like to draw a triangle strip starting at the // given triangle and proceeding "forward." but to get // the most bang for the buck, we'll first "backup" over // as many triangles as possible to find a starting place // from which we can generate a longer strip. assert(!f->flag()); mark_face(f); Bface* ret = f; Bvert* b = f->next_vert_ccw(a); Bedge* e; int i = 0; while((e = f->edge_from_vert((i%2) ? b : a)) && e->consistent_orientation() && e->is_crossable() && (f = e->other_face(f)) && is_cleared(f)) { mark_face(f); ret = f; Bvert* d = f->other_vertex(a,b); b = a; a = d; i++; } _orientation = ((i%2) != 0); return ret; }
static bool test_opaque_cleared(WINDOW *win, int mode) { if (mode >= 0) { if (mode) wclear(win); } return is_cleared(win); }
void Wave::clear() { if(!is_cleared()) { std::list<Enemy*>::iterator it = enemies.begin(); while (it != enemies.end()){ delete (*it); it = enemies.erase(it); } } }
void Wave::update(float dt, long time) { spawn(dt, time); if(!is_cleared()){ std::list<Enemy*>::iterator it = enemies.begin(); while (it != enemies.end()){ (*it)->update(dt, time); (*it)->repulse(this); it++; } } }
void nest::SourceTable::finalize() { if ( not is_cleared() ) { for ( thread tid = 0; tid < static_cast< thread >( sources_.size() ); ++tid ) { clear( tid ); } } sources_.clear(); current_positions_.clear(); saved_positions_.clear(); }
bool TriStrip::build( Bface* start, // build a new strip starting here. Bface_list& stack // used to build nearby parallel strips ) { // a set flag means this face is already in a TriStrip assert(!start->flag()); // start fresh reset(); // repeat 1st vertex if needed if (!start->orient_strip()) start->orient_strip(start->v1()); // get the starting vert. i.e., the strip will // continue onto the next face across the edge // opposite this vertex. Bvert *a = start->orient_strip(), *b, *c; // squash and stretch start = backup_strip(start,a); if (!start) { // should never happen, but can happen // if there are inconsistently oriented faces err_msg("TriStrip::build: error: backup_strip() failed"); err_msg("*** check mesh for inconsistently oriented faces ***"); return 0; } // claim it claim_face(start); // record direction of strip on 1st face: start->orient_strip(a); // faces alternate CCW / CW if (_orientation) { c = start->next_vert_ccw(a); b = start->next_vert_ccw(c); } else { b = start->next_vert_ccw(a); c = start->next_vert_ccw(b); } add(a,start); add(b,start); add(c,start); Bface* opp; if ((opp = start->opposite_face(b)) && is_cleared(opp) && opp->patch() == start->patch()) { opp->orient_strip(_orientation ? a : c); stack.push_back(opp); } int i=_orientation; Bface* cur = start; while ((cur = cur->next_strip_face()) && !is_claimed(cur)) { claim_face(cur); i++; a = b; b = c; c = cur->other_vertex(a,b); cur->orient_strip(a); if ((opp = cur->opposite_face(b)) && is_cleared(opp) && opp->patch() == start->patch()) { opp->orient_strip(i % 2 ? a : c); stack.push_back(opp); } add(c,cur); } return 1; }