POV-Ray : Newsgroups : povray.newusers : map a prism onto a sphere Server Time
28 Jul 2024 16:18:59 EDT (-0400)
  map a prism onto a sphere (Message 1 to 7 of 7)  
From: HarryK
Subject: map a prism onto a sphere
Date: 27 Feb 2008 15:15:00
Message: <web.47c5c35db1099ea68e94e7980@news.povray.org>
Hi folks

I want to map a prism with n vertices, height_1=0 and height_2=0.001 onto the
surface of a sphere. Then I want to create the intersection of the sphere and
the mapped prism so that only the prism is visible. Can anybody help me?

Thanks in advance


      HarryK


Post a reply to this message

From: Tim Attwood
Subject: Re: map a prism onto a sphere
Date: 27 Feb 2008 20:00:52
Message: <47c607c4@news.povray.org>
> I want to map a prism with n vertices, height_1=0 and height_2=0.001 onto 
> the
> surface of a sphere. Then I want to create the intersection of the sphere 
> and
> the mapped prism so that only the prism is visible. Can anybody help me?

This sort of shape probably could be achieved by
turning your prism into a height_field, then using
the HF_Sphere macro from shapes.inc to map the
height_field to the spherical mesh. You could then
use CSG to isolate the prism portion.

To turn a prism into a height_field image you can
set up an orthographic camera and use a gradient
pigment that fades from black to white with a
ambient 1 finish.


Post a reply to this message

From: Chris B
Subject: Re: map a prism onto a sphere
Date: 28 Feb 2008 03:52:00
Message: <47c67630@news.povray.org>
"HarryK" <hko### [at] t-onlinede> wrote in message 
news:web.47c5c35db1099ea68e94e7980@news.povray.org...
> Hi folks
>
> I want to map a prism with n vertices, height_1=0 and height_2=0.001 onto 
> the
> surface of a sphere. Then I want to create the intersection of the sphere 
> and
> the mapped prism so that only the prism is visible. Can anybody help me?
>
> Thanks in advance
>
>
>      HarryK
>

Hi Harry,

I'm wondering whether a prism defined using a conic_sweep would do what you 
want.
You could use it to make a prism that's 0.001 units higher than the radius 
of the sphere you wish to map the prism onto. Then use two spheres to slice 
a 0.001 unit thick spherical layer out of the prism.

For example:

light_source {<2,7.5,-15>, rgb 1}
camera {location <0,1.4,-1> look_at <0,1,0>}

difference {
  intersection {
    prism {
      cubic_spline  conic_sweep
      0, 1.001, 14,
      // Outer Rim
      <-0.4,-0.4>, <-0.3,-0.3>, <0.3,-0.3>,
      <0.3,0.5>, <-0.3,0.5>, <-0.3,-0.3>,
      <-0.4,-0.2>
      // Inner Cutout
      <-0.1,-0.3>, <-0.2,-0.2>, <0.2,-0.2>,
      <0.2,0.4>, <-0.2,0.4>, <-0.2,-0.2>,
      <-0.3,-0.1>
    }
    sphere {0,1.001}
  }
  sphere {0,1}
  pigment {rgb <1,1,0>}
}


Post a reply to this message

From: HarryK
Subject: Re: map a prism onto a sphere
Date: 7 Mar 2008 12:25:00
Message: <web.47d172f74b94145ace31411f0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "HarryK" <hko### [at] t-onlinede> wrote in message
> news:web.47c5c35db1099ea68e94e7980@news.povray.org...
> > Hi folks
> >
> > I want to map a prism with n vertices, height_1=0 and height_2=0.001 onto
> > the
> > surface of a sphere. Then I want to create the intersection of the sphere
> > and
> > the mapped prism so that only the prism is visible. Can anybody help me?
> >
> > Thanks in advance
> >
> >
> >      HarryK
> >
>
> Hi Harry,
>
> I'm wondering whether a prism defined using a conic_sweep would do what you
> want.
> You could use it to make a prism that's 0.001 units higher than the radius
> of the sphere you wish to map the prism onto. Then use two spheres to slice
> a 0.001 unit thick spherical layer out of the prism.
>
> For example:
>
> light_source {<2,7.5,-15>, rgb 1}
> camera {location <0,1.4,-1> look_at <0,1,0>}
>
> difference {
>   intersection {
>     prism {
>       cubic_spline  conic_sweep
>       0, 1.001, 14,
>       // Outer Rim
>       <-0.4,-0.4>, <-0.3,-0.3>, <0.3,-0.3>,
>       <0.3,0.5>, <-0.3,0.5>, <-0.3,-0.3>,
>       <-0.4,-0.2>
>       // Inner Cutout
>       <-0.1,-0.3>, <-0.2,-0.2>, <0.2,-0.2>,
>       <0.2,0.4>, <-0.2,0.4>, <-0.2,-0.2>,
>       <-0.3,-0.1>
>     }
>     sphere {0,1.001}
>   }
>   sphere {0,1}
>   pigment {rgb <1,1,0>}
> }


Hi Chris,

your proposal works quite well, when the prism is appriximate
symmetric to the origin. Unfortenately my prism looks like a leaf and is not
symmetric. But I found a solution to map the outline of the prism onto
a sphere and get it as an object. I tried intersection and difference,

helps me?


Thanks in advance
                      HarryK


Post a reply to this message

From: Chris B
Subject: Re: map a prism onto a sphere
Date: 7 Mar 2008 14:51:17
Message: <47d19cb5@news.povray.org>
"HarryK" <hko### [at] t-onlinede> wrote in message 
news:web.47d172f74b94145ace31411f0@news.povray.org...
> "Chris B" <nom### [at] nomailcom> wrote:
>> "HarryK" <hko### [at] t-onlinede> wrote in message
>> news:web.47c5c35db1099ea68e94e7980@news.povray.org...
>> > Hi folks
>> >
>> > I want to map a prism with n vertices, height_1=0 and height_2=0.001 
>> > onto
>> > the
>> > surface of a sphere. Then I want to create the intersection of the 
>> > sphere
>> > and
>> > the mapped prism so that only the prism is visible. Can anybody help 
>> > me?
>> >
>
> Hi Chris,
>
> your proposal works quite well, when the prism is appriximate
> symmetric to the origin. Unfortenately my prism looks like a leaf and is 
> not
> symmetric. But I found a solution to map the outline of the prism onto
> a sphere and get it as an object. I tried intersection and difference,

> helps me?
>
>
> Thanks in advance
>                      HarryK
>
Hi again Harry,

Several different approaches could get you moving in the right direction, 
but I'm actually having a bit of a problem understanding your descriptions 
of what it is you're trying to achieve. Indeed it was only when I read Tim's 
answer that I thought of the conical prism solution.

Is there an image of something similar to what you're trying to achieve out 
on the Internet that you could point us to with a URL or something? 
Otherwise it may be worth adding a few more words to describe the difference 
between what you can do so far and what you want to achieve. Is the problem 
that the 'leaf-like' shape doesn't wrap far enough around the sphere? Is it 
that you're getting flat sections where the prism isn't being extended high 
enough?  Are you getting unwanted bulges or some other sort of distortions 
that you wish to eliminate?

If you don't need your 'object' to have any real thickness, you could look 
at using the prism as an object pigment and using either cylindrical or 
spherical warps to map it around a sphere. By defining the outside of the 
prism as transparent you would then get something that would look like a 
thin shell that conforms to the shape of your prism, but it could be wrapped 
completely or almost completely around the sphere. There's a link here 
http://lib.povray.org/collection/labeller/chrisb%201.0/labeller.html that 
shows a similar sort of effect with the label on the far right.

Otherwise there may be some way to use Constructive Solid Geometry to take a 
succession of slices and re-assemble the pieces, but this would be very 
dependent upon the type of result you need.

Regards,
Chris B.








Regards,
Chris B.


Post a reply to this message

From: Tim Attwood
Subject: Re: map a prism onto a sphere
Date: 7 Mar 2008 19:26:49
Message: <47d1dd49$1@news.povray.org>
>Do you have an idea, that helps me?

Something like this... it can take a while to parse,
but you can save it as a mesh, then #include
the mesh instead of generating the mesh
every time.

#declare L = prism{
 cubic_spline
 0,
 1,
 19,
 <0.040627,0.911213>,
 <0.197333,0.998271>,
 <0.377254,0.928624>,
 <0.528155,0.661645>,
 <0.737096,0.133490>,
 <0.893801,0.150901>,
 <0.946036,0.075451>,
 <0.853174,0.017412>,
 <0.655841,0.075451>,
 <0.493332,0.325019>,
 <0.284391,0.011608>,
 <0.214744,0.098666>,
 <0.458508,0.475920>,
 <0.377254,0.789331>,
 <0.220548,0.887997>,
 <0.087059,0.824154>,
 <0.040627,0.911213>,
 <0.197333,0.998271>,
 <0.377254,0.928624>
 scale <0.9,1,0.9>
 translate <0.05,0,0.05>
};

#declare pig = pigment{
   object {
      L
      Black
      White
   }
   rotate <-90,0,0>
   translate <-0.5,-0.5,0>
};

#declare fn_pig = function{pigment{pig}};

#declare fn_H = function {fn_pig(x,y,z).gray};

#ifndef (SHAPES_INC_TEMP) #include "shapes.inc" #end

#declare S = object {
  HF_Sphere(fn_H, off, off, <1000,1000>, on, "", <0,0,0>, 1, 0.01)
};

difference {
   object {S}
   sphere {<0,0,0>,1.005}
   pigment {Yellow}
   rotate <0,0,0>
}


Post a reply to this message

From: Tim Attwood
Subject: Re: map a prism onto a sphere
Date: 7 Mar 2008 19:49:47
Message: <47d1e2ab$1@news.povray.org>
Note that in your case you could also just use
a uv mapped pigment with clear areas, since
the height of what you are describing is very
thin anyways.

#declare decal = texture {
   pigment {
      uv_mapping
      object {
         text {ttf "timrom.ttf" "Sample Text" 2,0
            scale <0.2,0.2,1>
            translate <0,0.4,-1>
         }
         Clear
         Red
      }
   }
};

sphere {<0,0,0>,1
  texture {decal}
}


Post a reply to this message

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