class initialization problem
rantingrick at gmail.com
Fri Sep 18 08:12:46 CEST 2009
copy.copy did work in a simple python interactive session, but it
caused infinite recursion in my real world code? Anyway what ever is
going on (probably lack of sleep!) the cure all was using an arg in
the initial function. So now i am good as gold ;-)
WHY did i need do this you may ask?
I am creating geometry with OpenGL. When you create a face you must
specify a winding order (clockwise or counter clockwise) this winding
order controls which side of the face will be visible (since only one
side of a face is rendered). So to create a two sided face you must
create two faces that share the exact same points, BUT have opposite
windings, hence the need to create a face with a "backface" attribute
that contains the mirrored face instance. So now i can move the
frontface around and i have a handy reference to the backface so i can
make it follow!
def __init__(self, pts, nested=True):
newpts = reverse(pts)
self.backface = Face(pts, nested=False)
def translate(self, v):
#offset front and back face by vector
two sided faces, yippie!
And so ends another long day of coding. This is addicting. Does
anybody know of a good Coders Anonymous group, i think i may have an
addiction. 16 hours of strait coding with 4hrs sleep last night and
only stopping for one meal (lunch) still have not ate dinner yet!
More information about the Python-list