POV-Ray : Newsgroups : povray.advanced-users : Condition in functions Server Time
21 Dec 2024 21:01:40 EST (-0500)
  Condition in functions (Message 9 to 18 of 18)  
<<< Previous 8 Messages Goto Initial 10 Messages
From: kurtz le pirate
Subject: Re: Condition in functions
Date: 9 Dec 2024 10:52:49
Message: <67571251$1@news.povray.org>
Following Tor's advice, I corrected my 'select()'.

I've also put the 't' parameter back into the functions. I mistakenly 
thought that this parameter was only used for animation and morphing. 
This is not the case at all.


I put an image of the result in p.b.i.


I can ost functions if someone is interested.



-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message

From: jr
Subject: Re: Condition in functions
Date: 9 Dec 2024 23:55:00
Message: <web.6757c8a332068233b2e841a6cde94f1@news.povray.org>
hi,

kurtz le pirate <kur### [at] freefr> wrote:
> ...
> I put an image of the result in p.b.i.
> I can ost functions if someone is interested.

the vase looks pretty cool.  the functions as such would not be much use to me,
I guess, but how about creating a macro ?  perhaps with options to supply one's
own material and for scaling (making the vase taller/shorter, slimmer/more
bulge), and such ?


regards, jr.


Post a reply to this message

From: MichaelJF
Subject: Re: Condition in functions
Date: 16 Dec 2024 11:10:57
Message: <67605111@news.povray.org>
Am 08.12.2024 um 17:25 schrieb kurtz le pirate:

> 
> I also have problems with PrettyBall_1. 3 isosurfaces. Two are ok. The 
> third really doesn't match. Yet the code is/looks ok.
> 
> 
Indeed, this is actually a very strange difference between POV and 
MathMod. In the top row are the three objects as isosurfaces in POV, 
below are the objects exported from MathMod with the same formulae. The 
second and third objects match quite well, while the first one is 
completely different. I cannot judge whether the error is in POV or in 
MathMod.

If you compare the two objects on the right and in the centre in the 
bottom row (MathMod), you may get the impression that the one on the 
right could be created from the middle one as a point reflection at the 
origin (scale <-1,-1,-1>) and in fact both are largely congruent after 
this operation. You will get the correct result with POV if you create 
the first object from the centre one with the mentioned scaling or 
change the definition of GyroidLatice_1 as follows:

#declare GyroidLatice_1 = function {
    select(isoCondition(x,y,z),Iso3(-x,-y,-z),1) + 
exp(isoCondition(x,y,z)/5)
//   select(isoCondition(x,y,z),Iso2(x,y,z),1)// - 
exp(isoCondition(x,y,z)/5)
}


Best regards
Michael


Post a reply to this message


Attachments:
Download 'zeige_ball01.png' (497 KB)

Preview of image 'zeige_ball01.png'
zeige_ball01.png


 

From: Bald Eagle
Subject: Re: Condition in functions
Date: 16 Dec 2024 17:40:00
Message: <web.6760ab55320682331f9dae3025979125@news.povray.org>
MichaelJF <fri### [at] t-onlinede> wrote:

Hmmm.   It looks like maybe it's a sign issue?
Inside and outside are switched?

Try just negating the function and see what happens.

I'm not sure if that might have to do with the left-handed coordinate system, or
what.

- BW


Post a reply to this message

From: MichaelJF
Subject: Re: Condition in functions
Date: 16 Dec 2024 23:25:47
Message: <6760fd4b@news.povray.org>
Am 16.12.2024 um 23:36 schrieb Bald Eagle:
> MichaelJF <fri### [at] t-onlinede> wrote:
> 
> Hmmm.   It looks like maybe it's a sign issue?
> Inside and outside are switched?
> 
> Try just negating the function and see what happens.
> 
> I'm not sure if that might have to do with the left-handed coordinate system, or
> what.
> 
> - BW
> 
> 
Sorry, I mixed up the image yesterday. Here is the corrected version. 
It's even worse. Yesterday is was one of my tests to solve the riddle, 
in which I had commented out the exponential term as a test:

#declare GyroidLatice_1 = function (x,y,z) {
    select(isoCondition(x,y,z),Iso2(x,y,z),1) - //exp(isoCondition(x,y,z)/5)
}

The actual version depicts the full expression without the comment.

The difference between the functions Iso2 and Iso3 is just a change of 
signs and in GyroidLatice_1 the exponential term is subtracted whereas 
in GyroidLatice_2 it is added.

Below you can find the POV-part of the code with the MathMod-Code within 
the comments. Maybe someone else can spot the difference. The parameter 
t from MathMod is not used in this examnple.

Best regards
Michael

#declare L=23/2;
#declare c=1/10000;
#declare Th1=5/10;
#declare Th2=-8/10;


/* isoCondition=(x^N+y^N+z^N-(L-1/10)^N)  (N=2)*/
#declare isoCondition = function(x,y,z) { x*x+y*y+z*z-(L-1/10)*(L-1/10) }

/* Iso =
    cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x) */
#declare Iso = function(x,y,z) {
    cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)
}


/* DFx=((Iso(x+c,y,z,t)-Iso(x,y,z,t))/c)
    DFy=((Iso(x,y+c,z,t)-Iso(x,y,z,t))/c)
    DFz=((Iso(x,y,z+c,t)-Iso(x,y,z,t))/c) */
#declare DFx = function(x,y,z) { (Iso(x+c,y,z)-Iso(x,y,z))/c }
#declare DFy = function(x,y,z) { (Iso(x,y+c,z)-Iso(x,y,z))/c }
#declare DFz = function(x,y,z) { (Iso(x,y,z+c)-Iso(x,y,z))/c }

/* Rapp=(x/sqrt(x*x+y*y+z*z)) */
#declare Rapp = function(x,y,z) {x/sqrt(x*x+y*y+z*z) }

/* "Iso2 =
    Iso(x+Th2*Rapp(DFx(x,y,z,t),DFy(x,y,z,t),DFz(x,y,z,t),t),
        y+Th2*Rapp(DFy(x,y,z,t),DFz(x,y,z,t),DFx(x,y,z,t),t),
        z+Th2*Rapp(DFz(x,y,z,t),DFx(x,y,z,t),DFy(x,y,z,t),t),t)
    ) */
#declare Iso2 = function(x,y,z) {
    Iso(x+Th2*Rapp(DFx(x,y,z),DFy(x,y,z),DFz(x,y,z)),
        y+Th2*Rapp(DFy(x,y,z),DFz(x,y,z),DFx(x,y,z)),
        z+Th2*Rapp(DFz(x,y,z),DFx(x,y,z),DFy(x,y,z))
    )
}

/* Iso3 =
    Iso(x-Th2*Rapp(DFx(x,y,z,t),DFy(x,y,z,t),DFz(x,y,z,t),t),
        y-Th2*Rapp(DFy(x,y,z,t),DFz(x,y,z,t),DFx(x,y,z,t),t),
        z-Th2*Rapp(DFz(x,y,z,t),DFx(x,y,z,t),DFy(x,y,z,t),t),t)
    )*/
#declare Iso3 = function(x,y,z) {
    Iso(x-Th2*Rapp(DFx(x,y,z),DFy(x,y,z),DFz(x,y,z)),
        y-Th2*Rapp(DFy(x,y,z),DFz(x,y,z),DFx(x,y,z)),
        z-Th2*Rapp(DFz(x,y,z),DFx(x,y,z),DFy(x,y,z))
    )
}

/* Iso4 =
    Iso(x+Th1*Rapp(DFx(x,y,z,t),DFy(x,y,z,t),DFz(x,y,z,t),t),
        y+Th1*Rapp(DFy(x,y,z,t),DFz(x,y,z,t),DFx(x,y,z,t),t),
        z+Th1*Rapp(DFz(x,y,z,t),DFx(x,y,z,t),DFy(x,y,z,t),t),t)
    ) */
#declare Iso4 = function(x,y,z) {
    Iso(x+Th1*Rapp(DFx(x,y,z),DFy(x,y,z),DFz(x,y,z)),
        y+Th1*Rapp(DFy(x,y,z),DFz(x,y,z),DFx(x,y,z)),
        z+Th1*Rapp(DFz(x,y,z),DFx(x,y,z),DFy(x,y,z))
    )
}

/* Iso5 =
    Iso(x-Th1*Rapp(DFx(x,y,z,t),DFy(x,y,z,t),DFz(x,y,z,t),t),
        y-Th1*Rapp(DFy(x,y,z,t),DFz(x,y,z,t),DFx(x,y,z,t),t),
        z-Th1*Rapp(DFz(x,y,z,t),DFx(x,y,z,t),DFy(x,y,z,t),t),t)
    )*/
#declare Iso5 = function(x,y,z) {
    Iso(x-Th1*Rapp(DFx(x,y,z),DFy(x,y,z),DFz(x,y,z)),
        y-Th1*Rapp(DFy(x,y,z),DFz(x,y,z),DFx(x,y,z)),
        z-Th1*Rapp(DFz(x,y,z),DFx(x,y,z),DFy(x,y,z))
    )
}

/* ThickIso2=(Iso4(x,y,z,t)*Iso5(x,y,z,t)) */
#declare ThickIso2 = function(x,y,z) { Iso4(x,y,z) * Iso5(x,y,z) }


/* 
GyroidLatice_1=if(isoCondition(x,y,z,t)<(0),Iso2(x,y,z,t),1)-exp(isoCondition(x,y,z,t)/5)

*/

#declare GyroidLatice_1 = function (x,y,z) {
    select(isoCondition(x,y,z),Iso2(x,y,z),1) - exp(isoCondition(x,y,z)/5)
}

/* 
GyroidLatice_2=if(isoCondition(x,y,z,t)<(0),Iso3(x,y,z,t),1)+exp(isoCondition(x,y,z,t)/5)

*/
#declare GyroidLatice_2 = function (x,y,z) {
    select(isoCondition(x,y,z),Iso3(x,y,z),1) + exp(isoCondition(x,y,z)/5)
}

/* 
GyroidLatice_3=if(isoCondition(x,y,z,t)<(0),ThickIso2(x,y,z,t),1)+exp(isoCondition(x,y,z,t)/5)

*/
#declare GyroidLatice_3 = function (x,y,z) {
    select(isoCondition(x,y,z),ThickIso2(x,y,z),1) + 
exp(isoCondition(x,y,z)/5)
}

#declare G1 = isosurface {
    function {
       GyroidLatice_1(x,y,z)
    }
    contained_by { sphere { 0,L-0.1} }
    threshold 0
    max_gradient 1000

    pigment { colour Yellow }
}

#declare G2 = isosurface {
    function {
       GyroidLatice_2(x,y,z)
    }
    contained_by { sphere { 0,L-0.1 } }
    threshold 0
    max_gradient 1000

    pigment { colour Orange }
}

#declare G3 = isosurface {
    function {
       GyroidLatice_3(x,y,z)
    }
    contained_by { sphere { 0,L-0.1 } }
    threshold 0
    max_gradient 1000

    pigment { colour Red }
}


Post a reply to this message


Attachments:
Download 'zeige_ball01.png' (413 KB)

Preview of image 'zeige_ball01.png'
zeige_ball01.png


 

From: Bald Eagle
Subject: Re: Condition in functions
Date: 17 Dec 2024 06:20:00
Message: <web.67615d86320682331f9dae3025979125@news.povray.org>
MichaelJF <fri### [at] t-onlinede> wrote:

>     contained_by { sphere { 0,L-0.1 } }

Have you simply tried adding "open" to your isosurface block, so you don't see
the containing sphere?


Post a reply to this message

From: MichaelJF
Subject: Re: Condition in functions
Date: 17 Dec 2024 09:34:10
Message: <67618be2@news.povray.org>
Am 17.12.2024 um 12:16 schrieb Bald Eagle:
> MichaelJF <fri### [at] t-onlinede> wrote:
> 
>>      contained_by { sphere { 0,L-0.1 } }
> 
> Have you simply tried adding "open" to your isosurface block, so you don't see
> the containing sphere?
> 
> 
Thanks, that solves the riddle. In a way, you have to look at the 
surface from the "inside" of the object. I can't remember ever having 
consciously used this option.


Post a reply to this message


Attachments:
Download 'zeige_ball05.png' (424 KB)

Preview of image 'zeige_ball05.png'
zeige_ball05.png


 

From: Bald Eagle
Subject: Re: Condition in functions
Date: 17 Dec 2024 16:15:00
Message: <web.6761e99232068233471fd7cd25979125@news.povray.org>
MichaelJF <fri### [at] t-onlinede> wrote:

> In a way, you have to look at the
> surface from the "inside" of the object.

Sorta.
I think it has more to do with the extent of the visible surface:

https://wiki.povray.org/content/Reference:Isosurface

"When the isosurface is not fully contained within the contained_by object,
there will be a cross section. When this happens, you will see the surface of
the container. Using the open keyword, these cross section surfaces are removed,
and the inside of the isosurface becomes visible."


Post a reply to this message

From: kurtz le pirate
Subject: Re: Condition in functions
Date: 19 Dec 2024 11:00:02
Message: <67644302@news.povray.org>
On 17/12/2024 12:16, Bald Eagle wrote:
> 
> Have you simply tried adding "open" to your isosurface block, so you don't see
> the containing sphere?
> 
> 

I also tried it. It fixes the problem.

I've never seen/used this option, which is still not very clear to me :(






-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message

From: MichaelJF
Subject: Re: Condition in functions
Date: 19 Dec 2024 11:40:16
Message: <67644c70$1@news.povray.org>
Am 19.12.2024 um 17:00 schrieb kurtz le pirate:
> On 17/12/2024 12:16, Bald Eagle wrote:
>>
>> Have you simply tried adding "open" to your isosurface block, so you 
>> don't see
>> the containing sphere?
>>
>>
> 
> I also tried it. It fixes the problem.
> 
> I've never seen/used this option, which is still not very clear to me :(
> 
> 
> 
> 
> 
> 
As I understand it, all points below the threshold value of the 
isosurface are considered as inside the surface and all above as 
outside. All points on the surface of the containing box or sphere of an 
isosurface considered as part of the interior of the isosurface are 
closed. The open keyword removes this coating.

This explains the behavior here. But I my be wrong again.

Best regards
Michael


Post a reply to this message

<<< Previous 8 Messages Goto Initial 10 Messages

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