POV-Ray : Newsgroups : povray.binaries.images : iso-sphere-sweep - second example Server Time
2 Nov 2024 05:21:45 EDT (-0400)
  iso-sphere-sweep - second example (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From:
Subject: iso-sphere-sweep - second example
Date: 4 Jan 2002 13:14:36
Message: <rlrb3ukjk8omaba2tfs8bjq8l411s5m7lr@4ax.com>
another example of sphere sweep as on iso

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message


Attachments:
Download 'test.png' (191 KB)

Preview of image 'test.png'
test.png


 

From: Dennis Milller
Subject: Re: iso-sphere-sweep - second example
Date: 4 Jan 2002 21:57:51
Message: <3c366baf$1@news.povray.org>
That's really excellent; have you posted the code?
I would like to try animating it...
Dennis



news:rlrb3ukjk8omaba2tfs8bjq8l411s5m7lr@4ax.com...
> another example of sphere sweep as on iso
>
> ABX
> --
> #declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb
1}}
> union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{
//ABX
>
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)
}
> contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient
1}}//POV35
>
>


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: iso-sphere-sweep - second example
Date: 4 Jan 2002 22:35:02
Message: <3C3673FB.52F2CC76@hotmail.com>

> 
> another example of sphere sweep as on iso

I could not spot any non-connected cylinder
ends in that image, so I thought that maybe
the source code below could be of interest
for you.

But maybe you have figured this out already...


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Copyright 2002 by Tor Olav Kristensen
// Email: tor### [at] hotmailcom
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.5;

#include "colors.inc"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

/*
// A macro that I once made.
// (Compare to the second macro to see similarities.)

#macro Dist2LnSegm(pP, pA, pB)

    #local vL = pB - pA;
    #local ss = vdot(pP - pA, vL)/vdot(vL, vL);

    vlength(pP - pA - max(0, min(ss, 1))*vL)

#end // Dist2LnSegm
*/

#macro CylinderFunction(pA, pB, Radius)

  #local Ax = pA.x;
  #local Ay = pA.y;
  #local Az = pA.z;
  #local vL = pB - pA;
  #local Lx = vL.x;
  #local Ly = vL.y;
  #local Lz = vL.z;
  #local LL = vdot(vL, vL);
  #local vD = vL/LL;
  #local Dx = vD.x;
  #local Dy = vD.y;
  #local Dz = vD.z;
  #local AD = vdot(pA, vD);

  function {
    sqrt(
      (x - Ax - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Lx)^2
     +(y - Ay - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Ly)^2
     +(z - Az - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Lz)^2
    )
   -Radius
  }

#end // macro CylinderFunction


/*
Some notes about the macro above.

Distance from pP = <x, y, z> to line segment between pA and pB is:

Dist = vlength(pP - pA - max(0, min(ss, 1))*vL)

where ss =
vdot(pP - pA, vL)/vdot(vL, vL) =
vdot(pP - pA, vL)/LL =
(vdot(pP, vL) - vdot(pA, vL))/LL =
vdot(pP, vL)/LL - vdot(pA, vL)/LL =
vdot(pP, vL/LL) - vdot(pA, vL/LL) =
vdot(pP, vD) - vdot(pA, vD) =
vdot(pP, vD) - AD =
pP.x*vD.x + pP.y*vD.y + pP.z*vD.z - AD =
x*Dx + y*Dy + z*Dz - AD

Distance from pP to cylinder "between" pA and pB is:

Dist - Radius
*/

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare p1 = <-3, 2, 4>;
#declare p2 = <2, -1, 0>;
#declare R = 0.5;

#declare MyCylFn = CylinderFunction(p1, p2, R)

isosurface {
  function { MyCylFn(x, y, z) }
  contained_by { sphere { <0, 0, 0>, 6 } }
  pigment { color White }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

background { color (Blue + Cyan)/4 }

light_source {
  <3, 3, -2>*10
  color White
}

camera {
  location -5*z
  look_at 0*y
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: iso-sphere-sweep - second example
Date: 4 Jan 2002 22:40:14
Message: <3C367532.90EB725D@hotmail.com>
Tor Olav Kristensen wrote:
>...
> #macro CylinderFunction(pA, pB, Radius)
> 
>   #local Ax = pA.x;
>   #local Ay = pA.y;
>   #local Az = pA.z;
>   #local vL = pB - pA;
>   #local Lx = vL.x;
>   #local Ly = vL.y;
>   #local Lz = vL.z;
>   #local LL = vdot(vL, vL);
>   #local vD = vL/LL;
>   #local Dx = vD.x;
>   #local Dy = vD.y;
>   #local Dz = vD.z;
>   #local AD = vdot(pA, vD);
> 
>   function {
>     sqrt(
>       (x - Ax - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Lx)^2
>      +(y - Ay - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Ly)^2
>      +(z - Az - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Lz)^2
>     )
>    -Radius
>   }
> 
> #end // macro CylinderFunction
>...

If one includes functions.inc, then the
function above can be written like this:

function {
  f_sphere(
    x - Ax - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Lx,
    y - Ay - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Ly,
    z - Az - max(0, min(x*Dx + y*Dy + z*Dz - AD, 1))*Lz,
    Radius
  )
}

This might render faster because of the use of
the internal sphere function, but I have not
found clear evidence of that yet.


Tor Olav


Post a reply to this message

From: Batronyx
Subject: Re: iso-sphere-sweep - second example
Date: 6 Jan 2002 15:58:48
Message: <3c38ba88$1@news.povray.org>
If you and Tor just put your heads together, we can all enjoy something like we
might find here:

http://www.softy3d.com

Looking forward to more. :)

--
light_source{0,1}#macro c(J,a)sphere{0,1pigment{rgb z}scale a translate J+O}
#end#macro B(R,V,O)c(0,4)intersection{c(V,R)difference{c(-z*4x+10)c(-z*4.1x+
10)c(0<7.5,45,5>)}}#end B(12,0z*25)B(8y*4<0,12,50>)          // Batronyx ^"^


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: iso-sphere-sweep - second example
Date: 6 Jan 2002 21:32:04
Message: <3C390833.A0FC691C@hotmail.com>
Batronyx wrote:
> 
> If you and Tor just put your heads together, we can all enjoy something like we
> might find here:
> 
> http://www.softy3d.com
> 
> Looking forward to more. :)

I am afraid that the images made with Softy 3d are meshes,
not iso-surfaces.

And doing some of the shapes shown at Softy 3D's gallery
page with iso-surfaces requires a LOT of thinking.

But one thing that would be nice is if we had a utility
for converting a POV iso-surface to a mesh.

I have never looked into a problem of this kind before,
so I don't know how difficult that would be.


Tor Olav


Post a reply to this message

From: Batronyx
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 00:25:50
Message: <3c39315e@news.povray.org>
"Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message


> I am afraid that the images made with Softy 3d are meshes,
> not iso-surfaces.

... he says -- as if I didn't know. The ability to vary the mesh resolution is
nice too. Of course, that wasn't the point.

>
> And doing some of the shapes shown at Softy 3D's gallery
> page with iso-surfaces requires a LOT of thinking.

A utility would be helpful here. In fact, one just exactly like
Softy3D with isosurface syntax output instead, would be useful. It's a shame
that Softy3D costs so much.

That was the point: Softy3D results at POV prices. :)

> But one thing that would be nice is if we had a utility
> for converting a POV iso-surface to a mesh.

They would certainly render faster as meshes. However, if you leave them as
iso-surfaces, you can use displacement maps to make the finer details really
stand out. It would take a lot of triangles to capture that level of detail.
It's is the same song with a new verse: memory vs. speed.

> I have never looked into a problem of this kind before,
> so I don't know how difficult that would be.

Warp has looked into it. As recently as Dec. 24, he favored the marching
triangles algorithm. ("Re: isosurface -> mesh?" p.g)

In the long run, I suppose you are right though; it probably really isn't worth
the effort to duplicate Softy3D functionality. Sure there is the "Gee whiz"
factor, but how practical is it?
It was just an idea.

--
light_source{0,1}#macro c(J,a)sphere{0,1pigment{rgb z}scale a translate J+O}
#end#macro B(R,V,O)c(0,4)intersection{c(V,R)difference{c(-z*4x+10)c(-z*4.1x+
10)c(0<7.5,45,5>)}}#end B(12,0z*25)B(8y*4<0,12,50>)          // Batronyx ^"^


Post a reply to this message

From:
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 02:46:50
Message: <3gki3ucinlpobg8rnpluoj0dicfn5m1vo2@4ax.com>
On Fri, 4 Jan 2002 21:56:10 -0500, "Dennis Milller" <dhm### [at] mediaonenet>
wrote:
> That's really excellent;

Thank You.

> have you posted the code?

not yet, I'm working on other linear types of segment (various radius at
begining and end of segment)

> I would like to try animating it...

Please, wait a little

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From:
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 02:48:52
Message: <1jki3ukgeslbtpk84r1ua1hcn1gfc8q1q3@4ax.com>
On Sat, 05 Jan 2002 04:33:15 +0100, Tor Olav Kristensen <tor### [at] hotmailcom>
wrote:
> I could not spot any non-connected cylinder
> ends in that image, so I thought that maybe
> the source code below could be of interest
> for you.

Thank You.

> But maybe you have figured this out already...

Yes, Your method is similiar to one of those tested by me. I have tested
different modifications and optimizations to speed up rendering time.

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From:
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 02:53:01
Message: <3qki3uc1n7nupbvvab0uqosu7t8ip4af1a@4ax.com>
On Sun, 6 Jan 2002 14:52:05 -0600, "Batronyx" <bat### [at] alliancecablenet>
wrote:
> If you and Tor just put your heads together

Sorry, afaik my head is only as good as his neck. ;-)

ABX


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

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