|
shape_doc 0.1
|
#include <ssi_dsearch.hpp>
Definition at line 214 of file ssi_dsearch.hpp.
Definition at line 24 of file ssi_lsegment.hpp.
| dsearch | ( | const shape::surface_parametric< double > * | s, |
| unsigned | w, | ||
| unsigned | h, | ||
| bool | cnf = false |
||
| ) |
Definition at line 10 of file ssi_dsearch.cpp.
References dsearch::_branches, dsearch::branches(), dsearch::conflict_count, dsearch::find_branches(), lsegment::grp, dsearch::lefts, dsearch::m_cnf, dsearch::nbcurves, dsearch::nbpoints, igraph::neighbors(), mmx::shape_ssi::reduce2(), lsegment::regions, dsearch::result, dsearch::rights, dsearch::search(), and dsearch::sizes.
: qsegment(s, w, h ) { m_cnf = cnf; // _st = time(); unsigned i,j; conflict_count = 0; nbpoints = 0; _branches = new std::list< dcurve * > *[this->regions.size()*this->regions.size()]; memset(_branches,0,sizeof( std::list< dcurve * > * )* this->regions.size()*this->regions.size() ); for ( i = 0; i < this->regions.size() ; i++ ) for ( j = i+1; j < this->regions.size() ; j++ ) { #define VOISINS_AUSSI #ifndef VOISINS_AUSSI if ( !this->grp->neighbors(i,j) ) #endif { //cout << i << " " << j << endl; search(i,j); find_branches(i,j); }; }; // cout << "search: ok\n"; std::vector< dcurve * > * tmp = new std::vector<dcurve*>(); for ( i = 0; i < this->regions.size(); i++ ) for ( j = i+1; j < this->regions.size(); j++ ) { if ( branches(i,j) ) { for ( std::list<dcurve*>::iterator it = branches(i,j)->begin(); it != branches(i,j)->end(); it ++ ) { tmp->push_back( *it ); }; delete branches(i,j); } }; result = reduce2( tmp ); delete tmp; nbcurves = 0; lefts = rights = 0; sizes = 0; if ( result ) { nbpoints = 0; std::list<dcurve *>::iterator it; nbcurves = result->size(); sizes = new unsigned[nbcurves]; for ( i = 0, it = result->begin(); it != result->end(); it++ , i++ ) { sizes[i] = (*it)->left.size(); nbpoints+= sizes[i]; }; lefts = new point2*[nbcurves]; rights = new point2*[nbcurves]; unsigned c_n = 0; unsigned k; for ( it = result->begin(); it != result->end(); it ++, c_n++ ) { lefts[c_n] = new point2[sizes[c_n]]; rights[c_n] = new point2[sizes[c_n]]; list2_t::iterator itcr, itcl; for ( k = 0, itcl = (*it)->left.begin(), itcr = (*it)->right.begin(); itcl != (*it)->left.end(); itcl++ , itcr++, k++ ) { lefts[c_n][k] = *itcl; rights[c_n][k] = *itcr; }; }; for ( std::list<dcurve*>::iterator it = result->begin(); it!= result->end(); it++ ) { delete *it; }; delete result; }; delete[] _branches; //std::cout << "d = " << (time()-_st) << std::endl; // std::cout << nbcurves << std::endl; // GnuPlotOutput("dsearch.gmv"); };
| ~dsearch | ( | ) |
Definition at line 103 of file ssi_dsearch.cpp.
References dsearch::lefts, dsearch::nbcurves, dsearch::rights, and dsearch::sizes.
Definition at line 18 of file ssi_lsegment.cpp.
References igraph::add_link(), mark_t::code, coherent_code(), lsegment::grp, and mark_t::head.
Referenced by lsegment::find_regions().
{
if ( coherent_code( m0->code, m1->code ) )
{
grp->add_link(m0->head,m1->head);
grp->add_link(m1->head,m0->head);
};
};
| vector3* base | ( | ) | const [inline, inherited] |
Definition at line 23 of file ssi_sample.hpp.
References sample::m_svals.
Referenced by qnode::fill(), and lsegment::lines_changes().
{ return m_svals; };
| mark_t* begin | ( | unsigned | i | ) | [inline, inherited] |
Definition at line 62 of file ssi_lsegment.hpp.
References lsegment::lines, and lsegment::marks.
Referenced by lsegment::find_regions().
| std::list< dcurve * >*& branches | ( | unsigned | i, |
| unsigned | j | ||
| ) | [inline] |
Definition at line 225 of file ssi_dsearch.hpp.
References dsearch::_branches, and lsegment::regions.
Referenced by dsearch::dsearch(), and dsearch::find_branches().
Definition at line 118 of file ssi_dsearch_triangle.cpp.
References dsearch::cnfdata3, and qnode::fill().
| void convert_regions | ( | ) | [inherited] |
Definition at line 123 of file ssi_lsegment.cpp.
References lsegment::promote(), and lsegment::regions.
Referenced by lsegment::lsegment().
| mark_t* end | ( | unsigned | i | ) | [inline, inherited] |
Definition at line 63 of file ssi_lsegment.hpp.
Referenced by lsegment::find_regions().
Definition at line 250 of file ssi_dsearch.hpp.
References dsearch::branches(), dsearch::curr_config, and dsearch::reduce().
Referenced by dsearch::dsearch().
{
branches( id0, id1 ) = reduce( curr_config );
delete curr_config;
};
| void find_regions | ( | ) | [inherited] |
Definition at line 65 of file ssi_lsegment.cpp.
References mark_t::a(), lsegment::addneighbors(), mark_t::b(), lsegment::begin(), mark_t::code, mmx::shape_ssi::down(), lsegment::end(), mark_t::head, INTERVALTEST, sample::ncols(), mark_t::next, sample::nrows(), lsegment::pushr(), lsegment::regions, and mmx::shape_ssi::up().
Referenced by lsegment::lsegment().
{
mark_t * p;
for ( p = begin(0); p != end(0); p++ )
pushr(0,p);
for ( p = begin(0)+1; p != end(0); p++ )
addneighbors(p,p-1);
mark_t * neighbors[ncols()];
unsigned n_neigh;
coord_t i;
#define INTERVALTEST ( std::abs(std::min(down->b(),up->b())-std::max(down->a(),up->a())) > 1 )
for ( i = 0; i < nrows()-2; i++ )
{
mark_t * startup = begin(i);
for ( mark_t * down = begin(i+1); down != end(i+1); down++ )
{
while ( startup->b() <= down->a() ) startup++;
mark_t * up = startup;
n_neigh = 0;
while( down->b() > up->a() )
if ( (up->next == 0) && ( up->code == down->code ) && INTERVALTEST)
{
regions[up->head]._umax++;
up->next = down;
down->head = up->head, up++;
break;
}
else
neighbors[n_neigh++] = up, up++;
if ( down->head == -1 ) pushr( i+1, down );
for ( unsigned k = 0; k < n_neigh; k ++ ) addneighbors(down,neighbors[k]);
while( down->b() > up->a() ) addneighbors(down,up), up++;
};
};
};
| void GnuPlotOutput | ( | char * | name | ) |
Definition at line 121 of file ssi_dsearch.cpp.
{
/*
gmv::stream out(name);
std::vector< vector3 > v;
for ( unsigned i = 0; i < nbcurves; i++ )
{
for ( unsigned k = 0; k < sizes[i]; k++ )
{
v.push_back(vector3());
v.back()[0] = lefts[i][k][0];
v.back()[1] = lefts[i][k][1];
v.back()[2] = 0;
v.push_back(vector3());
v.back()[0] = rights[i][k][0];
v.back()[1] = rights[i][k][1];
v.back()[2] = 0;
};
};
out.points(&(v[0][0]),v.size());
*/
}
| void lines_changes | ( | ) | [inherited] |
Definition at line 39 of file ssi_lsegment.cpp.
References sample::base(), lsegment::lines, lsegment::marks, sample::ncols(), lsegment::nmarks(), sample::nrows(), lsegment::pushm(), and vcode().
Referenced by lsegment::lsegment().
{
int i,j;
lines = (unsigned*)(malloc(sizeof(unsigned)*nrows()));
unsigned max_marks = nrows()*ncols();
while ( !(marks = (mark_t*)(malloc(sizeof(mark_t)*max_marks))) ) max_marks >>= 1;
vector3 * ptr = base();
for ( i = 0; i < this->nrows()-1; i++ )
{
lines[i] = nmarks();
vcode_t code = vcode(*ptr,*(ptr+ncols()),*(ptr+1));
pushm(code,0);
for ( j = 0; j < ncols()-1; j++, ptr++ )
{
vcode_t tmp = vcode(*ptr,*(ptr+ncols()),*(ptr+1));
if ( tmp != code )
{ code = tmp; pushm(code,j); };
};
pushm(code,ncols()-1);
ptr++;
};
lines[nrows()-1] = nmarks();
marks = (mark_t*)realloc(marks,sizeof(mark_t)*nmarks());
};
Definition at line 124 of file ssi_qsegment.cpp.
References qnode::box, qnode::father, mmx::hull(), qnode::l, mmx::lmax(), mmx::lmin(), lrnode::ls, qnode::mbox(), qnode::r, lrnode::rmax, lrnode::rmin, lrnode::rs, qnode::umax, lrnode::umax, qnode::umin, lrnode::umin, qnode::vmax, mmx::shape_ssi::vmax(), mmx::shape_ssi::vmin(), and qnode::vmin.
Referenced by qsegment::qsegment().
{
qnode * curr, * l, * r;
curr = l = r = 0;
if ( vmax <= lr->lmin || vmin >= lr->rmax ) return 0;
if ( vmin < lr->lmax || vmax > lr->rmin )
{
if ( lr->umax-lr->umin > vmax-vmin)
{
l = make( id, vmin, vmax, lr->ls );
r = make( id, vmin, vmax, lr->rs );
}
else
{
unsigned m = (vmin + vmax)/2;
l = make( id, vmin, m, lr );
r = make( id, m, vmax, lr );
};
if ( l && r )
{
curr = new qnode();
curr->umin = lr->umin;
curr->umax = lr->umax;
curr->vmin = vmin;
curr->vmax = vmax;
hull(curr->box,l->box,r->box);
curr->l = l;
curr->r = r;
l->father = curr;
r->father = curr;
return curr;
};
if ( l ) { return l; };
if ( r ) { return r; };
}
else
{
curr = new qnode();
curr->l = 0;
curr->r = 0;
curr->umin = lr->umin;
curr->umax = lr->umax;
curr->vmin = vmin;
curr->vmax = vmax;
curr->mbox(this);
return curr;
};
return curr;
};
| int ncols | ( | ) | const [inline, inherited] |
Definition at line 25 of file ssi_sample.hpp.
References sample::m_ncols.
Referenced by lsegment::find_regions(), and lsegment::lines_changes().
{ return m_ncols; };
| unsigned nmarks | ( | ) | const [inline, inherited] |
Definition at line 51 of file ssi_lsegment.hpp.
References lsegment::_size.
Referenced by lsegment::lines_changes().
{ return _size; };
| int nrows | ( | ) | const [inline, inherited] |
Definition at line 24 of file ssi_sample.hpp.
References sample::m_nrows.
Referenced by lsegment::find_regions(), and lsegment::lines_changes().
{ return m_nrows; };
| qtree operator[] | ( | unsigned | i | ) | [inline, inherited] |
Reimplemented from lsegment.
Definition at line 30 of file ssi_qsegment.hpp.
References qsegment::trees.
{ return trees[i]; };
| void promote | ( | region_t & | r | ) | [inherited] |
Definition at line 104 of file ssi_lsegment.cpp.
References lsegment::region_t::_umax, lsegment::region_t::_umin, mark_t::a(), mark_t::b(), lsegment::region_t::data, and mark_t::next.
Referenced by lsegment::convert_regions().
{
mark_t * mpointer;
bounds_t * bpointer;
mpointer = (mark_t*)(r.data);
r.data = (void*)(malloc(sizeof(bounds_t)*(r._umax)));
bpointer = (bounds_t*)(r.data);
for ( unsigned i = 0; i < r._umax; i++ )
{
bpointer[i][0] = mpointer->a();
bpointer[i][1] = mpointer->b();
mpointer = mpointer->next;
};
r._umax += r._umin;
r.data = (void*)(((bounds_t*)(r.data))-r._umin);
};
| void push | ( | const point2 & | l0, |
| const point2 & | l1, | ||
| const point2 & | r0, | ||
| const point2 & | r1, | ||
| const point3 & | i0, | ||
| const point3 & | i1 | ||
| ) | [inline] |
Definition at line 228 of file ssi_dsearch.hpp.
References dsearch::curr_config.
{
curr_config->push_back( new dcurve( l0,l1,r0, r1, i0, i1 ) );
};
Definition at line 128 of file ssi_dsearch_triangle.cpp.
References __down__, __triangle_triangle_case__, __up__, abs(), dsearch::conflict_count, qsegment::scale_conflict(), SHIFT, qnode::umin, and qnode::vmin.
Referenced by dsearch::search().
{
if ( std::abs(f->umin-s->umin)+std::abs(f->vmin-s->vmin) < SHIFT ) return;
conflict_count ++;
point3 a[4],b[4];
scale_conflict(a,b,f,s);
{
point3 seg[2];
point2 seg0[2], seg1[2];
bool coplanar;
__triangle_triangle_case__(__up__,__up__);
__triangle_triangle_case__(__up__,__down__);
__triangle_triangle_case__(__down__,__down__);
__triangle_triangle_case__(__down__,__up__);
}
};
Definition at line 9 of file ssi_lsegment.cpp.
References lsegment::_size, mark_t::code, mark_t::head, mark_t::j, lsegment::marks, and mark_t::next.
Referenced by lsegment::lines_changes().
Definition at line 27 of file ssi_lsegment.cpp.
References lsegment::region_t::_code, lsegment::region_t::_umax, lsegment::region_t::_umin, igraph::add_node(), mark_t::code, lsegment::region_t::data, lsegment::grp, mark_t::head, and lsegment::regions.
Referenced by lsegment::find_regions().
Definition at line 208 of file ssi_dsearch_build.cpp.
References mmx::shape_ssi::build_sheap(), mmx::shape_ssi::empty(), mmx::shape_ssi::extremums(), dsearch::result, and mmx::shape_ssi::solve_sheap().
Referenced by dsearch::find_branches().
{
unsigned i;
if ( conflicts->size() == 0 ) return 0;
unsigned endsize = 2*conflicts->size();
sdpoint_t * ends = new sdpoint_t[endsize];
for ( i = 0; i < endsize; i+= 2 )
extremums( ends + i, (*conflicts)[i/2] );
sheap_t h;
build_sheap(h,ends, ends + endsize, 0.04 );
solve_sheap(h);
delete[] ends;
std::list< dcurve* > * result = new std::list< dcurve * >();
for ( i = 0; i < conflicts->size() ; i++ )
{
if ( empty((*conflicts)[i]) ) delete (*conflicts)[i];
else result->push_front( (*conflicts)[i] );
};
return result;
};
| void rfree | ( | region_t & | r | ) | [inline, inherited] |
Definition at line 55 of file ssi_lsegment.hpp.
References lsegment::region_t::_umin, and lsegment::region_t::data.
Referenced by lsegment::~lsegment().
{
free((void*)(((bounds_t*)(r.data)) + r._umin));
};
Definition at line 104 of file ssi_qsegment.cpp.
References qnode::box, qnode::fill(), mmx::hull(), mmx::lmax(), mmx::shape_ssi::scale(), and mmx::shape_ssi::shiftm().
Referenced by dsearch::push().
Definition at line 74 of file ssi_dsearch_search.cpp.
References dsearch::curr_config, dsearch::search(), and qsegment::trees.
{
curr_config = new std::vector< dcurve* >();
search( this->trees[i], this->trees[j] );
};
Definition at line 34 of file ssi_dsearch_search.cpp.
References qnode::box, mmx::intersectp(), qnode::l, mmx::shape_ssi::leaf(), qnode::leaf(), dsearch::push(), qnode::r, dsearch::search_f(), dsearch::search_s(), and qnode::split().
Referenced by dsearch::dsearch(), and dsearch::search().
{
// if there bounding boxes intersect
if ( intersectp(f->box,s->box) )
{
// compute if needed the next level in the hierarchy
f->split(this);
s->split(this);
// if f and s are root node
if ( !(f->leaf()) && !(s->leaf()) )
{
// check all the possible intersection between sons
search(f->l,s->l), search(f->l,s->r);
search(f->r,s->l), search(f->r,s->r);
return;
};
// s is leaf (not f) switch to specialized case
if ( !leaf(f) )
{
search_f(f->l,s);
search_f(f->r,s);
return;
};
// same thing with f
if ( !leaf(s) )
{
search_s(f,s->l);
search_s(f,s->r);
return;
};
// two unit quad had been reached push the conflict
// the function push( qtree, qtree ) compute the intersection on the fly if any
push(f,s);
};
};
Definition at line 8 of file ssi_dsearch_search.cpp.
References qnode::box, mmx::intersectp(), qnode::l, mmx::shape_ssi::leaf(), push_f, qnode::r, and qnode::split().
Referenced by dsearch::search().
{
if (intersectp(f->box,s->box))
{
f->split(this);
if ( leaf(f) ){ push_f(f,s); return; };
search_f(f->l,s);
search_f(f->r,s);
};
};
Definition at line 21 of file ssi_dsearch_search.cpp.
References qnode::box, mmx::intersectp(), qnode::l, mmx::shape_ssi::leaf(), push_s, qnode::r, and qnode::split().
Referenced by dsearch::search().
{
if ( intersectp( f->box, s->box ) )
{
s->split(this);
if ( leaf(s) ) { push_s(f,s); return; };
search_s(f,s->l);
search_s(f,s->r);
};
};
| unsigned size | ( | void | ) | const [inline, inherited] |
Reimplemented from lsegment.
Definition at line 29 of file ssi_qsegment.hpp.
References qsegment::trees.
Referenced by qsegment::~qsegment().
{ return trees.size(); };
| const double& uvalue | ( | int | i | ) | const [inline, inherited] |
Definition at line 26 of file ssi_sample.hpp.
References sample::m_uvals.
Referenced by qnode::convert().
{ return m_uvals[i]; };
| const double& vvalue | ( | int | i | ) | const [inline, inherited] |
Definition at line 27 of file ssi_sample.hpp.
References sample::m_vvals.
Referenced by qnode::convert().
{ return m_vvals[i]; };
Definition at line 221 of file ssi_dsearch.hpp.
Referenced by dsearch::branches(), and dsearch::dsearch().
double _lt [inherited] |
Definition at line 74 of file ssi_lsegment.hpp.
double _qt [inherited] |
Definition at line 30 of file ssi_qsegment.hpp.
unsigned _size [inherited] |
Definition at line 47 of file ssi_lsegment.hpp.
Referenced by lsegment::lsegment(), lsegment::nmarks(), and lsegment::pushm().
| double _st |
Definition at line 279 of file ssi_dsearch.hpp.
Definition at line 276 of file ssi_dsearch.hpp.
Definition at line 275 of file ssi_dsearch.hpp.
Referenced by dsearch::cnfpush().
| unsigned conflict_count |
Definition at line 271 of file ssi_dsearch.hpp.
Referenced by dsearch::dsearch(), and dsearch::push().
| std::vector< dcurve * >* curr_config |
Definition at line 220 of file ssi_dsearch.hpp.
Referenced by dsearch::find_branches(), dsearch::push(), and dsearch::search().
Definition at line 66 of file ssi_lsegment.hpp.
Referenced by lsegment::addneighbors(), dsearch::dsearch(), lsegment::lsegment(), lsegment::pushr(), and lsegment::~lsegment().
Definition at line 265 of file ssi_dsearch.hpp.
Referenced by dsearch::dsearch(), mmx::shape::selfintersection(), and dsearch::~dsearch().
unsigned* lines [inherited] |
Definition at line 48 of file ssi_lsegment.hpp.
Referenced by lsegment::begin(), lsegment::lines_changes(), and lsegment::lsegment().
| bool m_cnf |
Definition at line 216 of file ssi_dsearch.hpp.
Referenced by dsearch::dsearch().
Definition at line 19 of file ssi_sample.hpp.
Referenced by qnode::fill(), sample::ncols(), and sample::sample().
Definition at line 18 of file ssi_sample.hpp.
Referenced by sample::nrows(), and sample::sample().
const shape::surface_parametric<double>* m_psurf [inherited] |
Definition at line 15 of file ssi_sample.hpp.
Referenced by sample::sample().
Definition at line 20 of file ssi_sample.hpp.
Referenced by sample::base(), and sample::sample().
double* m_uvals [inherited] |
Definition at line 16 of file ssi_sample.hpp.
Referenced by sample::sample(), sample::uvalue(), and sample::~sample().
double* m_vvals [inherited] |
Definition at line 17 of file ssi_sample.hpp.
Referenced by sample::sample(), and sample::vvalue().
Definition at line 46 of file ssi_lsegment.hpp.
Referenced by lsegment::begin(), lsegment::lines_changes(), lsegment::lsegment(), and lsegment::pushm().
| unsigned nbcurves |
Definition at line 269 of file ssi_dsearch.hpp.
Referenced by dsearch::dsearch(), mmx::shape::selfintersection(), and dsearch::~dsearch().
| unsigned nbpoints |
Definition at line 270 of file ssi_dsearch.hpp.
Referenced by dsearch::dsearch().
| double recons_time |
Definition at line 260 of file ssi_dsearch.hpp.
Definition at line 63 of file ssi_lsegment.hpp.
Referenced by dsearch::branches(), lsegment::convert_regions(), dsearch::dsearch(), lsegment::find_regions(), lsegment::operator[](), lsegment::pushr(), qsegment::qsegment(), lsegment::size(), and lsegment::~lsegment().
Definition at line 263 of file ssi_dsearch.hpp.
Referenced by dsearch::dsearch(), and dsearch::reduce().
Definition at line 266 of file ssi_dsearch.hpp.
Referenced by dsearch::dsearch(), and dsearch::~dsearch().
| double search_time |
Definition at line 259 of file ssi_dsearch.hpp.
| unsigned* sizes |
Definition at line 268 of file ssi_dsearch.hpp.
Referenced by dsearch::dsearch(), mmx::shape::selfintersection(), and dsearch::~dsearch().
| struct { ... } stats |
Definition at line 25 of file ssi_qsegment.hpp.
Referenced by qsegment::operator[](), qsegment::qsegment(), dsearch::search(), qsegment::size(), and qsegment::~qsegment().