POV-Ray : Newsgroups : povray.newusers : Connection gone bad... Server Time
29 Nov 2024 08:22:05 EST (-0500)
  Connection gone bad... (Message 1 to 3 of 3)  
From: Fishflake
Subject: Connection gone bad...
Date: 30 Jan 1999 15:02:38
Message: <36B36619.5C8E@flash.net>
How can u connect a cone,sphere, and cylinder (spelling bad) to where
they look like the same thing. 
CrazyFish
--------------------
opi### [at] flashnet
cra### [at] junocom


Post a reply to this message

From: Josh English
Subject: Re: Connection gone bad...
Date: 30 Jan 1999 19:54:56
Message: <36B3A967.E4B24D4@spiritone.com>
You want to use the CSG (Constructive Solid Geometry) functions union or
merge, as in:

union { cylinder { <-2,0,0> <0,0,0> 1 }
             sphere { <0,0,0> 1 }
             cone { <0,0,0> 1 <0,2,0> 2 }
             pigment { red 1 }
           }

this is, of course, merely an example. You can replace union with merge,
but this example wouldn't show the difference. It is more noticable with
semi transparent color.

Also be sure to check the docs. The first tutorial will take you through
the basics in a very well written manner.

Happy Tracing
Josh English
eng### [at] spiritonecom

Fishflake wrote:

> How can u connect a cone,sphere, and cylinder (spelling bad) to where
> they look like the same thing.
> CrazyFish
> --------------------
> opi### [at] flashnet
> cra### [at] junocom


Post a reply to this message

From: Jerry Anning
Subject: Re: Connection gone bad...
Date: 30 Jan 1999 23:21:09
Message: <36B3DA31.90365789@dhol.com>
Josh English wrote:
> 
> You want to use the CSG (Constructive Solid Geometry) functions union or
> merge, as in:
> 
> union { cylinder { <-2,0,0> <0,0,0> 1 }
>              sphere { <0,0,0> 1 }
>              cone { <0,0,0> 1 <0,2,0> 2 }
>              pigment { red 1 }
>            }
> 
> this is, of course, merely an example. You can replace union with merge,
> but this example wouldn't show the difference. It is more noticable with
> semi transparent color.
> 
> Also be sure to check the docs. The first tutorial will take you through
> the basics in a very well written manner.
> 
> Fishflake wrote:
> 
> > How can u connect a cone,sphere, and cylinder (spelling bad) to where
> > they look like the same thing.

If you mean that you want the connection to be smooth, it is a bit trickier. 
The best bet is a macro.  Try this example:

// Begin POV code

// Linkage.pov - demonstrate Linkage macro
#version 3.1;

global_settings { assumed_gamma 1.0 ambient_light <.846, 1.041, 1.041> } 

camera { up <0, 1, 0> right <4 / 3, 0, 0> 
  location <0, 0, -20> look_at <0, 0, 0> }

light_source { <20, 50, -100> color rgb <1.103, .993, .772> }

#include "colors.inc"

sky_sphere { pigment { color rgb <.846, 1.041, 1.041> } }

#macro Linkage(Cyllen, Conemajrad, Conelen, Coneminrad)
  #local Conetan = ((Conelen = 0) ? 0 : (Conemajrad - Coneminrad)
/                      Conelen);
  #local Majoff = Conemajrad * Conetan;
  #local Minoff = Coneminrad * Conetan;
  #local Cylrad = ((Conetan = 0) ? Conemajrad : sqrt((Conemajrad
*                          Conemajrad) + (Majoff * Majoff)));
  #local Litsphrad = ((Conetan = 0) ? Conemajrad : sqrt((Coneminrad *
                       Coneminrad) + (Minoff * Minoff)));
  #local Len = Cylrad + Cyllen + Majoff + Conelen - Minoff + Litsphrad;
  #local Cylbot = Cylrad - Len / 2;
  #local Cyltop = Cylbot + Cyllen;
  #local Conebot = Cyltop + Majoff;
  #local Conetop = Conebot + Conelen;
  #local Litsphloc = Conetop - Minoff;
	
union
  {
    sphere { <0, Cylbot, 0>, Cylrad }
    cylinder { <0, Cylbot, 0>, <0, Cyltop, 0>, Cylrad }
    sphere { <0, Cyltop, 0>, Cylrad }
    cone { <0, Conebot, 0>, Conemajrad, <0, Conetop, 0>, Coneminrad }
    sphere { <0, Litsphloc, 0>, Litsphrad }
  }
#end

object
  {
    Linkage(3, 4, 5, 1)
    texture
      {
        pigment
          {
            gradient y
            color_map
              {
                [ 0 color Red ]
                [ .2 color Yellow ]
                [ .4 color Green ]
                [ .6 color Cyan ]
                [ .8 color Blue ]
                [ 1 color Magenta ]
              }
            scale <1, 15, 1>
            translate <0, -7, 0>
          }
        finish { specular 1 roughness .001 crand .1 }
      }
  }

// End POV code

If you want to attach a cylinder to the *small* end of the cone, it is a bit
more complicated to do it smoothly.  If you need it, let me know and I will try
to cobble something together.

Jerry Anning
cle### [at] dholcom


Post a reply to this message

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