0

I have a cloud of 3D points ("colors.csv") and a code that generates its convex hull:

#loading cloud of points

points = np.array([(XYZRGB(rank, name, X, Y, Z))
                  for rank, name, X, Y, Z in csv.reader(open('colors.csv'))])
#doing geometry

hull = points[tri.convex_hull]

print hull

with print hull i get a series of triangles defined by 3 points:

 [[['5' 'PINKwB' '74.62792193' ..., '239' '212' '240']
  ['15' 'TUwC' '74.43151414' ..., '208' '242' '247']
  ['25' 'OR0B' '80.01931102' ..., '255' '215' '190']]

 ..., 
 [['29' 'gY6B' '9.473696537' ..., '32' '134' '39']
  ['16' 'K2M' '13.46800615' ..., '150' '30' '46']
  ['31' 'gY6D' '35.53944758' ..., '176' '187' '0']]]

Each point is a color, defined by a rank, a name, XYZ coordinates in 3D space and RGB color.

I would like to create a 2D map (a diagram) representing the relations between the vertices of the triangles. For example, I would start with the first triangle of the list, plot its 3 points, draw its edges, then add a further point to draw a second triangle, etc. Until I plot the last point.

I don't care the real distances between the points, I just want a map representing real connexions between them. Is there any standard way to do this?

thanks

adrienlucca.net
  • 677
  • 2
  • 10
  • 26
  • Just an idea, but since you have the hull you can select any triangle of the hull and designate its vertices as the **exterior** vertices of large 2D triangle that contains all of the remaining vertices. Then use BFS on each of the exterior vertices simultaneously to fill in the middle. – beaker Jun 04 '14 at 16:37
  • Sorry, I meant [Breadth First Search](http://en.wikipedia.org/wiki/Breadth_first_search). Also, you don't necessarily have to stop at a triangle. You can use two (or more) triangles as the "outside" of the 2D figure as long as you remember to include the edge between them. So for two triangles with two common vertices you could draw a square with one diagonal. – beaker Jun 04 '14 at 16:47
  • 1
    By the way, what you're trying to do is a planar graph embedding, if you need some search terms. – beaker Jun 04 '14 at 16:55

0 Answers0