 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
So, I have had to include a lot of output to the debug stream to inspect values
passed into macros, compare results of macros to tests done in other macros, and
inspect the code flow so that I can see how the logic of various test results
get directed.
Doing
#if (Test)
#debug (something)
#end
clutters the code, is tedious, and if everything is spread out all across the
code, it is a nightmare to turn on and off.
So what I did was test for a Global_Debug identifier, and if defined, then I
enable the #debug statements.
I do that by creating a macro called Debug ()
Then everything gets wrapped in Debug ( ), sans the #debug statement.
Then it's just one line, can be kept in the code, is trivial to turn on and off,
and all of the #if () #end stuff is in a single tiny macro.
It's simple, and I suppose obvious, but just thought I'd include it here in case
anyone derives benefit from it.
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> So, I have had to include a lot of output to the debug stream to inspect values
> passed into macros, compare results of macros to tests done in other macros, and
> inspect the code flow so that I can see how the logic of various test results
> get directed.
>
> Doing
> #if (Test)
> #debug (something)
> #end
>
> clutters the code, is tedious, and if everything is spread out all across the
> code, it is a nightmare to turn on and off.
>
> So what I did was test for a Global_Debug identifier, and if defined, then I
> enable the #debug statements.
>
> I do that by creating a macro called Debug ()
>
> Then everything gets wrapped in Debug ( ), sans the #debug statement.
> Then it's just one line, can be kept in the code, is trivial to turn on and off,
> and all of the #if () #end stuff is in a single tiny macro.
>
> It's simple, and I suppose obvious, but just thought I'd include it here in case
> anyone derives benefit from it.
>
> - BE
How about using debug.inc? It has some of the stuff you talked about. I debug
everything and I normally don't delete a debug but comment it out(never know
when ya might need it again)
Have Fun!
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Leroy" <whe### [at] gmail com> wrote:
> How about using debug.inc? It has some of the stuff you talked about.
1. Because I haven't used that file in over a decade, and forgot about it.
2. Why do that when I can reinvent the wheel? :D
Thanks,
- BW
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> So, I have had to include a lot of output to the debug stream to inspect values
> passed into macros, compare results of macros to tests done in other macros, and
> inspect the code flow so that I can see how the logic of various test results
> get directed.
>
I've also been on the verge of writing a pseudo debug class for Povray several
times
If you want to output arrays into a file, you can give my function a chance.
See:
https://www.maetes.com/en/povray-os/ma_helpers#ma-outputarraystring
ma
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Maetes" <nomail@nomail> wrote:
> See:
> https://www.maetes.com/en/povray-os/ma_helpers#ma-outputarraystring
>
> ma
Hey - that's a really nice page with some useful stuff!
I especially like the look of that deprecated macro tool.
I will hopefully get a chance to look that over in depth at some point, and my
personal wish is that we get a lot of your ideas formally logged on the
newsgroup website or wiki in some way.
I would love to see more exposure of people's work like yours, and some
collaborative projects to develop equations, macros, and other tools to help
keep things moving forward, so that we can make coding scenes easier and more
efficient, identify and hopefully fix bugs, and create new features.
As a small thanks, try the inverse macro following you own, and let me know if
there are any problems.
#macro MA_Deg2Vector (RightAscension, Declination, mRadius)
#local mRect = radians(RightAscension + MA_Deg2Vector_RA_Offset);
#local Declination = radians(Declination);
//Here we have the critical lines
#local mPosX = mRadius * sin(Declination) * cos (mRect);
#local mPosY = mRadius * cos(Declination);
#local mPosZ = mRadius * sin(Declination) * sin (mRect);
#local mVector = <mPosX, mPosY * -1, mPosZ>;
mVector
#end
Inverse:
#declare MA_Deg2Vector_RA_Offset = 0; // Define this globally if not already
#macro MA_Vector2Deg(Vector)
#local x = Vector.x;
#local y = -Vector.y; // Invert Y to match original convention
#local z = Vector.z;
#local Radius = sqrt (x*x + y*y + z*z);
#local Declination = degrees (asin(z / Radius));
#local RA = degrees (atan2(x, y)) - MA_Deg2Vector_RA_Offset;
// Normalize RA to [0, 360)
#while (RA < 0)
#local RA = RA + 360;
#end
#while (RA >= 360)
#local RA = RA - 360;
#end
array[3] { RA, Declination, Radius }
#end
- BW
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |