|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> "Maetes" <nomail@nomail> wrote:
>
> > See:
> > https://www.maetes.com/en/povray-os/ma_helpers#ma-outputarraystring
> Hey - that's a really nice page with some useful stuff!
Tanks for that!
Since I have no idea if anyone uses my scripts at all, I have neglected new
releases for the last months. Halfway completing the code, documenting it
and presenting it on a page takes an enormous amount of time.
> 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.
These could be my words. Maybe we will manage to exchange ideas better in the
future.
> As a small thanks, try the inverse macro following you own, and let me know if
> there are any problems.
Tanks, but unfortunately it crashes in the first line. After I fixed it, the
result wasnt as expected. I tried more than an hour, without success.
I will give it somewhen later anoter try.
The first and last output should be the same.
*** MA => Deg2Vector-Input: 100.000000,-50.000000,333.000000
*** MA => Deg2Vector-Result: 251.217,-214.048,44.296,0.000,0.000
*** MA => Vector2Deg-Result: 49.567539,7.644270,333.000000
Code:
--------
#local mRA = 100;
#local mDE = -50;
#local mRadius = 333;
MA_Terminal_AF("Deg2Vector-Input", array[3] { mRA, mDE, mRadius})
#local vResult = MA_Deg2Vector00 ( mRA, mDE, mRadius );
MA_Terminal_V("Deg2Vector-Result", vResult)
#local aResult = MA_Vector2Deg(vResult);
MA_Terminal_AF("Vector2Deg-Result", aResult)
Macro:
--------
#declare MA_Deg2Vector_RA_Offset = 0; // Define this globally if not already
#macro MA_Vector2Deg(mVector)
#local mX = mVector.x;
#local mY = -mVector.y; // Invert Y to match original convention
#local mZ = mVector.z;
#local Radius = sqrt (mX*mX + mY*mY + mZ*mZ);
#local Declination = degrees (asin(mZ / Radius));
#local RA = degrees (atan2(mX, mY)) - 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
ma
Post a reply to this message
|
 |