POV-Ray : Newsgroups : povray.general : gravity well Server Time
25 Apr 2024 08:42:23 EDT (-0400)
  gravity well (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: alphaQuad
Subject: gravity well
Date: 10 Oct 2007 17:35:00
Message: <web.470d4493331ad95812df23310@news.povray.org>
Why does Mike say this is the function for a gravity well?
x*x - 0.002/y*y + z*z

Or more importantly what must be done that I am not doing to render a
surface as Mike has here:
http://www.econym.demon.co.uk/isotut/more.htm



What doesn't work:
isosurface {
    function {
     //y - (x*x + z*z)*0.5   // curved

     //x*x - y*y + z*z  // twin cones
     //sqrt(x*x + z*z) - abs(y)

     x*x - z*z + abs(y) // more curved, somewhat boob-shaped cones
     //x*x - 0.002/y*y +z*z // cylinder not a grav-well
     // http://www.econym.demon.co.uk/isotut/more.htm
     //Gravity_Well(x, y, z, 0.002)
     }

   threshold 0
 max_gradient 3
 contained_by {box {<-1,-1,-1>, < 1, 1, 1>}}
 //contained_by {sphere {< 0, 0, 0>, 1}}
 open
    texture {
    pigment{ CadetBlue }
    finish { ambient .4 }
    }
    scale 2
    translate <0,0, 0>
}


Post a reply to this message

From: Alain
Subject: Re: gravity well
Date: 11 Oct 2007 12:45:08
Message: <470e5314@news.povray.org>
alphaQuad nous apporta ses lumieres en ce 2007/10/10 17:30:
> 
> Why does Mike say this is the function for a gravity well?
> x*x - 0.002/y*y + z*z
> 
> Or more importantly what must be done that I am not doing to render a
> surface as Mike has here:
> http://www.econym.demon.co.uk/isotut/more.htm
> 
>

Gravity is a function of the sum of the mass involved divided by the square of 
the distance. g = (M1 + M2)/R^2
The gravity well is the 4D deformation of space due to the gravity of any 
object. The resulting 4D shape is then projected into 3D space in the form of a 
bent surface, the 3D space been flatened to 2D and the 4D deformation flatened 
in 3D. The proposed function is the end result of that projection.

The -0.002 is an arbitrary ponderation factor.

The proposed shape is for a punctual mass, whitch is an acceptable 
simplification in most cases and the actual situation in the case of a black hole.

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when you downloaded and printed the 
Renderman Interface documentation, so you'd have a little light reading to take 
on holiday.
Alex McLeod a.k.a. Giant Robot Messiah


Post a reply to this message

From: Grassblade
Subject: Re: gravity well
Date: 11 Oct 2007 14:25:00
Message: <web.470e698850ab97d7ad7ea8820@news.povray.org>
"alphaQuad" <alp### [at] earthlinknet> wrote:
> Why does Mike say this is the function for a gravity well?
> x*x - 0.002/y*y + z*z

Because he forgot parentheses. That expression simplifies to x*x-0.002+z*z,
which is a circle for every y, so a cylinder. Try x*x-0.002/(y*y)+z*z


Post a reply to this message

From: alphaQuad
Subject: Re: gravity well
Date: 11 Oct 2007 14:45:00
Message: <web.470e6e8950ab97d7e52dcb710@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> alphaQuad nous apporta ses lumieres en ce 2007/10/10 17:30:
> >
> > Why does Mike say this is the function for a gravity well?
> > x*x - 0.002/y*y + z*z
> >
> > Or more importantly what must be done that I am not doing to render a
> > surface as Mike has here:
> > http://www.econym.demon.co.uk/isotut/more.htm
> >
> >
>
> Gravity is a function of the sum of the mass involved divided by the square of
> the distance. g = (M1 + M2)/R^2

Anyone who has tried to make a grav-model with the textbook r^2 has probably
been frustrated.

Actually g*m1*m2/inversesquare of the distance
OR
g/r^3
and the g is model dependent as in scale input

I'll reference 2 working models.
Here in my opengl model:

SUBVECTORS(v1,planets[i].pos,planets[nrbd].pos);
frc = G / pow(MODULE(v1),3);
MULTVECTOR(v1, v1, frc);
ADDVECTORS(planets[i].gvel,planets[i].gvel,v1);


And another:

  var %s = $calc((%d.x ^ 2) + (%d.y ^ 2))
  var %force = $calc(-200 / (%s * $sqrt(%s)))
  inc %vx $calc(%d.x * %force)
  inc %vy $calc(%d.y * %force)
  inc %px %vx
  inc %py %vy


Here d is a 2d vector:

  dist2 = d.x*d.x + d.y*d.y
  dist = sqrt(dist2)
  dist2 * sqrt(dist2) = the inverse square of the dist == pow(dist,3)


And run the numbers

  dist = 228.53664913969487
  dist2 = 52229 (-223 * -223 + -50 * -50)

  (52229 * $sqrt(52229)) ====== 11936240.640621
  pow(228.53664913969487,3) = 11936240.647917


  $vlen2($subv2(%tri.a,%tri.b)) = 228.53664913969487
  %tri.a 394 126
  %tri.b 617 176




> The gravity well is the 4D deformation of space due to the gravity of any
> object. The resulting 4D shape is then projected into 3D space in the form of a
> bent surface, the 3D space been flatened to 2D and the 4D deformation flatened
> in 3D. The proposed function is the end result of that projection.
>
> The -0.002 is an arbitrary ponderation factor.
>
> The proposed shape is for a punctual mass, whitch is an acceptable
> simplification in most cases and the actual situation in the case of a black hole.

interesting but doesnt get us much closer to working code.
thanks for the input.
>
> --
> Alain
> -------------------------------------------------
> You know you've been raytracing too long when you downloaded and printed the
> Renderman Interface documentation, so you'd have a little light reading to take
> on holiday.
> Alex McLeod a.k.a. Giant Robot Messiah


Post a reply to this message

From: alphaQuad
Subject: Re: gravity well
Date: 11 Oct 2007 15:35:00
Message: <web.470e7a8850ab97d7e52dcb710@news.povray.org>
"Grassblade" <nomail@nomail> wrote:

> Because he forgot parentheses. That expression simplifies to x*x-0.002+z*z,
> which is a circle for every y, so a cylinder. Try x*x-0.002/(y*y)+z*z

GREAT!!!!!!!!!!!!! renders 2 reversed wells

but it wont let me intersection or difference out one half
and keeps whining about the function line:

starts rendering then half way thru error is:

Parse Error: Floating-point exception detected in function ''. Your function
either attempted a division by zero, used a function outside its domain or
called an internal function with invalid parameters.
difference {

 isosurface {
    function { (x*x) - (0.005/(y*y)) + (z*z) }
   threshold 0
 max_gradient 9
 contained_by {box {<-1,-1,-1>, < 1, 1, 1>}}
 open
    texture {
    pigment{ CadetBlue }
    finish { ambient .4 }
    }
    scale 6
    translate <0,0, 0>
}
box {<-1,-1,-1>, < 1, 1, 1>
      scale 2
      translate < 0, -2, 0>
   }
}



what should one do here?


Post a reply to this message

From: alphaQuad
Subject: Re: gravity well
Date: 11 Oct 2007 17:05:00
Message: <web.470e8f7650ab97d7e52dcb710@news.povray.org>
"alphaQuad" <alp### [at] earthlinknet> wrote:

> but it wont let me intersection or difference out one half
> and keeps whining about the function line:


ok i think it is just coincidental surfaces that is causing the error.

But removing the top half is as if it were still in the way of the light
though not rendered.

can anyone actually do this?

"hainus indeed'


Post a reply to this message

From: alphaQuad
Subject: Re: gravity well
Date: 11 Oct 2007 17:40:01
Message: <web.470e975750ab97d7e52dcb710@news.povray.org>
seems like an inverse or invert call is needed here somewhere, though I
haven't the slightest idea what I am talking about, except to say

the "inside" or topside of bottom half is dark which should be an outside
normal at the light. ideas suggestions greatly appreciated.


Post a reply to this message

From: alphaQuad
Subject: Re: gravity well
Date: 11 Oct 2007 17:55:00
Message: <web.470e9a7b50ab97d7e52dcb710@news.povray.org>
could have maybe made a gravity well mesh by now.

also I noticed that an interection withOUT coincidental surface error
suddenly had errors if camera got rotated.

so much for a "moving camera on a difference-isosurface" animation


Post a reply to this message

From: Grassblade
Subject: Re: gravity well
Date: 11 Oct 2007 18:15:00
Message: <web.470e9f9050ab97d7ad7ea8820@news.povray.org>
"alphaQuad" <alp### [at] earthlinknet> wrote:
> "Grassblade" <nomail@nomail> wrote:
>
> > Because he forgot parentheses. That expression simplifies to x*x-0.002+z*z,
> > which is a circle for every y, so a cylinder. Try x*x-0.002/(y*y)+z*z
>
> GREAT!!!!!!!!!!!!! renders 2 reversed wells
>
> but it wont let me intersection or difference out one half
> and keeps whining about the function line:
>
> starts rendering then half way thru error is:
>
> Parse Error: Floating-point exception detected in function ''. Your function
> either attempted a division by zero, used a function outside its domain or
> called an internal function with invalid parameters.
> difference {
>
>  isosurface {
>     function { (x*x) - (0.005/(y*y)) + (z*z) }
>    threshold 0
>  max_gradient 9
>  contained_by {box {<-1,-1,-1>, < 1, 1, 1>}}
>  open
>     texture {
>     pigment{ CadetBlue }
>     finish { ambient .4 }
>     }
>     scale 6
>     translate <0,0, 0>
> }
> box {<-1,-1,-1>, < 1, 1, 1>
>       scale 2
>       translate < 0, -2, 0>
>    }
> }
>
>
>
> what should one do here?
You don't want to use CSG with isosurfaces, check the tutorial at
http://www.povray.org/documentation/view/3.6.1/73/ it explains how to make
operations similar to CSG operations within the isosurface definition.

Regarding division by zero, contained_by acts like the domain of your
function. Since the domain comprises y=0, you should make sure your
denominator never reaches 0.
You can either add a small value to it (e.g. 0.002/(y*y+0.00001)), or modify
the contained_by line such that it doesn't include 0 for y, like
contained_by {box {<-1,0.0001,-1>, < 1, 1, 1>}}
This second solution should have the added advantage of getting rid of the
other well.


Post a reply to this message

From: alphaQuad
Subject: Re: gravity well
Date: 11 Oct 2007 18:35:00
Message: <web.470ea44750ab97d7e52dcb710@news.povray.org>
"Grassblade" <nomail@nomail> wrote:
> http://www.povray.org/documentation/view/3.6.1/73/ it explains how to make


page comes up:

"1.3.3.3 Isosurface Object

You know you have been raytracing too long when ...
.... You find yourself wishing you'd paid attention in math class to all
those formulae you thought you'd never have any use for in real life.
    -- Jeff Lee "

ok my triangulation.inc is for Jeff Lee

solving angles and sides is the most useful imho.

3D Macros:
  incenter(v1,v2,v3)
  centroid(v1,v2,v3)
  ccenter(v1,v2,v3)      circumcenter
  orthocenter(v1,v2,v3)
  normal_vector(v1,v2,v3)
  midpoint(v1,v2)


Functions:
  inneradius(a,b,c)
  circumradius(a,b,c)

  sss_area(a,b,c)
  sas_area(s,a,s2)
  bh_area(b,h)           Base Height

  sss_height(a,b,c)      height to side2
  sas_cos(s,a,s2)        Side Angle Side - solve length of missing side

  aas_sin(a,b,s)         AAS solve opposing side of angle2 (b)
  asa_sin(a,s,b)         ASA solve opposing side of angle2 (b)
  sss_cos(a,b,c)         SSS solve angle opposite side2    (b)
  ssa_acute(s,s2,a)      SSA solve angle opposite side2

Float Macros:
  ssa_obtuse(s,s2,a)
  sa_height(s,a)         Side Angle unknown base
  _clamp(a,n,m)


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

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