POV-Ray : Newsgroups : povray.general : Need help generating a cylindrical solid Server Time
27 Dec 2024 14:04:05 EST (-0500)
  Need help generating a cylindrical solid (Message 1 to 10 of 21)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Chaanakya
Subject: Need help generating a cylindrical solid
Date: 28 Aug 2012 10:40:00
Message: <web.503cd818f02e9decb62e53d00@news.povray.org>
Hey guys!

I'm trying to create a sort-of curved slab, if you will.  You can see what I
mean by compiling this code:

#version 3.6;
#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  ambient_light White
  max_trace_level 256
}

camera {
  location <0,0,-2>
  look_at <0,0,0>
}

light_source {
  <100,100,0>
  color White
}

#declare a =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.00003}
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1}
    plane { z,0 }
    pigment { color Red }
    rotate <0,90,0>
    rotate <90,0,0>
  }

object { a }

Now, I want to build the same figure, but piece by piece - start in the middle
and work outwards, with each part being a different color.  I thought I could
modify the object "a" with some more difference statements and I've made quite a
bit of progress on this.  However, there is one sticking point:  when I render
the following code, I get one part of the center-most piece sticking out of the
next larger one.

#version 3.6;
#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  ambient_light White
  max_trace_level 256
}

camera {
  location <0,0,-2>
  look_at <0,0,0>
}

light_source {
  <100,100,0>
  color White
}

// plane {
//   y, -10
//   pigment { hexagon Green, White, Blue }
// }

// box {
//   -0.5, 0.5
//   pigment { checker Red, Blue }
// }

#declare curved_1 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.00003 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.9 }
    plane { -y,0.1 }
    plane { -y,-0.1 }
    plane { x,-0.1 }
    plane { -x,-0.1 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

#declare curved_2 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.00003 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.8 }
    plane { -y,0.2 }
    plane { -y,-0.2 }
    plane { x,-0.2 }
    plane { -x,-0.2 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

object { curved_1 pigment { color Blue } }

object { curved_2 pigment { color Red } }

See how you can see the blue?  It doesn't make sense! I'm trying to figure out
why, when I cut it symmetrically with respect to the origin, this occurs.

Thanks in advance!

- Chaanakya


Post a reply to this message

From: Le Forgeron
Subject: Re: Need help generating a cylindrical solid
Date: 28 Aug 2012 10:55:42
Message: <503cdbee@news.povray.org>
Le 28/08/2012 16:39, Chaanakya a écrit :

> #declare a =
>   difference {
>     cylinder { <-1,0,0>,<1,0,0>,1.00003}
>     cylinder { <-1.00003,0,0>,<1.00003,0,0>,1}
>     plane { z,0 }
>     pigment { color Red }
>     rotate <0,90,0>
>     rotate <90,0,0>
>   }
> 
> object { a }
> 
> Now, I want to build the same figure, but piece by piece - start in the middle
> and work outwards, with each part being a different color.  I thought I could
> modify the object "a" with some more difference statements and I've made quite a
> bit of progress on this.  However, there is one sticking point:  when I render
> the following code, I get one part of the center-most piece sticking out of the
> next larger one.
> 


Keep the shape of a, change the texture for a one based on gradient and
a pigment map.

"pigment { color Red }"
becomes

pigment { gradient x pigment_map{
[0.5 color Red]
[0.5 color Blue]
}
scale ????? your factor here ????
}


Post a reply to this message

From: Chaanakya
Subject: Re: Need help generating a cylindrical solid
Date: 28 Aug 2012 11:00:01
Message: <web.503cdbc951bfcea0b62e53d00@news.povray.org>
"Chaanakya" <nomail@nomail> wrote:
> Hey guys!
>
> I'm trying to create a sort-of curved slab, if you will.  You can see what I
> mean by compiling this code:
>
> #version 3.6;
> #include "colors.inc"
>
> global_settings {
>   assumed_gamma 1.0
>   ambient_light White
>   max_trace_level 256
> }
>
> camera {
>   location <0,0,-2>
>   look_at <0,0,0>
> }
>
> light_source {
>   <100,100,0>
>   color White
> }
>
> #declare a =
>   difference {
>     cylinder { <-1,0,0>,<1,0,0>,1.00003}
>     cylinder { <-1.00003,0,0>,<1.00003,0,0>,1}
>     plane { z,0 }
>     pigment { color Red }
>     rotate <0,90,0>
>     rotate <90,0,0>
>   }
>
> object { a }
>
> Now, I want to build the same figure, but piece by piece - start in the middle
> and work outwards, with each part being a different color.  I thought I could
> modify the object "a" with some more difference statements and I've made quite a
> bit of progress on this.  However, there is one sticking point:  when I render
> the following code, I get one part of the center-most piece sticking out of the
> next larger one.
>
> #version 3.6;
> #include "colors.inc"
>
> global_settings {
>   assumed_gamma 1.0
>   ambient_light White
>   max_trace_level 256
> }
>
> camera {
>   location <0,0,-2>
>   look_at <0,0,0>
> }
>
> light_source {
>   <100,100,0>
>   color White
> }
>
> // plane {
> //   y, -10
> //   pigment { hexagon Green, White, Blue }
> // }
>
> // box {
> //   -0.5, 0.5
> //   pigment { checker Red, Blue }
> // }
>
> #declare curved_1 =
>   difference {
>     cylinder { <-1,0,0>,<1,0,0>,1.00003 }
>     cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
>     plane { z,0.9 }
>     plane { -y,0.1 }
>     plane { -y,-0.1 }
>     plane { x,-0.1 }
>     plane { -x,-0.1 }
>     // rotate <0,90,0>
>     // rotate <90,0,0>
>   }
>
> #declare curved_2 =
>   difference {
>     cylinder { <-1,0,0>,<1,0,0>,1.00003 }
>     cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
>     plane { z,0.8 }
>     plane { -y,0.2 }
>     plane { -y,-0.2 }
>     plane { x,-0.2 }
>     plane { -x,-0.2 }
>     // rotate <0,90,0>
>     // rotate <90,0,0>
>   }
>
> object { curved_1 pigment { color Blue } }
>
> object { curved_2 pigment { color Red } }
>
> See how you can see the blue?  It doesn't make sense! I'm trying to figure out
> why, when I cut it symmetrically with respect to the origin, this occurs.
>
> Thanks in advance!
>
> - Chaanakya

Never mind.  I fixed it by changing plane { -y,0.2 } and plane { -y,0.1 } to
plane { y,-0.2} and plane {y,-0.1 }.


Post a reply to this message

From: Chaanakya
Subject: Re: Need help generating a cylindrical solid
Date: 28 Aug 2012 11:10:01
Message: <web.503cde6a51bfcea0b62e53d00@news.povray.org>
Le_Forgeron <lef### [at] freefr> wrote:
> Le 28/08/2012 16:39, Chaanakya a écrit :
>
> > #declare a =
> >   difference {
> >     cylinder { <-1,0,0>,<1,0,0>,1.00003}
> >     cylinder { <-1.00003,0,0>,<1.00003,0,0>,1}
> >     plane { z,0 }
> >     pigment { color Red }
> >     rotate <0,90,0>
> >     rotate <90,0,0>
> >   }
> >
> > object { a }
> >
> > Now, I want to build the same figure, but piece by piece - start in the middle
> > and work outwards, with each part being a different color.  I thought I could
> > modify the object "a" with some more difference statements and I've made quite a
> > bit of progress on this.  However, there is one sticking point:  when I render
> > the following code, I get one part of the center-most piece sticking out of the
> > next larger one.
> >
>
>
> Keep the shape of a, change the texture for a one based on gradient and
> a pigment map.
>
> "pigment { color Red }"
> becomes
>
> pigment { gradient x pigment_map{
> [0.5 color Red]
> [0.5 color Blue]
> }
> scale ????? your factor here ????
> }

So the final application of this is to put in different indices of refraction
for each piece.  Would this technique still work?  Also, although nothing sticks
out right now (a good sign), I can't get the innermost piece to show up even
when doing a difference between the two pieces like so:

#declare curved_1 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.00003 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.9 }
    plane { y,-0.1 }
    plane { -y,-0.1 }
    plane { x,-0.1 }
    plane { -x,-0.1 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

#declare curved_2 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.00003 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.8 }
    plane { y,-0.2 }
    plane { -y,-0.2 }
    // plane { y,0 }
    plane { x,-0.2 }
    plane { -x,-0.2 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

object { curved_1 pigment { color Blue } }

difference {
  object { curved_2 }
  object { curved_1 }
  pigment { color Red }
}

Furthermore, when I made the difference translucent, I still saw nothing of
curved_1.  What am I doing wrong?

Thanks!

- Chaanakya


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Need help generating a cylindrical solid
Date: 28 Aug 2012 11:13:48
Message: <503ce02c$1@news.povray.org>
Chaanakya wrote:

> See how you can see the blue?  It doesn't make sense! I'm trying to figure out
> why, when I cut it symmetrically with respect to the origin, this occurs.

I think your y cutting planes may not be what you intended


You probably want

plane { -y,-0.1 }
plane {  y,-0.1 }


Post a reply to this message

From: Chaanakya
Subject: Re: Need help generating a cylindrical solid
Date: 28 Aug 2012 11:20:01
Message: <web.503ce11951bfcea0b62e53d00@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Chaanakya wrote:
>
> > See how you can see the blue?  It doesn't make sense! I'm trying to figure out
> > why, when I cut it symmetrically with respect to the origin, this occurs.
>
> I think your y cutting planes may not be what you intended

>
> You probably want
>
> plane { -y,-0.1 }
> plane {  y,-0.1 }

Thanks Christian!  Yeah, I realized that (see my third post).  Now I have a
different problem.  Even if I do a difference on the two objects, I can't see
curved_1 (or a hole in the difference) and I'm trying to figure out what might
be the cause of that.

Thanks!

- Chaanakya


Post a reply to this message

From: Chaanakya
Subject: Re: Need help generating a cylindrical solid
Date: 28 Aug 2012 11:30:01
Message: <web.503ce3af51bfcea0b62e53d00@news.povray.org>
"Chaanakya" <nomail@nomail> wrote:
> Christian Froeschlin <chr### [at] chrfrde> wrote:
> > Chaanakya wrote:
> >
> > > See how you can see the blue?  It doesn't make sense! I'm trying to figure out
> > > why, when I cut it symmetrically with respect to the origin, this occurs.
> >
> > I think your y cutting planes may not be what you intended

> >
> > You probably want
> >
> > plane { -y,-0.1 }
> > plane {  y,-0.1 }
>
> Thanks Christian!  Yeah, I realized that (see my third post).  Now I have a
> different problem.  Even if I do a difference on the two objects, I can't see
> curved_1 (or a hole in the difference) and I'm trying to figure out what might
> be the cause of that.
>
> Thanks!
>
> - Chaanakya

No worries.  It's the old friend Mr. Coincidental Surfaces :P  This problem has
been resolved! :)

- Chaanakya


Post a reply to this message

From: Chaanakya
Subject: Re: Need help generating a cylindrical solid
Date: 28 Aug 2012 11:40:01
Message: <web.503ce5a451bfcea0b62e53d00@news.povray.org>
"Chaanakya" <nomail@nomail> wrote:
> "Chaanakya" <nomail@nomail> wrote:
> > Christian Froeschlin <chr### [at] chrfrde> wrote:
> > > Chaanakya wrote:
> > >
> > > > See how you can see the blue?  It doesn't make sense! I'm trying to figure out
> > > > why, when I cut it symmetrically with respect to the origin, this occurs.
> > >
> > > I think your y cutting planes may not be what you intended

> > >
> > > You probably want
> > >
> > > plane { -y,-0.1 }
> > > plane {  y,-0.1 }
> >
> > Thanks Christian!  Yeah, I realized that (see my third post).  Now I have a
> > different problem.  Even if I do a difference on the two objects, I can't see
> > curved_1 (or a hole in the difference) and I'm trying to figure out what might
> > be the cause of that.
> >
> > Thanks!
> >
> > - Chaanakya
>
> No worries.  It's the old friend Mr. Coincidental Surfaces :P  This problem has
> been resolved! :)
>
> - Chaanakya

Looks like I spoke too quickly :P  I found yet another problem :(  Using this
method, I can only generate 'layers', so to speak, on the back part of the
resulting curved slab (the part that curves away from the viewer).  How do I
generate layers throughout the solid?

Thanks!

- Chaanakya


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Need help generating a cylindrical solid
Date: 28 Aug 2012 18:37:58
Message: <503d4846@news.povray.org>
Chaanakya wrote:

> Looks like I spoke too quickly :P  I found yet another problem :(  Using this
> method, I can only generate 'layers', so to speak, on the back part of the
> resulting curved slab (the part that curves away from the viewer).  How do I
> generate layers throughout the solid?

if you flip your z-plane the same cutting metod should work on the side
facing the viewer? Alternatively rotating the back part by 180 degrees
about the y axis gives you the corresponding object due to symmetry.

Of course you might wish to step back and rethink why you are doing
this. If you simply wish to change the texture depending on position a
gradient or cylindrical pattern with color_map would be much better.


Post a reply to this message

From: Chaanakya
Subject: Re: Need help generating a cylindrical solid
Date: 29 Aug 2012 11:45:01
Message: <web.503e384751bfcea0b62e53d00@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> Chaanakya wrote:
>
> > Looks like I spoke too quickly :P  I found yet another problem :(  Using this
> > method, I can only generate 'layers', so to speak, on the back part of the
> > resulting curved slab (the part that curves away from the viewer).  How do I
> > generate layers throughout the solid?
>
> if you flip your z-plane the same cutting metod should work on the side
> facing the viewer? Alternatively rotating the back part by 180 degrees
> about the y axis gives you the corresponding object due to symmetry.
>
> Of course you might wish to step back and rethink why you are doing
> this. If you simply wish to change the texture depending on position a
> gradient or cylindrical pattern with color_map would be much better.

So the reason I'm doing this is because POV-Ray doesn't support a gradient in
the index of refraction (which is perfectly fine).  I would like to essentially
have a gradient from the center extending outwards.  It shouldn't be hard, but
apparently it's not very easy for me to visualize or something, because it's
just not working.  What I need is a way to create the exact same object, but
from shells (using difference and so forth).  The concept works perfectly well,
but in practice....

If a color map can change the index of refraction, I'm all for it.  But somehow,
I don't think a color map can vary the index of refraction (please correct me if
I'm wrong).  That's why I actually need to 'assemble' the object as opposed to
using a superficial method of coloring.

Now what I'm trying to figure out is why the object won't assemble the way I
assumed it would when I used the following code:

#version 3.6;
#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  ambient_light White
  max_trace_level 256
}

camera {
  location <0,3,3>
  look_at <0,0,0>
}

light_source {
  <100,100,0>
  color White
}

// plane {
//   y, -10
//   pigment { hexagon Green, White, Blue }
// }

// box {
//   -0.5, 0.5
//   pigment { checker Red, Blue }
// }

#declare curved_1 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.5 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.9 }
    plane { y,-0.1 }
    plane { -y,-0.1 }
    plane { x,-0.1 }
    plane { -x,-0.1 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

#declare curved_2 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.5 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.8 }
    plane { y,-0.2 }
    plane { -y,-0.2 }
    plane { x,-0.2 }
    plane { -x,-0.2 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

#declare curved_3 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.5 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.7 }
    plane { y,-0.3 }
    plane { -y,-0.3 }
    plane { x,-0.3 }
    plane { -x,-0.3 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

#declare curved_4 =
  difference {
    cylinder { <-1,0,0>,<1,0,0>,1.5 }
    cylinder { <-1.00003,0,0>,<1.00003,0,0>,1 }
    plane { z,0.6 }
    plane { y,-0.4 }
    plane { -y,-0.4 }
    plane { x,-0.4 }
    plane { -x,-0.4 }
    // rotate <0,90,0>
    // rotate <90,0,0>
  }

object { curved_1 pigment { color Blue } }

difference {
  object { curved_2 }
  object { curved_1 scale 1.000001 }
  pigment {
    color Red
  }
}

difference {
  object { curved_3 }
  object { curved_2 scale 1.00001 }
  pigment {
    color Green
  }
}

difference {
  object { curved_4 }
  object { curved_3 scale 1.00001 }
  pigment {
    color Yellow
  }
}

As opposed to the different colors being shown throughout the object, I am only
seeing the different 'shells' on one side of the object, which is quite weird.
As far as I can see, from this code, it should be 'building up' the object with
different colored shells.  I stress again that the final objective is not
colors, but indices of refraction.  I'm just using colors right now because it's
easy to see the different layers.

Thanks in advance!

- Chaanakya


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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