POV-Ray : Newsgroups : povray.binaries.images : slice an object Server Time
5 Nov 2024 02:18:37 EST (-0500)
  slice an object (Message 1 to 3 of 3)  
From: Meothuru
Subject: slice an object
Date: 13 Dec 2007 00:50:00
Message: <web.4760c6f48605ee6f5a73e3b40@news.povray.org>


Post a reply to this message


Attachments:
Download 'sliced_object.png' (77 KB)

Preview of image 'sliced_object.png'
sliced_object.png


 

From: Leef me
Subject: Re: slice an object
Date: 13 Dec 2007 13:15:01
Message: <web.47617616bef053202a7b15450@news.povray.org>
"Meothuru" <nomail@nomail> wrote:
>

Very nice.

I was trying to do something like that with a 3-d heart shape. I didn't succeed
and the project was time sensitive.

My idea was to use several 'intersection' statements between the object and
boxes, then be able to make the pieces fly into place. Hmmm, blob might have
been nice too.

Now that you have the method, please use it wisely. No poser characters should
be harmed. ;)

Code would be appreciated.

Leef_me


Post a reply to this message

From: Meothuru
Subject: Re: slice an object
Date: 14 Dec 2007 00:50:01
Message: <web.476218acbef053205a73e3b40@news.povray.org>
"Leef_me" <nomail@nomail> wrote:
> "Meothuru" <nomail@nomail> wrote:
> >
>
> Very nice.
>
> I was trying to do something like that with a 3-d heart shape. I didn't succeed
> and the project was time sensitive.
>
> My idea was to use several 'intersection' statements between the object and
> boxes, then be able to make the pieces fly into place. Hmmm, blob might have
> been nice too.
>
> Now that you have the method, please use it wisely. No poser characters should
> be harmed. ;)
>
> Code would be appreciated.
>
> Leef_me



Heres is the exported SDL-code from the KPOV-modeler (it is machine-generated
code, not handcoded.). Hope it helps ...

//---------------------------
//*PMRawBegin
#include "textures.inc"
//*PMRawEnd

global_settings {
   adc_bailout 0.0039216
   assumed_gamma 1.5
   max_trace_level 256
   noise_generator 2
}

// this is the object you want to slice

#declare myObject = difference {
   union {
      cylinder {
         <1, 0, 0>, <-1, 0, 0>, 0.5
         scale 1
         rotate <0, 0, 0>
         translate y*0.25
      }

      cylinder {
         <-0.75, 0, 0>, <-1, 0, 0>, 0.535
         scale 1
         rotate <0, 0, 0>
         translate y*0.25
      }

      cylinder {
         <1, 0, 0>, <-1, 0, 0>, 0.5
         scale 1
         rotate <0, 0, 0>
         translate y*(-0.25)
      }

      cylinder {
         <-0.75, 0, 0>, <-1, 0, 0>, 0.535
         scale 1
         rotate <0, 0, 0>
         translate y*(-0.25)
      }
   }

   superellipsoid {
      <0.2, 0.2>
      scale <1, 0.5, 1>
      rotate <0, 0, 0>
      translate x*1.2642
   }

   torus {
      0.5, 0.25
      scale <1, 1.15, 1>
      rotate x*90
      translate x*0.7
   }

   cylinder {
      <0, 0.8, 0>, <0, -0.8, 0>, 0.1
      scale 1
      rotate <0, 0, 0>
      translate x*0.5
   }

   box {
      <-1.001, -0.075, -0.5>, <0.5, 0.075, -0.375>
      scale 1
      rotate <0, 0, 0>
      translate <0, 0, 0>
   }

   box {
      <-1.001, -0.075, 0.375>, <0.5, 0.075, 0.5>
      scale 1
      rotate <0, 0, 0>
      translate <0, 0, 0>
   }

   pigment {
      color rgb <0.9, 0.9, 0.9>
   }

   finish {
      //*PMRawBegin
      Dull
      //*PMRawEnd
   }
   scale 1
   rotate z*90
   translate <0, 0, 0>
}

// this is the definition of the slice (intersection)

#declare Slice = box {
   <-1, -0.05, -1>, <1, 0.05, 1>
   translate y*(-1.06)

   // set the  slice at the bottom(direct under teh object)
}

sky_sphere {
   pigment {
      color rgb <0.054902, 0.219608, 0.4>
   }
}

union {
   //*PMRawBegin
   #declare z1=0;          //Init Loop Counter
   #declare scheiben=13;  // Number of slices
   #declare Thickness=0.15;    // Thicknes of the slices
   #declare abstand=-0.15; // Distance between the slices
   #declare versatz1=0;  //Offset of the slice-shift init
   #declare versatz2=0;  //dto.

   #while (z1<=1)
      union {
         intersection {
            object {myObject }
            object {Slice translate <0,versatz1,0>}
         }
     translate <0, versatz2,0>
     }
     #declare versatz1=versatz1+Thickness;
     #declare versatz2=versatz2+Thickness+abstand;
     #declare z1=z1+1/scheiben;
   #end
   //*PMRawEnd

   pigment {
      color rgb <0.9, 0.9, 0.9>
   }

   finish {
      //*PMRawBegin
      Dull
      //*PMRawEnd
   }
   scale 2
   translate <-0.75, -1, -0.75>
   rotate <0, 0, 0>
   //*PMRawBegin
   //*PMRawEnd
}

union {
   //*PMRawBegin
   myObject
   //*PMRawEnd
   rotate y*33
   translate <3, 0, -1>
}

light_source {
   //*PMName Key-Light
   <4, 10, -15>, rgb <1, 1, 1>
   area_light <6, 0, 0>, <0, 6, 0>, 9, 9
   adaptive 1
   circular
   orient
}

light_source {
   //*PMName Fill-Light
   <-4, 10, -15>, rgb <0.5, 0.5, 0.5>
   shadowless
   media_interaction off
}

camera {
   perspective
   location <3, 3, -6>
   sky <0, 1, 0>
   direction <0, 0, 1>
   right <1.3333, 0, 0>
   up <0, 1, 0>
   look_at <0, 0, 0>
}
//---------------------------------


Post a reply to this message

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