POV-Ray : Newsgroups : povray.advanced-users : Question! Server Time
30 Jul 2024 08:19:55 EDT (-0400)
  Question! (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: Warp
Subject: Re: Question!
Date: 23 Mar 2000 06:10:16
Message: <38d9fb98@news.povray.org>
Simen Kvaal <sim### [at] studentmatnatuiono> wrote:
: Given an object (for example an arbitrary isosurface). Is it any way to
: calculate, using for example trace, the lower y-coordinate, for example, so
: that I can place it as close as possible to the ground?

  If it's an isosurface defined with a function, then you can calculate
the lowest point using mathematics.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Simen Kvaal
Subject: Re: Question!
Date: 23 Mar 2000 11:28:23
Message: <38da4627$1@news.povray.org>
>  If it's an isosurface defined with a function, then you can calculate
>the lowest point using mathematics.


This is not true. Many functions have no algebraic solutions. (Above 5th
order polynomials it's impossible!)

The surface in question is:  x^4 + y ^4 + z^4 - (x^2 + y^2 + z^2) -1 = 0.

This is a fouth order plynomial, and is not easily solved using algebra.. A
numerical methos would be better...

Simen.


Post a reply to this message

From: Peter Popov
Subject: Re: Question!
Date: 23 Mar 2000 18:38:26
Message: <XabaOGJ2TFw0Mrf=rUXtavRUQB6F@4ax.com>
On Wed, 22 Mar 2000 19:01:13 +0100, "Simen Kvaal"
<sim### [at] studentmatnatuiono> wrote:

>Given an object (for example an arbitrary isosurface). Is it any way to
>calculate, using for example trace, the lower y-coordinate, for example, so
>that I can place it as close as possible to the ground?

#macro Place_On_Earth ( Object, Steps ) // y is up :)
  #local Min = min_extent ( Object );
  #local Max = max_extent ( Object );
  #local Increment = ( Max - Min ) / Steps;
  #local X = Min.x; #local Continue=1; #local Y = Min.y;
  #while ( (Y < Max.y) & Continue )
     #while ( (X < Max.x) & Continue )
       #local Trace = trace ( Object, <X,Y,Min.z>, z, Normal );
       #if ( vlength (Normal)) #local Continue = 0; #end
       #local X = X + Increment.x;
     #end
     #local Y = Y + Increment.y;
  #end
  object { Object translate -y * ( Y - Increment.y ) }
#end

It *might* just work a prima vista but I doubt it as I typed it
directly in the newsreader ;) Anyway, you get the idea.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Warp
Subject: Re: Question!
Date: 24 Mar 2000 03:56:25
Message: <38db2db8@news.povray.org>
If I remember right, you can calculate minimums and maximums by deriving
the function twice. So there wouldn't be any problem.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Simen Kvaal
Subject: Re: Question!
Date: 24 Mar 2000 06:48:25
Message: <38db5609@news.povray.org>
But we are not talking about finding maxima and minima of real-valued
functions, because the general funciotn-surface is a level surface of a
function of three variables. So, deriving a sphere function, x*x+y*y+z*z-1,
gives you a 3-vector (gradient): grad f = <2x. 2y, 2x>. Solving this for
zero as you would with normal functions yields <0, 0, 0>, which means that
the function has a extreme point at <0, 0, 0> In fact, it's a minimum, but
this is at the centre of the sphere, which is _not_ the lowes point on the
sphere. (Of course not, I'd say.) This minimum represents the 'density' of a
4-d-object, and the sphere itself is the set of all denisties with a
specific value, for example r^2.

It would be lesser problems if one were able to solve the function for for
example y by saying:

x*x+y*y+z*z=1 => y = +-sqrt(1-x*x-z*z) and this function we can derive and
find maxima and minima of. BUT NOT from for example: sin x - x = 0, which
have noe algebraic solutions!

Warp skrev i meldingen <38db2db8@news.povray.org>...
>  If I remember right, you can calculate minimums and maximums by deriving
>the function twice. So there wouldn't be any problem.
>
>--
>main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
>):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Simen Kvaal
Subject: Re: Question!
Date: 24 Mar 2000 06:49:28
Message: <38db5648$1@news.povray.org>
Thanks! :D Works with isos too? (Haven't got the time to test it right now!)

Simen.


>#macro Place_On_Earth ( Object, Steps ) // y is up :)
>#end


Post a reply to this message

From: Peter Popov
Subject: Re: Question!
Date: 24 Mar 2000 16:41:34
Message: <HuHbOHlNFHWhth7T=F4cbNGobalo@4ax.com>
On Fri, 24 Mar 2000 12:49:27 +0100, "Simen Kvaal"
<sim### [at] studentmatnatuiono> wrote:

>Thanks! :D Works with isos too? (Haven't got the time to test it right now!)
>
>Simen.

You mean it ran the first time?!?!


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] usanet
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Simen Kvaal
Subject: Re: Question!
Date: 25 Mar 2000 03:32:36
Message: <38dc79a4$1@news.povray.org>
Well, I didn't actually try it; I just assumed you knew what you ere doing.
(heh..) But I've tried it now, but
it doesn't seem to work. I noted that the Normal-vector had to be
initialized first, so I did that, and then I got
no errors. But a simple sphere of radius 1 floating 30 units above a
(checkered) plane, did not show up.

I really only need a way to place an object on a _given_ y-level, and thanks
to you, I think I know how now.

Simen.

Peter Popov skrev i meldingen ...
>On Fri, 24 Mar 2000 12:49:27 +0100, "Simen Kvaal"
><sim### [at] studentmatnatuiono> wrote:
>
>>Thanks! :D Works with isos too? (Haven't got the time to test it right
now!)
>>
>>Simen.
>
>You mean it ran the first time?!?!
>
>
>Peter Popov ICQ : 15002700
>Personal e-mail : pet### [at] usanet
>TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Chris Huff
Subject: Re: Question!
Date: 25 Mar 2000 08:35:46
Message: <chrishuff_99-0050B3.08375625032000@news.povray.org>
In article <XabaOGJ2TFw0Mrf=rUXtavRUQB6F@4ax.com>, Peter Popov 
<pet### [at] usanet> wrote:

...
> It *might* just work a prima vista but I doubt it as I typed it
> directly in the newsreader ;) Anyway, you get the idea.

This version seems to work fine, although I haven't heavily tested it 
yet. It returns the lowest point instead of positioning the object on a 
surface at y=0.

#macro FindLowestPoint(Object, Steps)
    #local MinExt = min_extent(Object);
    #local MaxExt = max_extent(Object);
    #local Size = MaxExt-MinExt;
    #local LowestPt = MaxExt;
    
    #local Z=0;
    #while(Z<Steps)
        #local X=0;
        #while(X<Steps)
            #local TempPt = trace(Object, 
                MinExt+(<X,0,Z>*Size/(Steps-1))-y, y);
            
#if((TempPt.y<LowestPt.y)&((TempPt.x!=0)|(TempPt.y!=0)|(TempPt.z!=0)))
                #local LowestPt = TempPt;
            #end
            #local X=X+1;
        #end
        #local Z=Z+1;
    #end
    (LowestPt)
#end

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Simen Kvaal
Subject: Re: Question!
Date: 27 Mar 2000 02:20:36
Message: <38df0bc4@news.povray.org>
Thank you! I will test it as soon as I can! It would be great if it worked.
It's so difficult sometimes to place an arbitrari isosurface on the 'ground'
when I want to...

Simen.

>This version seems to work fine, although I haven't heavily tested it
>yet. It returns the lowest point instead of positioning the object on a
>surface at y=0.
>


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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