[Tutor] OO triangulation

bhaaluu bhaaluu at gmail.com
Thu Sep 20 14:25:34 CEST 2007


Greetings,

I'm running Python 2.4 on a GNU/Linux system.
Actually, I was able to get this code to work after only a few
edits that had to do with line wrap, nothing more. The code
works fine, and although I don't understand what it is displaying,
the display is rather interesting. On my 1GHz CPU, the 100 point
retriangularization takes 0.29 seconds. The 1000 point retriangulation
takes 4.62 seconds, and the 10000 pointer takes 99.04 seconds.
The display looks like a bad spider web! =)

Retriangulate!
-- 
bhaaluu at gmail dot com

On 9/20/07, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> János Juhász wrote:
> > Dear Tutors,
> >
> > I made an OO style triangulation based on an old C progam I made about 10
> > years ago.
> > The sample is working finally.
> > First time I made the triangulation with recursion, but I reached the
> > recursion limit very shortly.
> > So I changed the recursion to a queue.
> >
> > I am interested about your opinions about the OO style.
> > It hasn't got too much comments, but probably readable.
> > [snip some code]
> >
> >     def Swap(self, C):                          ##           Ta2  Ta2
> >         """ Swap a triangle pair """            ##         /    \       /
> >  \
> >         D  = self.NextPoint(C)                  ##       /  a2   \     /
> > a2  \
> >         A  = self.PrevPoint(C)                  ##      A---------B
> > A---------B
> >         t2 = self.BottomTriangle(C)             ##    / | \       | \  / |
> >       / | \
> >         B  = t2.NextPoint(D)                    ##    a1|   \ t2  | a1
> > |self /   |
> >         a1 = self.BottomTriangle(D)             ##      |self \   | d2  |
> > / t2  | d2
> >         d1 = self.BottomTriangle(A)             ##    \ |       \ | /  \ |
> > /       | /
> >         a2 = t2.BottomTriangle(D)               ##      C---------D
> > C---------D
> >         d2 = t2.BottomTriangle(A)               ##       \   d1  /     \
> > d1  /
> >         Ta2 = a2.NextPoint(B)                   ##        \     /      \
> > /
> >         Td1 = d1.NextPoint(C)                   ##          Td1        Td1
> >
> As you can see, your code is not very readable.
> Please post large sections of code as attachments in the future.
> This is probably the main reason you've gotten no replies.
> -Luke
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list