POV-Ray : Newsgroups : povray.binaries.images : AABB reduction by Singular Value Decomposition : Re: AABB reduction by Singular Value Decomposition Server Time
19 Apr 2024 07:53:54 EDT (-0400)
  Re: AABB reduction by Singular Value Decomposition  
From: Bald Eagle
Date: 9 Apr 2021 06:45:00
Message: <web.60702fa3d8cfb0ef1f9dae3025979125@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:

> That FORTRAN spaghetti code looks like a little nightmare to rewrite in a
> structured way.

Most of it was a lot easier than I initially thought.
Almost every instance was just a piss poor way of doing what an #if - #else -
#end block would do.  So I just switched out the GOTOs with #ELSEs, and that
seemed to be what the intent was.
The GOTO 520 that jumped back in the code was trickier, but I used a #while, and
a flag that kept the #while loop going until the code exited by another route.

> I just had a quick look at FORTRAN 90 - and it seems like it could have
> been written in a much better way with the features available there.

Yep - but I suppose there was a lot of that in the "early days".
I think right now the thing that's going to be the biggest stumbling block is
the lack of comments in the code and my own abysmal ignorance of how SVD works
and the specific matrix operations that get performed.  And it would be a lot
easier to work through if there weren't so many different ways to go about it,
with various optimizations, etc.
Part of my rationale for choosing this specific code was that it was from a
stable and thoroughly tested "standard" code library, and the fact that it was
old and unoptimized ("elegant") likely meant that all of the operations would be
simple and readable and easier to follow and puzzle out the purpose.

But I could be wildly wrong about that. ;)


Made a few changes to see about fixing it - now it's wrong in a different,
better way.   :D


Post a reply to this message


Attachments:
Download 'svd.inc.txt' (26 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.