Daniele Bonetta wrote:
> Thanks all.
>
> Paolo,
> i've used the unifGrid exactly as it is used in the sampling plugin,
> and it seems
> to be better than "my" previous usage of that component.
>
> But...but i'm still having a doubt: in some (rare) cases, the
> getClosest function gives me back
> as closest point (result) a point that isn't over the mesh's surface.
> It happens expecially when
> the closest point over the surface is very far from the starting query point.
>
> Is this fact related in some ways to the two "distance" values passed
> to the function?
> (it seems to be so, but i'm not sure at all because in some (more
> rarely) cases even
> changing these values nothing changes)
>
>
Yes, the distance passed in the getClosest is a bailout value that is
used to stop the search for a closest point if nothing is found within
the specified distance.
This is important to prevent lenghty traversal of the empty uniform grid
cells
In that case the returned face pointer should be null.
cheers
p.
> Thanks in advance.
> D.
>
>
>
> On Tue, Aug 5, 2008 at 9:11 AM, Paolo Cignoni <pao...@is...> wrote:
>
>> For the use of the UniformGrid inside meshlab you should look at the
>> filter_sampling plugin
>> the RedetailSampler class uses a UG to find the closest point for a given
>> query point.
>> UG initialization is done in the RedetailSampler::init and the query
>> procedure that uses GetClosestFace is inside RedetailSampler::AddVert
>>
>> The basic meshlab mesh type has not the EdgePlane component
>> so you should resort to the (slightly) slower mechanism.
>>
>> p.
>>
>>
>>
>>
>> fabio ganovelli wrote:
>>
>> Hi,
>> you can use the GetClosestFace function in vcg/trimesh/closest.h.
>>
>> Include vcg::face::EdgePlane as component of your face type and call
>> vcg::UpdateEdge<MeshModel>::Set(..) which sets the values of EdgePlane
>> for each face.
>> If you don't do this, there quantities will be computed on demand
>> (multiple times) and your code will
>> be considerably slower.
>>
>> Look at the project apps/metro/ (file sampling.h) to see a complete example.
>>
>> cheers,
>> Fabio
>>
>>
>>
>>
>> Hi all,
>>
>> i've started working on the "re-topology" plugin (just committed a
>> *very* initial version),
>> and i've got a question on how to use (correctly) the Uniform Grid object.
>>
>> My goal is to get the closest point of a mesh from a given spatial
>> coord (not a vertex of
>> the mesh structure, just a free point over its surface),
>> and then use that point to build the retopologized mesh.
>>
>> In order to do this, i've looked for some spatial indexing structures,
>> and found the
>> one that is called "GridStaticPtr", whitch seems to be exaclty what i
>> needed.
>>
>>
>> So, once initialized the Grid object ("unifGrid"):
>>
>>
>> meshModel->updateDataMask(MeshModel::MM_FACEMARK);
>> unifGrid.Set(mesh->face.begin(), mesh->face.end());
>> markerFunctor.SetMesh(mesh);
>>
>>
>> i use this code to get the closest point:
>>
>>
>> float dist_upper_bound =mesh->bbox.Diag()/50;
>> float dist = dist_upper_bound;
>> const CMeshO::CoordType &startPt= toCheck;
>>
>> CMeshO::FaceType *nearestF=0;
>> vcg::face::PointDistanceBaseFunctor PDistFunct;
>>
>> nearestF = unifGrid.GetClosest(PDistFunct, markerFunctor, startPt,
>> dist_upper_bound, dist, closestPt);
>>
>>
>> Here i expect to get in "closestPt" the mesh surface point nearest to
>> "startPt", but this does
>> not happen for every starting point passed (expecially on hi-res meshes, the
>> returned point is not just the nonclosest, but it's also not a point
>> of the mesh).
>>
>>
>> Well, my question is: am i using "unifGrid" correctly?
>> And, if not, any suggestion on how to get the closest mesh point from
>> a given coord (using uniform grid or something else)?
>>
>> Tanks in advance,
>> D.
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Meshlab-devel mailing list
>> Mes...@li...
>> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>>
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Meshlab-devel mailing list
>> Mes...@li...
>> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>>
>>
>>
>> --
>> Paolo Cignoni -- Senior Researcher
>> Visual Computing Laboratory - ISTI - CNR
>> http://vcg.isti.cnr.it/~cignoni
>>
>> ISTI - CNR
>> Via Moruzzi 1,
>> 56124 Pisa
>> ITALY
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Meshlab-devel mailing list
>> Mes...@li...
>> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>>
>>
>>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Meshlab-devel mailing list
> Mes...@li...
> https://lists.sourceforge.net/lists/listinfo/meshlab-devel
>
>
--
Paolo Cignoni -- Senior Researcher
Visual Computing Laboratory - ISTI - CNR
http://vcg.isti.cnr.it/~cignoni
ISTI - CNR
Via Moruzzi 1,
56124 Pisa
ITALY
|