POV-Ray : Newsgroups : povray.programming : "Clean" debugging : Re: "Clean" debugging Server Time
26 Oct 2025 17:40:29 EDT (-0400)
  Re: "Clean" debugging  
From: Bald Eagle
Date: 24 Oct 2025 09:30:00
Message: <web.68fb7f3046e6a89d7f81dbac25979125@news.povray.org>
"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

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