My script is taking 12 hours+ any suggestions?

Jiba jiba at tuxfamily.org
Mon Sep 1 04:09:23 CEST 2003


On Sat, 30 Aug 2003 13:08:24 -0400
Ideasman <cpbarton at pacific.net.au> wrote:

> Hi I have a made a script that process normals for a flat shaded 3D mesh's.
> It compares every vert with every other vert to look for verts that can 
> share normals and It takes ages.

I'm doing similar 3D location (X, Y, Z) comparisons... You can make it MUCH MUCH faster if you use dicts insteed of comparison : use the (X, Y, Z) tuple as key and a list of point sharing the normal as value.

Obviously this will work ONLY if the point have exactely the same normal.

If not, the solution is to use a rounded normal as key. E.g. use 'round(x * 100.0) / 100.0' instead of x for an (approximative) 0.01 precision, and proceed similarly with y and z.

Jiba





More information about the Python-list mailing list