[vtkusers] Sort unordered set of points clockwise (orcounter-clockwise)

Adriano Gagliardi agagliardi at ara.co.uk
Mon Aug 1 04:22:22 EDT 2011


There is a class in ParaView that will do this for you, but unfortunately it
is not available in VTK yet. However, it has been flagged up in Mantis.
 
I've done something similar as you want, but I managed to obtain
connectivity information first by using extracting feature edges. I then
order the points in clockwise fashion by doing a simple loop around each
feature edge (or vtkLine), which would then loop around the rest of the
edges looking for a common point. This worked for me in the end although for
a very large number of points it will get slow. The other option is to come
up with a scalar value that gives you the correct ordering of the points and
then sort the points based on it (something like value = sqrt(x*x +
y*y)*(value for direction). Otherwise, I'd check out vtkPlotEdges in the
ParaView distribution and see if you can integrate it into VTK yourself.
 
Cheers,
Adriano

===================================

Adriano Gagliardi MEng PhD
Business Sector Leader
Computational Aerodynamics
Aircraft Research Association Ltd.
Manton Lane
Bedford

Tel: 01234 32 4644
E-mail: agagliardi at ara.co.uk
Url: www.ara.co.uk 

 

  _____  

From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Miguel Sotaquirá
Sent: 30 July 2011 04:14
To: vtkusers at vtk.org
Subject: [vtkusers] Sort unordered set of points clockwise
(orcounter-clockwise)


Hi, 

In 3-D space I have an unordered set of, say, 6 points; something like this:

               (A)*
                              (C)*
(E)*
                             (F)*
         (B)*

                      (D)*

The points form a 3-D contour but they are unordered. For unordered I mean
that they are stored in a vtkIdList = [A - B - C - D - E - F]. I just want
to reorganize this list starting from an arbitrary location (let's say point
A) and traversing the points clockwise or counter-clockwise. Something like
this:

orderedList = [A - E - B - D - F - C]
or
orderedList = [A - C - F - D - B - E]

I'm trying to implement an algorithm as simple as possible, since the set of
points in mention corresponds to a N-ring neighborhood of each vertex on a
mesh of ~420000 points, and I have to do this for each point on the mesh.

How can I do this in VTK?

Thanks,
Miguel

**********************************************************************
This email contains information that is private and confidential and is intended only for the addressee.
If you are not the intended recipient please delete it and notify us immediately by e-mailing the sender.
Note: All email sent to or from this address may be accessed by someone other than the recipient, for
system management and security reasons.
Aircraft Research Association Ltd.  Registered in England, Registration No 503668 Registered Office:
Manton Lane, Bedford MK41 7PF England VAT No GB 196351245

**********************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110801/92b8c899/attachment.htm>


More information about the vtkusers mailing list