POV-Ray : Newsgroups : povray.newusers : portions of shapes and sor : Re: portions of shapes and sor Server Time
29 Jul 2024 14:15:28 EDT (-0400)
  Re: portions of shapes and sor  
From: Sebastian H 
Date: 3 Oct 2005 20:54:41
Message: <4341d2d1$1@news.povray.org>
vianagmo schrieb:
> Hi,
> 
> I have two puntual questions:
> 
> 1. I want to know if there's a way to make a sor that revolves in an angle
> smaller than 2*Pi.

Two simple planes and an intersection operation can help here.
Remember that a plane has two sides. The space on the top side of
the plane is free space but everything on the other side is
_inside_ the plane. The visible plane is just the surface
of the infinite deep sea below.
Now one can intersect multiple planes to create new objects.
A box for example is an intersection of six planes.

To cut out an angle from your sor (but this works with most objects)
you can let it intersect with a union of two planes. The cut space
must be "above" both of the planes and therefore not within them.
This works because an Intersection is rendered as the surface of
the space of which can be said it is within every participating object.

The following scene explains it better.

#include "colors.inc"

background { rgb <1, 1, 0.75>*0.9 }

#declare cam_theta = 60;
#declare cam_phi = 30;
#declare cam_r = 8.0;
#declare cam_angle = 45;

camera {
   location -cam_r*z
   sky y
   up <0,image_height/image_width,0>
   right <1,0,0>
   look_at <0,0.5,0>
   angle cam_angle
   rotate -(cam_theta-90)*x
   rotate -cam_phi*y
}

light_source {
   <0, 0, 0> rgb <1, 1, 1>
   fade_distance 500
   fade_power 2
   translate <150, 150, -200>
}

union {
   cylinder {-x, x, 0.0001 pigment{Red}}
   cylinder {-y, y, 0.0001 pigment{Green}}
   cylinder {-z, z, 0.0001 pigment{Blue}}
   scale 100
}

#declare surface_of_revolution=
sor {
   9,
   <0.000000, 0.000000>
   <0.118143, 0.000000>
   <0.620253, 0.540084>
   <0.210970, 0.827004>
   <0.194093, 0.962025>
   <0.286920, 1.000000>
   <0.468354, 1.033755>
   <0.068354, 1.233755>
   <0.0, 1.333755>
}


/* Cut angle */
#declare phi=60;

/* Intersection planes */
#declare P1= plane { <1,0,0>, 0}
#declare P2= plane {-<1,0,0>, 0  rotate -phi*y}

intersection {
   object {surface_of_revolution}
   union {
     object {P1}
     object {P2}
   }
   pigment {rgb 1.0}
   finish {ambient 0.1 diffuse 1}
}


#declare show_planes=false;


#if(show_planes)

   /* Show intersection planes */
   object {
     P1
     pigment {checker rgbf <1,0,0,0.75>, rgbt <1,1,0,0.5> scale 0.2}
   }

   object {
     P2
     pigment {checker rgbf <0,0,1,0.75>, rgbt <0,1,1,0.5> scale 0.2 
rotate -phi*y}
   }

#end

> 2. Is it possible to do portions of primitive shapes (spheres, cones,
> cylinders, torus) in a simple and fast way?. for example halfs or quarters
> of spheres or cones.

Do the intersection above with your favourite object.

of both planes but both planes directly. Just figure out
for which space it can be said it is within every of the
intersecting objects.

Regards,
Sebastian


Post a reply to this message

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