POV-Ray : Newsgroups : povray.general : is PHASE working backwards? Server Time
26 Apr 2024 01:13:38 EDT (-0400)
  is PHASE working backwards? (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
From: Kenneth
Subject: Re: is PHASE working backwards?
Date: 12 Feb 2018 20:00:01
Message: <web.5a82378751e282aca47873e10@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
>
> But in the case of the radial pattern, "rotating the pigment by y*angle" is
> definitely opposite to  phase 90*clock*y -- they visually rotate in opposite
> directions.

I think my own confusion stems from a lack of clarity in the documentation. The
only clue of what to *visually* expect from 'phase' is the one sentence about
the radial pattern (comparing it to "rotate y*angle)-- which happens to be
wrong, apparently. I think the docs need something else-- perhaps another
'movement' example, or a small explanation of the movement as it relates to a
pattern's index list. Simply describing phase as "causing the map entries to be
shifted so that the map starts and ends at a different place" isn't quite
detailed enough.


Post a reply to this message

From: Bald Eagle
Subject: Re: is PHASE working backwards?
Date: 12 Feb 2018 21:45:01
Message: <web.5a82501c51e282ac5cafe28e0@news.povray.org>
I think that I'd expect the shift to occur in the opposite direction as well.

It seems to be rotating the pattern in the counterclockwise direction.
It would handy to know that phase is in radians instead of degrees as well.

Try this code - it makes 36 cylinders with pattern rotations of 5 degrees each
step, left to right, top to bottom.

//------------
#version 3.71;

global_settings {assumed_gamma 1.0}

#declare W = image_width;
#declare H = image_height;

#declare Zoom = 1;
camera {
  orthographic
  location <W/2, -H/2, -10>    // position & direction of view
  look_at  <W/2, -H/2,   0>
  right 1*x*image_width/Zoom            // horizontal size of view
  up 1*y*image_height/Zoom               // vertical size of view
}



#for (Y, 0, 5)
 #for (X, 0, 5)
  cylinder { <0, -1, 0>, <0, 0, 0>, min (W/14, H/14)
   texture {
    pigment {
     radial
     frequency 1
     phase radians(Y*5+X)
     color_map {
      [0.5 srgb <248, 196, 121>/255]
      [0.5 rgb 1]
     }
    }
    finish {ambient 0 emission 1 diffuse 0}
   }
   rotate -x*90
   translate <(W/12+X*W/6), -(Y*H/6+H/12), 0>
  }
 #end
#end


Post a reply to this message

From: clipka
Subject: Re: is PHASE working backwards?
Date: 13 Feb 2018 02:00:16
Message: <5a828d00@news.povray.org>
Am 13.02.2018 um 03:40 schrieb Bald Eagle:

> It seems to be rotating the pattern in the counterclockwise direction.
> It would handy to know that phase is in radians instead of degrees as well.

That's only true for the radial pattern, and AFAIK only for unit frequency.

In other patterns, phase has entirely different effects; for instance,
in a gradient pattern it effectively just translates the pattern. No
radians nor degrees there.


Post a reply to this message

From: Bald Eagle
Subject: Re: is PHASE working backwards?
Date: 13 Feb 2018 06:30:00
Message: <web.5a82cc1f51e282ac5cafe28e0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 13.02.2018 um 03:40 schrieb Bald Eagle:
>
> > It seems to be rotating the pattern in the counterclockwise direction.
> > It would handy to know that phase is in radians instead of degrees as well.
>
> That's only true for the radial pattern, and AFAIK only for unit frequency.
>
> In other patterns, phase has entirely different effects; for instance,
> in a gradient pattern it effectively just translates the pattern. No
> radians nor degrees there.

Well, I have a habit of thinking about it like this:
http://mpec.sc.mahidol.ac.th/radok/physmath/MAT1/mor123.jpg

So once it's "unrolled", then rotation in degrees becomes offset in translation.
 pi radians would be 3.14.... scalar.

Not sure if that's how it's handled by POV-Ray internally, but that should be
easy to test and document the magnitude and direction of the shift.


Post a reply to this message

From: Jim Holsenback
Subject: Re: is PHASE working backwards?
Date: 13 Feb 2018 07:18:56
Message: <5a82d7b0$1@news.povray.org>
On 2/12/2018 7:55 PM, Kenneth wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
>>
>> But in the case of the radial pattern, "rotating the pigment by y*angle" is
>> definitely opposite to  phase 90*clock*y -- they visually rotate in opposite
>> directions.
> 
> I think my own confusion stems from a lack of clarity in the documentation. The
> only clue of what to *visually* expect from 'phase' is the one sentence about
> the radial pattern (comparing it to "rotate y*angle)-- which happens to be
> wrong, apparently. I think the docs need something else-- perhaps another
> 'movement' example, or a small explanation of the movement as it relates to a
> pattern's index list. Simply describing phase as "causing the map entries to be
> shifted so that the map starts and ends at a different place" isn't quite
> detailed enough.

sounds like you're volunteering...come up with an additional usage 
example and brief description of what's going on and i'll add it to my 
todo list


Post a reply to this message

From: Kenneth
Subject: Re: is PHASE working backwards?
Date: 13 Feb 2018 17:05:00
Message: <web.5a83600c51e282aca47873e10@news.povray.org>
Jim Holsenback <spa### [at] nothanksnet> wrote:
> On 2/12/2018 7:55 PM, Kenneth wrote:
>
> > I think the docs need something else-- perhaps another
> > 'movement' example, or a small explanation of the movement as it relates to a
> > pattern's index list...
>
> sounds like you're volunteering...come up with an additional usage
> example and brief description of what's going on and i'll add it to my
> todo list

Thanks! It's going to be an interesting challenge; I'll give it a try.

At this point, I'll assume that phase *is* operating correctly (but that the
radial pattern example is wrong.) Barring any last-minute brainstorms in this
newsgroup thread about the reverse being true, I'll go with that assumption.


Post a reply to this message

From: Bald Eagle
Subject: Re: is PHASE working backwards?
Date: 13 Feb 2018 18:50:01
Message: <web.5a83790c51e282ac5cafe28e0@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> At this point, I'll assume that phase *is* operating correctly (but that the
> radial pattern example is wrong.) Barring any last-minute brainstorms in this
> newsgroup thread about the reverse being true, I'll go with that assumption.

I made boxes with a frequency of 1/pi, and did the same 5-degree phase shift per
box.  It gives you the same "backwards" shift,
BUT
if you think about what sin(x+_phase) would give you as you increase _phase,
then I suppose it makes sense...


//------------
#version 3.71;

global_settings {assumed_gamma 1.0}

#declare W = image_width;
#declare H = image_height;

#declare Zoom = 1;
camera {
  orthographic
  location <W/2, -H/2, -10>    // position & direction of view
  look_at  <W/2, -H/2,   0>
  right 1*x*image_width/Zoom            // horizontal size of view
  up 1*y*image_height/Zoom               // vertical size of view
}


// 0 for radial, 1 for translation

#declare N = 1;

#switch (N)

#case (0)

#for (Y, 0, 5)
 #for (X, 0, 5)
  cylinder { <0, -1, 0>, <0, 0, 0>, min (W/14, H/14)
   texture {
    pigment {
     radial
     frequency 1
     phase radians(Y*5+X)
     color_map {
      [0.5 srgb <248, 196, 121>/255]
      [0.5 rgb 1]
     }
    }
    finish {ambient 0 emission 1 diffuse 0}
   }
   rotate -x*90
   translate <(W/12+X*W/6), -(Y*H/6+H/12), 0>
  }
 #end
#end
#break

#case (1)
#for (Y, 0, 5)
 #for (X, 0, 5)
  box { <1, 1, 1>*-1, <1, 1, 1>
   texture {
    pigment {
     gradient x
     frequency 1/pi
     phase radians(Y*5+X)
     color_map {
      [0.5 rgb <1, 0, 0>]
      [0.5 rgb 1]
     }
    }
    finish {ambient 0 emission 1 diffuse 0}
   }
   scale min (W/14, H/14)
   translate <(W/12+X*W/6), -(Y*H/6+H/12), 0>
  }
 #end
#end
#break

#else
// Do nothing
#end // end switch - case/range - break


Post a reply to this message

From: Alain
Subject: Re: is PHASE working backwards?
Date: 13 Feb 2018 19:16:46
Message: <5a837fee$1@news.povray.org>
Le 18-02-13 à 06:29, Bald Eagle a écrit :
> clipka <ano### [at] anonymousorg> wrote:
>> Am 13.02.2018 um 03:40 schrieb Bald Eagle:
>>
>>> It seems to be rotating the pattern in the counterclockwise direction.
>>> It would handy to know that phase is in radians instead of degrees as well.
>>
>> That's only true for the radial pattern, and AFAIK only for unit frequency.
>>
>> In other patterns, phase has entirely different effects; for instance,
>> in a gradient pattern it effectively just translates the pattern. No
>> radians nor degrees there.
> 
> Well, I have a habit of thinking about it like this:
> http://mpec.sc.mahidol.ac.th/radok/physmath/MAT1/mor123.jpg
> 
> So once it's "unrolled", then rotation in degrees becomes offset in translation.
>   pi radians would be 3.14.... scalar.
> 
> Not sure if that's how it's handled by POV-Ray internally, but that should be
> easy to test and document the magnitude and direction of the shift.
> 
> 
> 

If phase goes from 0 to 1...
With radial and frequency 1, it mean a full rotation
With radial and frequency 10, that's 1/10th of a rotation.
With onion or wood, it's a shift of 1 pattern period outward.
With gradient, it's like translating the pattern.
If you use bozo, granite, crackle or agate, things get a little strange.


Post a reply to this message

From: Kenneth
Subject: Re: is PHASE working backwards?
Date: 13 Feb 2018 21:20:01
Message: <web.5a839b5951e282aca47873e10@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

>
> I made boxes with a frequency of 1/pi, and did the same 5-degree phase shift per
> box.  It gives you the same "backwards" shift,
> BUT
> if you think about what sin(x+_phase) would give you as you increase _phase,
> then I suppose it makes sense...
>

The general *meaning* of 'phase' (or rather, which 'direction' is meant by a
'phase shift') is somewhat difficult to grasp, for me-- how to describe whether
a phase shift is in the positive or negative direction. It's kind of relative to
the initial position of the waveform.

I looked up 'phase' in Wikipedia, and even that overall description isn't quite
clear to me. In the following excerpt, I'll substitute 'P' for the phase symbol
(or phase shift-- it's not clear)...

"Phase shift is...the phase difference between two or more quantities.

The symbol P is sometimes referred to as a phase shift or phase offset because
it represents a 'shift' from zero phase.

For infinitely long sinusoids, a change in P is the same as a shift in time,
SUCH AS A TIME DELAY. If x(t) is delayed (time-shifted) by 1/4 of its cycle
[DELAYED in time], it becomes:
    --- some mathematical jargon---
whose 'phase' is now P - pi/2."

I.e., that's a *negative* phase shift-- which would seem to correspond to
POV-Ray's concept of, say, phase 0.25 or whatever-- POV's 'positive' phase
change, but one which shifts the waveform itself in the negative direction.

But the accompanying diagram in that block of text shows the original waveform
in red, and the shifted waveform in blue-- and the blue one is shifted FORWARD
in time-- which looks like the opposite of 'P - pi/2'.  What a brain-twister!


Post a reply to this message

From: Bald Eagle
Subject: Re: is PHASE working backwards?
Date: 13 Feb 2018 21:40:01
Message: <web.5a83a15151e282ac5cafe28e0@news.povray.org>
I think this would clarify it best:

"...the initial angle of a sinusoidal function at its origin and is sometimes
called phase offset or phase difference."

https://en.wikipedia.org/wiki/Phase_(waves)

"What's the frequency, Kenneth?"

// set phasers to STUN


Post a reply to this message

<<< Previous 4 Messages Goto Initial 10 Messages

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