POV-Ray : Newsgroups : povray.binaries.images : Rounded Prisms : Re: Rounded Prisms Server Time
1 Jun 2024 17:05:14 EDT (-0400)
  Re: Rounded Prisms  
From: PM 2Ring
Date: 23 Nov 2005 21:50:00
Message: <web.438525007ed7ae6cdd5514710@news.povray.org>
"Joanne Simpson" <cor### [at] onewhiteravencom> wrote:
> > Look fantastic - could make some great abstract images using these!! Be
> > great to post the source.  Great work!  Adrian
>
> yes, please post the source - I am looking for some nice tesselations /
> Penrose tilings for a garden pavement.
> Joanne

Ok, this one can do regular & irregular polygons and polyominoes, but in a
few days I'll post one that does a better job with polyominoes (after I've
cleaned it up a bit more). The scene file below can do polyo's but they're
not suitable for tiling, since the rounding is added to the outside of the
shape. That's ok for regular polygons, since we can just use scaling to
make them fit together, but for polyominoes the rounding really needs to be
done within the borders of the squares.

// Persistence of Vision Ray Tracer Scene Description File
// File: IsoTest
// Vers: 3.5
// Desc: Sandy ground & other IsoSurfaces
// Date: 11 Apr 2004
// Auth: PM 2Ring
//
// -d +A0.2 +AM2 +R4
// -F -A0.4 +AM2 +R1
// +A0.1 +AM2 +R3
//

#version 3.6;

global_settings {
  assumed_gamma 1
  max_trace_level 7
}

#declare SkyBlue = rgb<.035, .27, .67>*.6;              //For water & sky
#declare SkyRad = 1E3;

camera {
  location <0, 8, -12.0> * 1.35
 // location <0, 5, -12.0> * 3 *1.3
  //location <0, 97, -5>
  right x*image_width/image_height
  direction 2*z
  angle 30
  look_at  -2*y
}

#declare LightLoc = <1, 4, -3> * 105;
light_source {
  LightLoc rgb 1.2
  //parallel point_at 0
  //looks_like{sphere{LightLoc, 3E2 pigment{rgb<1,1,.8>}finish{ambient 1.5
diffuse 0}}}
}

//---Textures--------------------------------------------------------------

#declare CM_Clouds =
color_map {
    [0.0   rgb 1]
    [0.05  rgb 0.85]
    [0.20  rgb 0.75]
    [0.45 SkyBlue]
}

#declare T_Clouds =
texture{
  pigment {
    bozo
    color_map {CM_Clouds}

    warp{
      //turbulence 0.75
      turbulence 0.175
      octaves 7
      omega 0.7
      lambda 2.25
    }
  }
  finish{ambient 0.9 diffuse 0.2}
}

#declare FThing =
finish{
  ambient 0.05 diffuse .85
  specular .75 roughness 1e-4
  reflection .25 diffuse .7
}

#declare TGround =
texture{
  pigment{
    //crackle
    //cells
    wrinkles
    color_map{[0 rgb 1][0.025 rgb .25][0.1 rgb .75][0.15 rgb <.85 .75
....65>][1 rgb 1]}
    scale 1.5 / 10
  }
  finish{
    ambient .05 diffuse .675
    //specular .5 roughness 1e-6
    specular .25 roughness 1e-3
    //reflection .15
  }
}

//---Objects-------------------------------------------

#declare Ground =
cylinder{
  -y, 0, SkyRad/20

  texture{TGround}
}

//Convert 2D to 3D
#macro V3D(A, H)<A.u,H,A.v>#end

//Generalized Rounded Prism
#macro RPrism(Vtx, Sides, SH, SR)
  //merge{
  union{
  #if(1)
    prism{
      linear_spline 0, SH, Sides+1,
      #local I=0;
      #while(I<=Sides)
        Vtx[I]
        #local I=I+1;
      #end
    }
    #end

    #local SH = SH - SR;
    #local I=0;
    #while(I<Sides)
      #local II = mod(I+1,Sides);
      #local A0 = V3D(Vtx[I],0);
      #local A1 = V3D(Vtx[I],SH);
      #local DV = Vtx[II]-Vtx[I];

      sphere{A1, SR}
      cylinder{0, SH*y, SR translate A0}
      cylinder{A1, V3D(Vtx[II],SH), SR }
      #local Panel = box{z*1e-3, <vlength(DV), SH, SR>}   //Side panel
      object{Panel rotate y*atan2(-DV.y,DV.x)*180/pi translate A0}

      #local I=I+1;
    #end
  }
#end

#macro NPrism(Rad, Sides, SH, SR)
  #local Vtx = array[Sides+1];    //To store polygon vertices
  #local Ang = -2*pi/Sides;
  #local Rad = Rad - SR;
  #local I=0;
  #while(I<=Sides)
    #local Vtx[I] = <cos(Ang*I), sin(Ang*I)>*Rad;
    #local I=I+1;
  #end
  #local Vtx[Sides/2] = Vtx[Sides/2] * -.5;          //perturb 1 vertex to
test rounding
  RPrism(Vtx, Sides, SH, SR)
#end


#macro PolyPrism(SH, SR)
  #local Sides = 8;
  #local Vtx = array[Sides+1]
  {
    <-3,2>, <3,2>, <3,0>,
    <1,0>, <1,-2>, <-1,-2>,<-1,0>,
    <-3,0>,<-3,2>
  }

  RPrism(Vtx, Sides, SH, SR)
#end

#declare Thing =
object{
  //PolyPrism(.75, .15)
  NPrism(3, 6, 1, .15)
  pigment{rgb 1}
  //pigment{rgb <0 .15 .75>}
  finish{FThing}

  translate y*1e-4
}

//--------------------------The actual scene-------------------

#declare Sky =
sphere{-y*SkyRad*.9, SkyRad
  inverse
  no_shadow
  texture{
    T_Clouds
    scale <1 .85 1> *  SkyRad/10 rotate 25*y
  }
}

#if(1)
  object{Sky}
#else
  background{SkyBlue}
  //background{rgb 1}
#end

object{Ground}
object{Thing rotate -35*y translate -3*z}

//-------------------------End of file-------------------------


Here's another sneak preview of tiled polyominoes:


Post a reply to this message


Attachments:
Download 'rprismdf4s.jpg' (101 KB)

Preview of image 'rprismdf4s.jpg'
rprismdf4s.jpg


 

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