POV-Ray : Newsgroups : povray.advanced-users : Constructing a geometry Server Time
1 Nov 2024 03:18:29 EDT (-0400)
  Constructing a geometry (Message 1 to 6 of 6)  
From: Amir ni
Subject: Constructing a geometry
Date: 4 Feb 2009 22:20:02
Message: <web.498a5a7a5e8cb8c4792c7d270@news.povray.org>
Hi,

I am trying to make a special shape in povray that is made by spheres, but
neither "intersection" nor "difference" commands cannot help me. This is the
problem: if the position of eight spheres are in a cubic form in a way that the
distance between neighbor sphere is less than 1.4 times the radius of spheres, a
cavity is formed in the center of cube. I want to make the shape of that cavity.
The following code contains the the coordinates of eight spheres. In advance, I
do appreciate your help.




global_settings {  assumed_gamma 1.0 }

#include "colors.inc"

//---------------------------------------
camera{ ultra_wide_angle
        angle 75
        right x*image_width/image_height
     location  <2 , 3 , -4>
        look_at   <0,0,0> }
//---------------------------------------
light_source{ <0,0,-2500>
              color rgb<1,1,1> }
//---------------------------------------
background {color  rgb<1,1,1>}
//---------------------------------------

#declare d=1;

union{

sphere { <d/2, d/2, d/2> ,  d/1.4}
sphere { <-d/2, -d/2, -d/2> ,  d/1.4}

sphere { <-d/2, d/2, d/2> ,  d/1.4}
sphere { <d/2, -d/2, -d/2> ,  d/1.4}

sphere { <d/2, -d/2, d/2> ,  d/1.4}
sphere { <-d/2, d/2, -d/2> ,  d/1.4}

sphere { <d/2, d/2, -d/2> ,  d/1.4}
sphere { <-d/2, -d/2, d/2> ,  d/1.4}


pigment{ color rgb<1,0,0> }
}


Post a reply to this message

From: Mike Williams
Subject: Re: Constructing a geometry
Date: 4 Feb 2009 23:36:01
Message: <nfIPBaAsymiJFwro@econym.demon.co.uk>
Wasn't it Amir_ni who wrote:
>Hi,
>
>I am trying to make a special shape in povray that is made by spheres, but
>neither "intersection" nor "difference" commands cannot help me. This is the
>problem: if the position of eight spheres are in a cubic form in a way that the
>distance between neighbor sphere is less than 1.4 times the radius of 
>spheres, a
>cavity is formed in the center of cube. I want to make the shape of 
>that cavity.
>The following code contains the the coordinates of eight spheres. In advance, I
>do appreciate your help.

Difference the spheres from a box

difference {

box {d/2, -d/2}

sphere { <d/2, d/2, d/2> ,  d/1.4}
sphere { <-d/2, -d/2, -d/2> ,  d/1.4}

sphere { <-d/2, d/2, d/2> ,  d/1.4}
sphere { <d/2, -d/2, -d/2> ,  d/1.4}

sphere { <d/2, -d/2, d/2> ,  d/1.4}
sphere { <-d/2, d/2, -d/2> ,  d/1.4}

sphere { <d/2, d/2, -d/2> ,  d/1.4}
sphere { <-d/2, -d/2, d/2> ,  d/1.4}

pigment{ color rgb<1,0,0> }
}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Amir ni
Subject: Re: Constructing a geometry
Date: 5 Feb 2009 04:00:00
Message: <web.498aa9d13b9d3d08792c7d270@news.povray.org>
Hi Mike, Thanks! I am new to this site, so it seems I have posted my question in
two different places. Is it possible to make the shape of that cavity as an
independent object like a sphere so that I can use illumination features? I
mean, when I use """  finish{ambient 0.3 specular 0.5 reflection 0.4}  """
inside the difference command block, I think it doesn't illuminates the new
shape, but it first illuminates the sphere and then make a geometrical
subtraction (though I may be wrong). I want to do some illumination effect on
the object so that when I turn the camera, the gloss and other effect can be
observed.


Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it Amir_ni who wrote:
> >Hi,
> >
> >I am trying to make a special shape in povray that is made by spheres, but
> >neither "intersection" nor "difference" commands cannot help me. This is the
> >problem: if the position of eight spheres are in a cubic form in a way that the
> >distance between neighbor sphere is less than 1.4 times the radius of
> >spheres, a
> >cavity is formed in the center of cube. I want to make the shape of
> >that cavity.
> >The following code contains the the coordinates of eight spheres. In advance, I
> >do appreciate your help.
>
> Difference the spheres from a box
>
> difference {
>
> box {d/2, -d/2}
>
> sphere { <d/2, d/2, d/2> ,  d/1.4}
> sphere { <-d/2, -d/2, -d/2> ,  d/1.4}
>
> sphere { <-d/2, d/2, d/2> ,  d/1.4}
> sphere { <d/2, -d/2, -d/2> ,  d/1.4}
>
> sphere { <d/2, -d/2, d/2> ,  d/1.4}
> sphere { <-d/2, d/2, -d/2> ,  d/1.4}
>
> sphere { <d/2, d/2, -d/2> ,  d/1.4}
> sphere { <-d/2, -d/2, d/2> ,  d/1.4}
>
> pigment{ color rgb<1,0,0> }
> }
>
>
> --
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

From: Chris B
Subject: Re: Constructing a geometry
Date: 5 Feb 2009 04:44:12
Message: <498ab4ec$1@news.povray.org>
"Amir_ni" <nomail@nomail> wrote in message 
news:web.498aa9d13b9d3d08792c7d270@news.povray.org...
> Is it possible to make the shape of that cavity as an
> independent object like a sphere so that I can use illumination features? 
> I
> mean, when I use """  finish{ambient 0.3 specular 0.5 reflection 0.4}  """
> inside the difference command block, I think it doesn't illuminates the 
> new
> shape, but it first illuminates the sphere and then make a geometrical
> subtraction (though I may be wrong). I want to do some illumination effect 
> on
> the object so that when I turn the camera, the gloss and other effect can 
> be
> observed.

You should be able to add the finish straight into the 'difference' after 
the 'pigment' definition, or you can place both inside a texture block:

  texture {
    pigment{ color rgb<1,0,0> }
    finish{ambient 0.3 specular 0.5 reflection 0.4}
  }

The 'difference' is a CSG operation (Constructive Solid Geometry) and the 
result is an object that almost always behaves in the same way that 
primitives such as the sphere do.

Regards,
Chris B.


Post a reply to this message

From: Mike Williams
Subject: Re: Constructing a geometry
Date: 5 Feb 2009 04:54:41
Message: <CCTW2oABbriJFweS@econym.demon.co.uk>
Wasn't it Amir_ni who wrote:
>Hi Mike, Thanks! I am new to this site, so it seems I have posted my 
>question in
>two different places. Is it possible to make the shape of that cavity as an
>independent object like a sphere so that I can use illumination features? I
>mean, when I use """  finish{ambient 0.3 specular 0.5 reflection 0.4}  """
>inside the difference command block, I think it doesn't illuminates the new
>shape, but it first illuminates the sphere and then make a geometrical
>subtraction (though I may be wrong). I want to do some illumination effect on
>the object so that when I turn the camera, the gloss and other effect can be
>observed.

You can apply a finish to a difference in exactly the same way as you 
would to a primitive object. The only thing that's different is that if 
one of your spheres also has its own texture or part of a texture (i.e. 
pigment, finish or normal), the texture applied to the sphere is used, 
rather than any part of the texture attached to the difference that 
contains it.

The logic is that that allows you to create CSG shapes that have 
different textures on different parts. [It's most logical if you think 
of a union of differently textured objects].

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Amir ni
Subject: Re: Constructing a geometry
Date: 5 Feb 2009 07:00:01
Message: <web.498ad3b73b9d3d08792c7d270@news.povray.org>
Mike and Chris, thanks. you are right. my system was very small, so I couldn't
see the effects.


Post a reply to this message

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