POV-Ray : Newsgroups : povray.newusers : Superellipsoid type round edge, but for arbitrary shapes : Re: Superellipsoid type round edge, but for arbitrary shapes Server Time
4 Sep 2024 20:13:45 EDT (-0400)
  Re: Superellipsoid type round edge, but for arbitrary shapes  
From: Mike Williams
Date: 26 Aug 2002 03:30:48
Message: <vvAw2BAujda9EwrM@econym.demon.co.uk>
Wasn't it Kaveh who wrote:
>I am trying to create 'wafers' with a small depth, and with rounded edges, a
>bit like those created using the superellipsoid command. I can't find a
>simple way to do this. I have tried creating one shape by joining three
>superellipsoids together, but the result is not perfect. Here is my code:

Perhaps the superellipsoid route isn't appropriate for this type of 
shape. Perhaps it might be better to use cylinder and torus instead, 
something like this:-

#include "colors.inc"

#declare Roundness = .1;
#declare Thickness = .2;
#declare Distance = 1;
#declare Size = 1;

#declare Endpiece=union {
  cylinder {z*Thickness, -z*Thickness, Size-Roundness}
  cylinder {z*(Thickness-Roundness), -z*(Thickness-Roundness), Size}
  torus {Size-Roundness,Roundness rotate x*90 translate z*(Thickness-Roundness)}
  torus {Size-Roundness,Roundness rotate x*90 translate -z*(Thickness-Roundness)}
}

#declare Midpiece=union {
  box {<-Distance,-Size,-Thickness+Roundness><Distance,Size,Thickness-Roundness>}
  box {<-Distance,-Size+Roundness,-Thickness><Distance,Size-Roundness,Thickness>}
  cylinder {-x*Distance,x*Distance,Roundness  translate
<0,Size-Roundness,Thickness-Roundness>}
  cylinder {-x*Distance,x*Distance,Roundness  translate
<0,Size-Roundness,-Thickness+Roundness>}
  cylinder {-x*Distance,x*Distance,Roundness  translate
<0,-Size+Roundness,Thickness-Roundness>}
  cylinder {-x*Distance,x*Distance,Roundness  translate
<0,-Size+Roundness,-Thickness+Roundness>}
}


union {
  object {Endpiece translate x*Distance}
  object {Endpiece translate -x*Distance}
  object {Midpiece pigment {rgb <1,1,0>}}
  pigment {color Yellow}
  finish{phong 1}
}

plane{
  z ,2
 pigment {
  color White
 }
}

//===================================


light_source {<-10,200,-100> color White}


 camera {
    location <-10,10, -30.0>
    look_at  <0.0, 0.0,  0.0>
    angle 10
  }

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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