POV-Ray : Newsgroups : povray.general : recursively defined objects and memory Server Time
29 Jul 2024 08:12:31 EDT (-0400)
  recursively defined objects and memory (Message 24 to 33 of 43)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: clipka
Subject: Re: recursively defined objects and memory
Date: 18 Aug 2013 18:35:14
Message: <52114c22$1@news.povray.org>
Am 19.08.2013 00:01, schrieb Ger Remmers:
> On 08/18/2013 04:48 PM, clipka wrote:
>> Am 18.08.2013 23:08, schrieb Ger Remmers:
>>
>>> (*) Povray seems to have a problem with very large arrays. I  can go as
>>> high as 800K nodes, after that the last position in the array seems to
>>> get corrupted.
>>
>> Obviously that shouldn't happen. Can you provide a sample scene to
>> reproduce, dissect and debug the problem?
>>
>
> It messes up in the WriteDataFile() macro

Thanks, I'll have a closer look at it.


Post a reply to this message

From: scott
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 08:55:41
Message: <521215cd$1@news.povray.org>
>    #declare Cut = object { CuttingPlane translate y * Displacement
> rotate <AngleX, AngleY, AngleZ> };

...

>    #declare PlaneAngleX = rand(RandAngle) * 360;
>    #declare PlaneAngleY = rand(RandAngle) * 360;
>    #declare PlaneAngleZ = rand(RandAngle) * 360;

On a separate note, are you sure that method of choosing the plane 
orientation gives a uniform random distribution...?


Post a reply to this message

From: clipka
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 10:47:15
Message: <52122ff3@news.povray.org>
Am 19.08.2013 14:55, schrieb scott:
>>    #declare Cut = object { CuttingPlane translate y * Displacement
>> rotate <AngleX, AngleY, AngleZ> };
>
> ....
>
>>    #declare PlaneAngleX = rand(RandAngle) * 360;
>>    #declare PlaneAngleY = rand(RandAngle) * 360;
>>    #declare PlaneAngleZ = rand(RandAngle) * 360;
>
> On a separate note, are you sure that method of choosing the plane
> orientation gives a uniform random distribution...?

#declare Cut = object { CuttingPlane translate 
VRand_On_Sphere(RandAngle) * Displacement };

should do the trick.


Post a reply to this message

From: Ger
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 11:34:05
Message: <52123aed$1@news.povray.org>
On 08/19/2013 07:55 AM, scott wrote:
>>    #declare Cut = object { CuttingPlane translate y * Displacement
>> rotate <AngleX, AngleY, AngleZ> };
>
> ....
>
>>    #declare PlaneAngleX = rand(RandAngle) * 360;
>>    #declare PlaneAngleY = rand(RandAngle) * 360;
>>    #declare PlaneAngleZ = rand(RandAngle) * 360;
>
> On a separate note, are you sure that method of choosing the plane
> orientation gives a uniform random distribution...?
>

No, it does not, but doing it this way gives a better result than using 
a single rand() for the plane orientation.

-- 
Cheers
Ger


Post a reply to this message

From: Ger
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 11:38:23
Message: <52123bef$1@news.povray.org>
On 08/19/2013 09:47 AM, clipka wrote:
> Am 19.08.2013 14:55, schrieb scott:
>>>    #declare Cut = object { CuttingPlane translate y * Displacement
>>> rotate <AngleX, AngleY, AngleZ> };
>>
>> ....
>>
>>>    #declare PlaneAngleX = rand(RandAngle) * 360;
>>>    #declare PlaneAngleY = rand(RandAngle) * 360;
>>>    #declare PlaneAngleZ = rand(RandAngle) * 360;
>>
>> On a separate note, are you sure that method of choosing the plane
>> orientation gives a uniform random distribution...?
>
> #declare Cut = object { CuttingPlane translate
> VRand_On_Sphere(RandAngle) * Displacement };
>
> should do the trick.
>
Using 3 separate rand()'s gave me a better result than a single rand(), 
but by no means uniform. But then again, that was not the problem I was 
trying to solve :)

-- 
Cheers
Ger


Post a reply to this message

From: Warp
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 11:51:52
Message: <52123f18@news.povray.org>
Ger <ger### [at] nospamthankyou> wrote:
> >>    #declare PlaneAngleX = rand(RandAngle) * 360;
> >>    #declare PlaneAngleY = rand(RandAngle) * 360;
> >>    #declare PlaneAngleZ = rand(RandAngle) * 360;
> >
> > On a separate note, are you sure that method of choosing the plane
> > orientation gives a uniform random distribution...?

> No, it does not, but doing it this way gives a better result than using 
> a single rand() for the plane orientation.

Better in what way?

-- 
                                                          - Warp


Post a reply to this message

From: Ger
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 12:04:48
Message: <52124220$1@news.povray.org>
On 08/19/2013 10:51 AM, Warp wrote:
> Ger <ger### [at] nospamthankyou> wrote:
>>>>     #declare PlaneAngleX = rand(RandAngle) * 360;
>>>>     #declare PlaneAngleY = rand(RandAngle) * 360;
>>>>     #declare PlaneAngleZ = rand(RandAngle) * 360;
>>>
>>> On a separate note, are you sure that method of choosing the plane
>>> orientation gives a uniform random distribution...?
>
>> No, it does not, but doing it this way gives a better result than using
>> a single rand() for the plane orientation.
>
> Better in what way?
>
More uniform, but in all honesty, that was not the first thing I was 
paying attention to. I'll run a single vs triple rand() test case later.

-- 
Cheers
Ger


Post a reply to this message

From: Anthony D  Baye
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 14:55:01
Message: <web.521269c9e896405b328783aa0@news.povray.org>
Ger <ger### [at] NoSpamthankyou> wrote:
> On 08/19/2013 10:51 AM, Warp wrote:
> > Ger <ger### [at] nospamthankyou> wrote:
> >>>>     #declare PlaneAngleX = rand(RandAngle) * 360;
> >>>>     #declare PlaneAngleY = rand(RandAngle) * 360;
> >>>>     #declare PlaneAngleZ = rand(RandAngle) * 360;
> >>>
> >>> On a separate note, are you sure that method of choosing the plane
> >>> orientation gives a uniform random distribution...?
> >
> >> No, it does not, but doing it this way gives a better result than using
> >> a single rand() for the plane orientation.
> >
> > Better in what way?
> >
> More uniform, but in all honesty, that was not the first thing I was
> paying attention to. I'll run a single vs triple rand() test case later.
>
> --
> Cheers
> Ger

My method was to choose random Phi and Theta for spherical coordinates:

#for(I, 0, 30, 1)
#local Phi = Rand_Gauss(0.0, 0.33, RdmA)*180;
#local Theta = Rand_Gauss(0.0, 0.33, RdmB)*180;
intersection {
    sphere { 0.0, 3.0 }
    plane { <sin(Phi)*cos(Theta), sin(Phi)*sin(Theta), cos(Phi)>, 0 }
        pigment { White }
        translate <-15*6 + I*6, 0, 0>
    }
#end

if you want to avoid the flaw with hemispherical slices, then you also need a
random offset:

#for(I, 0, 30, 1)
#local Phi = Rand_Gauss(0.0, 0.33, RdmA)*180;
#local Theta = Rand_Gauss(0.0, 0.33, RdmB)*180;
#local Offset = Rand_Gauss(0.0, 0.33, RdmC)*3.0;
intersection {
    sphere { 0.0, 3.0 }
    plane { <sin(Phi)*cos(Theta), sin(Phi)*sin(Theta), cos(Phi)>, Offset }
        pigment { White }
        translate <-15*6 + I*6, 0, 0>
    }
#end

and in a test scene:

#include "kolors.inc"
#include "rand.inc"

light_source {
    0*x
    color rgb 1
    translate <15, 30, -60>
}
camera {
    perspective
    location <3, 5, -60>
    up y
    right x*(image_width/image_height)
    look_at 0
}


#for(I, 0, 30, 1)
#local Phi = Rand_Gauss(0.0, 0.33, RdmA)*180;
#local Theta = Rand_Gauss(0.0, 0.33, RdmB)*180;
#local Offset = Rand_Gauss(0.0, 0.33, RdmC)*3.0;
intersection {
    sphere { 0.0, 3.0 }
    plane { <sin(Phi)*cos(Theta), sin(Phi)*sin(Theta), cos(Phi)>, Offset }
        pigment { White }
        translate <-15*6 + I*6, 0, 0>
    }
#end

Now, obviously, the CSG method isn't going to work because of memory
constraints. but you can easily use this method to generate your plane, and then
take the dot-product like so:

#declare Normal = <sin(Phi)*cos(Theta), sin(Phi)*sin(Theta), cos(Phi)>
#declare Mag = Rand_Gauss(0.0, 0.33, RdmC)*BaseRad;

vdot(Mag*Normal, CurrVertex - Mag*Normal)

At least, I think that should work...

Then scale the vertex coordinates based on whether the dot product is positive
or negative.

Regards,
A.D.B.


Post a reply to this message

From: Anthony D  Baye
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 15:05:01
Message: <web.52126c17e896405b328783aa0@news.povray.org>
Ger <ger### [at] NoSpamthankyou> wrote:
> On 08/19/2013 10:51 AM, Warp wrote:
> > Ger <ger### [at] nospamthankyou> wrote:
> >>>>     #declare PlaneAngleX = rand(RandAngle) * 360;
> >>>>     #declare PlaneAngleY = rand(RandAngle) * 360;
> >>>>     #declare PlaneAngleZ = rand(RandAngle) * 360;
> >>>
> >>> On a separate note, are you sure that method of choosing the plane
> >>> orientation gives a uniform random distribution...?
> >
> >> No, it does not, but doing it this way gives a better result than using
> >> a single rand() for the plane orientation.
> >
> > Better in what way?
> >
> More uniform, but in all honesty, that was not the first thing I was
> paying attention to. I'll run a single vs triple rand() test case later.
>
> --
> Cheers
> Ger

I think I may have spotted the reason why your planet is so turbulent.

You seem to be generating a new displacement for each point in the sphere
individually rather than displacing all the points on one side of the plane by
the same amount.

you should have your displacement macro generate two scaling factors before
iterating through the points: One factor for the positive side of the plane, and
one for the negative side.

Regards,
A.D.B.


Post a reply to this message

From: Anthony D  Baye
Subject: Re: recursively defined objects and memory
Date: 19 Aug 2013 15:10:01
Message: <web.52126d77e896405b328783aa0@news.povray.org>
A slight correction:

#local Phi = Rand_Gauss(0.0, 0.33, RdmA)*pi;
#local Theta = Rand_Gauss(0.0, 0.33, RdmB)*pi;

Times like this, I really wish we could edit posts...

Regards,
A.D.B.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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