POV-Ray : Newsgroups : povray.binaries.images : pfeh Server Time
18 Nov 2024 02:20:44 EST (-0500)
  pfeh (Message 1 to 7 of 7)  
From: Timothy Cook
Subject: pfeh
Date: 15 Jul 2004 00:15:10
Message: <40f604ce@news.povray.org>
So much for that idea.  Spent a few weeks realizing I was
making things a few orders of magnitude harder than I needed,
came up with what *seemed* a viable solution...but it
obviously ain't.

So how DO I turn a sphere into a cube with an isosurface?
I was playing with the spherical heightfield idea, and
decided to start with a cube.  Simple enough, no?  No!  T_T

I started with two angles: heading and inclination.  For
ease of calculations, I decided to inscribe the cube in a
sphere with radius 1.  That is, the distance from the centre
of the cube to one of its corners would be 1 unit.  Pythagorean's
theorem gives the components of the line, 1=sqrt(x^2+y^2+z^2),
which would be at RA/decl(45, 45)...so a line from the centre of
the cube to the centre of any of the faces would be sqrt(1/3).
Focusing on only one face, we have a constant component (let's
use x) regardless of RA or decl on that face.  Y would be
sqrt(1/3)*tan(RA), and z would be sqrt(1/3)*tan(decl).  Plug
those into Pythagorean's theorem to get the distance from centre
of cube to point on surface at arbitrary location.  Multiply by
16,777,216 and convert to hex to get an RGB triplet.  Apply these
to an image map which is then used to deform a sphere isosurface.

Clearly, this is not a cube, and I would be needing the top and
bottom even if the sides were right.


-- 
Tim Cook
http://home.bellsouth.net/p/PWP-empyrean

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------


Post a reply to this message


Attachments:
Download '2004-07-14 isotest.jpg' (51 KB)

Preview of image '2004-07-14 isotest.jpg'
2004-07-14 isotest.jpg


 

From: Stephen
Subject: Re: pfeh
Date: 15 Jul 2004 03:50:01
Message: <web.40f636d8b30922d971087b900@news.povray.org>
Timothy Cook <z99### [at] bellsouthnet> wrote:
> So much for that idea.  Spent a few weeks realizing I was
> making things a few orders of magnitude harder than I needed,
> came up with what *seemed* a viable solution...but it
> obviously ain't.
>
> So how DO I turn a sphere into a cube with an isosurface?
>

Tim,



straightedge, a compass and Pov-Ray.

Stephen


Post a reply to this message

From: Timothy Cook
Subject: Re: pfeh
Date: 15 Jul 2004 05:52:49
Message: <40f653f1$1@news.povray.org>
Stephen wrote:



> straightedge, a compass and Pov-Ray.

Heh.  Inscribing, not 'has same area' ^_^;

Just had an interesting, if pointless, discussion on a p2p program
about math...to the effect of:
me - math, being an abstract concept, is infintely exact
other person - wrong, math is an approximation, based on reality;
   they got the formula for a circle by observing circles in the
   wild untamed jungles
me - er...sure whatever...

(the whole thing started out because someone else mentioned
quantum mechanics, which I pointed out we had string theory
now, to which the other person launched into how quantum
theory was wrong because it didn's account for everything,
and relativity was wrong, etc...I tried to argue that they're
not wrong just because they don't account for everything;
for some things they work just fine...for other things they
are even overkill...)

oh well.

-- 
Tim Cook
http://home.bellsouth.net/p/PWP-empyrean

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------


Post a reply to this message

From: Stephen
Subject: Re: pfeh
Date: 15 Jul 2004 07:35:00
Message: <web.40f66bb6b30922d971087b900@news.povray.org>
Timothy Cook <z99### [at] bellsouthnet> wrote:
> Just had an interesting, if pointless, discussion on a p2p program
> about math...to the effect of:
> me - math, being an abstract concept, is infintely exact
> other person - wrong, math is an approximation, based on reality;
>    they got the formula for a circle by observing circles in the
>    wild untamed jungles
> me - er...sure whatever...
>

OMG! Must have been crop circles or fairy rings :-}


the World reporters. And the News of the World is a Sunday newspaper that
makes the National Enquirer seem up market. And the reporters are generally
in a compromising situation.


Post a reply to this message

From: Samuel Benge
Subject: Re: pfeh
Date: 15 Jul 2004 12:58:00
Message: <40F6B731.4020004@hotmail.com>
Timothy Cook wrote:
<snip>

> So how DO I turn a sphere into a cube with an isosurface?
> I was playing with the spherical heightfield idea, and
> decided to start with a cube.  Simple enough, no?  No!  T_T
<clip>


Here's the way I do it:

#declare sphere_radius = 1;
#declare sphere_influence = .5;
#declare box_size = 1;
#declare box_influence = .5;

function{
  (
   sqrt(x*x+y*y+z*z)-sphere_radius
  )*sphere_influence
  +(
   max(
    abs(x)
    ,abs(y)
    ,abs(z)
   )-box_size
  )*box_influence
}

-Sam


Post a reply to this message

From:
Subject: Re: pfeh
Date: 16 Jul 2004 14:21:26
Message: <40f81ca6$1@news.povray.org>
// Hi Tim,
//
// this is my way; render with
// +W160 +H120 +A0.3 +AM1 +R3 -F +KFF9
//
//   Sputnik


// SphereCubeMorph

#declare Size = 1;
//#declare Power = 1 / (0.5-0.499*clock); // 2 .. 1000, more small values
//#declare Power = clock+1; // also try this! (with max_gradient 1.8)
#declare Power = 1 / (1-0.999*clock); // or this! (with max_gradient 1.8)

isosurface {
  function{
    pow ( pow(abs(x),Power)
         +pow(abs(y),Power)
         +pow(abs(z),Power) , 1/Power ) - Size
    }
  max_gradient 1.8
  contained_by { box { -1.1, 1.1 } }
  pigment { color rgb 1 }
  finish { ambient .3 diffuse .7 }
  }

light_source { <-2, 4, -3>, rgb 1 }

camera { angle 10 location -25*z look_at 0
  rotate <30, -25, 0>
  }


Post a reply to this message

From: ElProfesor
Subject: Re: pfeh
Date: 17 Jul 2004 03:40:01
Message: <web.40f8d73fb30922d9265dc100@news.povray.org>
>   function{
>     pow ( pow(abs(x),Power)
>          +pow(abs(y),Power)
>          +pow(abs(z),Power) , 1/Power ) - Size
>     }


You could also try with superellipsoids; the sphere is a particular one (e =
n = 1, e and n being the parameters stated in the docs) and my guess is
that the cube is a limit one (e = n -> +oo should make it). The advantages
are that of using a built-in object and not having to provide a
max_gradient.
The equation it yields differs slightly from yours, though the extreme
shapes should be the same. Would be interesting to compare the intermediate
shapes it goes through!


Post a reply to this message

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