POV-Ray : Newsgroups : povray.text.scene-files : baseball field pattern Server Time
31 Oct 2024 12:18:18 EDT (-0400)
  baseball field pattern (Message 1 to 1 of 1)  
From: omniverse
Subject: baseball field pattern
Date: 12 Sep 2010 16:15:00
Message: <web.4c8d33fd783aca39d939a6800@news.povray.org>
/*
In response to lester about a baseball field, posted (wrong group?) at
http://news.povray.org/web.4c85a9c21a759ffdb295fc90%40news.povray.org

This was a lesson for me in using object pattern. I couldn't remember what was
possible with it, thinking it was limited to 2 textures not just colors. And I
thought more complex CSG could be done but I wasn't able so went about using
layered textures from several simple CSG object patterns.
Anyway, needs much improvement just to add correct dimensions of real baseball
fields which I didn't bother to find. Just fun for me, trying something new
again in POV-Ray. No doubt this could be done batter-- er, better.  ;^)
*/
/* baseball field pattern */

//cmd:+w400 +h350 +a0.2 +r4

camera
{
 orthographic
 location <0,1111,88>
 look_at <0,0,88>
 up 350*z
 right 400*x
}

// lights not needed, ambient used instead

#declare InfieldPattern=
difference // infield grass
{
 box
 {
  <-45,-1,-45>, <45,1,45>
  rotate 45*y
 }
 cylinder
 {
  <0,-1.1,0>, <0,1.1,0>,
  11
 }
 cylinder
 {
  <0,-1.1,-63>, <0,1.1,-63>,
  15
 }
 cylinder
 {
  <-60,-1.1,0>, <-60,1.1,0>,
  12
 }
 cylinder
 {
  <60,-1.1,0>, <60,1.1,0>,
  12
 }
 cylinder
 {
  <0,-1.1,60>, <0,1.1,60>,
  12
 }
 scale <1,1,1>
} // end infield

#declare OutfieldPattern=
difference // outfield grass
{
 cylinder
 {
  <0,-1,0>, <0,1,0>,
  250
  scale <0.88,1,1>
 }
 cylinder
 {
  <0,-1.1,0>, <0,1.1,0>,
  90
 }
 box
 {
  <0,-1.1,0>, <360,1.1,360>
  rotate -45*y
  translate -88*z
  inverse
 }
 scale <1,1,1>
} // end outfield

#declare FoulLinesPattern=
union // lines
{
 box
 {
  0,1
  scale <0.8,0.15,260>
  rotate -45*y
  translate <-9,0,-62>
 }
 box
 {
  0,1
  scale <0.8,0.15,260>
  rotate 45*y
  translate <9,0,-62>
 }
 difference // batter's box
 {
  box
  {
   -1,1
  }
  box
  {
   -1,1
   scale <0.8,1.1,0.8>
  }
  scale <3,0.15,5>
  translate <-6,0,-67>
 }
 difference // batter's box
 {
  box
  {
   -1,1
  }
  box
  {
   -1,1
   scale <0.8,1.1,0.8>
  }
  scale <3,0.15,5>
  translate <6,0,-67>
 }
} // end lines

#declare BasesPattern=
union // bases
{
 box // 1st
 {
  -1,1
  scale <2,0.1,2>
  rotate 45*y
  translate <67,0,0>
 }
 box // 2nd
 {
  -1,1
  scale <2,0.1,2>
  rotate 45*y
  translate <0,0,67>
 }
 box // 3rd
 {
  -1,1
  scale <2,0.1,2>
  rotate 45*y
  translate <-67,0,0>
 }
 difference // home
 {
  box
  {
   -1,1
   scale <2,0.1,2>
  }
  box
  {
   -1,1
   scale <3,0.11,3>
   rotate 45*y
   translate 2*z
   inverse
  }
  translate <0,0,-67>
 }
 box // pitch
 {
  -1,1
  scale <2.5,0.1,0.75>
  translate <0,0,2>
 }
} // end bases


union // baseball field (not proper dimensions)
{
 box
 {
  <1,-0.1,1>, <360,0,360>
 }
 cylinder
 {
  <15,-0.1,15>, <15,-0.001,15>
  18
  pigment {rgb <0.7,0.4,0.1>}
  finish {ambient 1}
 }
 rotate -45*y
 translate -90*z
 clipped_by
 {
  cylinder
  {
   -y, y, 250
   scale <0.88,1,1>
  }
 }
 texture // object patterns as layered textures
 {
  pigment
  {
   object {
                        OutfieldPattern rgb <0.7,0.4,0.1>, rgb <0.1,0.5,0.1>
                        }
  }
  finish
  {
   ambient 1
  }
 }
 texture
 {
  pigment
  {
   object {
                        InfieldPattern rgbt 1, rgb <0.1,0.5,0.1>
                        }
  }
  finish
  {
   ambient 1
  }
 }
 texture
 {
  pigment
  {
   object {
                        FoulLinesPattern rgbt 1, rgb <1,1,1>
                        }
  }
  finish
  {
   ambient 1
  }
 }
 texture
 {
  pigment
  {
   object {
                        BasesPattern rgbt 1, rgb <1,1,1>
                        }
  }
  finish
  {
   ambient 1
  }
 }
} // end baseball field


Post a reply to this message

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