POV-Ray : Newsgroups : povray.advanced-users : Question! Server Time
25 Dec 2024 13:12:36 EST (-0500)
  Question! (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Simen Kvaal
Subject: Question!
Date: 22 Mar 2000 13:01:18
Message: <38d90a6e$1@news.povray.org>
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?

Simen.


Post a reply to this message

From: Chris Huff
Subject: Re: Question!
Date: 22 Mar 2000 15:32:43
Message: <chrishuff_99-890CEE.15344922032000@news.povray.org>
In article <38d90a6e$1@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?

Usually, this will work:
#declare groundHeight = 0; // distance along y-axis of ground
#declare MyObj =
...object declaration...

object {MyObj
    translate y*(groundHeight-min_extent(MyObj).y)
}

However, with some objects(like blobs), it is imprecise. The min_extent 
function returns the lower left front(-x,-y,-z) corner of the bounding 
box of the object, and the bounding box is not always exactly 
calculated(it would be too difficult to calculate for some objects). It 
should work fine for isosurfaces, though.

-- 
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: Chris Huff
Subject: Re: Question!
Date: 22 Mar 2000 15:44:45
Message: <chrishuff_99-C04F94.15465222032000@news.povray.org>
In article <chrishuff_99-890CEE.15344922032000@news.povray.org>, Chris 
Huff <chr### [at] yahoocom> wrote:

> It should work fine for isosurfaces, though.

Oops!
Actually, it sometimes won't. It should work fine, as long as the 
isosurface contacts the lower part of the contained_by object.(or is 
close enough the gap doesn't matter)

-- 
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: 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

Goto Latest 10 Messages Next 3 Messages >>>

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