POV-Ray : Newsgroups : povray.bugreports : uv_mapping bug on cylinders : Re: uv_mapping bug on cylinders Server Time 2 Dec 2023 19:12:10 EST (-0500)
 Re: uv_mapping bug on cylinders
 From: Thomas de Groot Date: 4 Aug 2022 08:41:19 Message: <62ebbe6f\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#62ebbe6f%241%40news.povray.org",
"headline": "Re: uv_mapping bug on cylinders",
"dateCreated": "2022-08-04T12:41:19+00:00",
"datePublished": "2022-08-04T12:41:19+00:00",
"author": {
"@type": "Person",
"name": "Thomas de Groot"
}
}
Op 4-8-2022 om 12:36 schreef Bald Eagle:
> Thomas de Groot <tho### [at] degrootorg> wrote:
>> ...which reminds me to ask you (curiosity): how does
>>
>> #declare U = function (X, Y, Z) {(0.5 + atan2 (N(Z, X,Y,Z), N(X,
>> X,Y,Z))/(2*pi))}
>> #declare V = function (X, Y, Z) {(0.5 + asin(N(Y, X,Y,Z))/pi)}
>>
>> work? is puzzling, as far as atan2 and asin are concerned.
>>
>> --
>> Thomas
>
> I don't have the file accessible to me ATM, but IIRC, the N() function is
> probably just a select () for whichever vector component is specified as the
> first argument. (*)
>
> Then the atan2 returns an angle between -pi and pi, based on z and x.
> Dividing by tau gives values between -0.5 and 0.5, and then everything is
> shifted to between 0 and 1.
>
> asin returns an angle between -pi/2 and pi/2.
> Dividing by pi gives values between -0.5 and 0.5, and then everything is shifted
> to between 0 and 1.
>
>
> (*) And the way THAT works, is taking the specified vector components and doing
> something like x*(-1) + y*0 + z*(2).  That should give you a -1, a 0, or a 2
> depending on which cardinal vector is specified.
> select () then returns one of three scalar values depending on what component it
> spits out.
>

OK thanks. Sorry for diverting from the original post subject. I'll shut
up now. :-)

--
Thomas
```