Several Graphics Combined



El s?b, 30-03-2013 a las 19:22 -0400, Richard Hennessy escribi?:
> Thinking about this lead me to try 3d cylindrical and spherical objects. 
> They don't work either.  That would be a better application for option 'vtk 
> than 2d plots.  Is their a way to do them that I missed?
> 
> Rich
> 

These objects aren't yet implemented (don't forget all this is
experimental work), but we have parametric_surface.

The key idea is to transform surfaces in spherical or cylindrical
coordinates into a parametric surface in cartesian coordinates:


load("draw") $
draw_renderer : vtk $


spherical(r,az,minaz,maxaz,ze,minze,maxze) :=
    parametric_surface(
        r*sin(ze)*cos(az),
        r*sin(ze)*sin(az),
        r*cos(ze),
        az, minaz, maxaz,
        ze,minze,maxze ) $

cylindrical(r, z, minz, maxz, azi, minazi, maxazi) :=
    parametric_surface(
        r*cos(azi),
        r*sin(azi),
        z,
        z, minz, maxz, 
        azi, minazi, maxazi ) $

/* Cephalopod Nautilus */
draw3d(
  color = white,
  spherical(a+z,a,0,3*%pi,z,0,%pi))$

/* A cone and a semi-cylinder inside a transparent sphere */
draw3d(
  color        = blue,
  cylindrical(z,z,-2,2,az,0,2*%pi), /*cone*/
  color        = brown,
  cylindrical(3,z,-2,2,az,0,2*%pi),  /*cylinder*/
  color        = green,
  opacity = 0.2,
  cylindrical(sqrt(25-z^2),z,-5,5,az,0,2*%pi) /*sphere*/ )$

--
Mario