POV-Ray : Newsgroups : povray.general : Elliptical Torus? : Re: Elliptical Torus? Server Time
2 Aug 2024 08:15:48 EDT (-0400)
  Re: Elliptical Torus?  
From: Mike Williams
Date: 11 Feb 2005 13:40:59
Message: <vYJoJHAVvPDCFw+1@econym.demon.co.uk>
Wasn't it David Cameron who wrote:
>Damn, I spoke too soon. :(
>I did a simple CSG test with elliptical_torus before I posted my original
>reply, and it seems to work OK.
>I have since done further CSG tests which fail.

You can only, reliably, perform difference and intersection operations on
objects that have a defined 'inside'. A mesh only has an inside if you use
the "inside_vector" when creating it, which param.inc doesn't do. The mesh
also has to be closed, which is the case for this shape.

I recommend reading the section in the documentation regarding solid mesh
and inside_vector.

To add an inside_vector to a mesh created by param.inc you actually have to
edit "makemesh.inc" and add a line something like
         inside_vector <0, 0, 1>
just before the final "}"

For consistency, in case you want to pass param.inc a filename, change the
line just before the #fclose to
         #write(MeshFile, "\n  }\n  inside_vector <0, 0, 1>\n}")




Alternatively, for these particular operations, you might be able to do
something with these:

#macro inside_half_elliptical_torus( x_major_radius, z_major_radius,
minor_radius)
  #declare Fx = function(u,v){cos(u)*(x_major_radius+minor_radius*cos(v))}
  #declare Fz = function(u,v){sin(u)*(z_major_radius+minor_radius*cos(v))}
  #declare Fy = function(u,v){minor_radius*sin(v)}

  #include "param.inc"

  object{
    Parametric(
       Fx, Fy, Fz,
       <0,pi/2>,<2*pi,3*pi/2>,  // range changed
       100,20,""
    )
  }
#end


#macro outside_half_elliptical_torus( x_major_radius, z_major_radius,
minor_radius)
  #declare Fx = function(u,v){cos(u)*(x_major_radius+minor_radius*cos(v))}
  #declare Fz = function(u,v){sin(u)*(z_major_radius+minor_radius*cos(v))}
  #declare Fy = function(u,v){minor_radius*sin(v)}

  #include "param.inc"

  object{
    Parametric(
       Fx, Fy, Fz,
       <0,-pi/2>,<2*pi,pi/2>,   // range changed
       100,20,""
    )
  }
#end


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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