Home
- POV-Ray Tutorial
- POV-Ray Examples
Index of Content
- Geometry
- Architecture
- Engineering
- Ladder
- Pylons
- Railing
- Bridge
- Tubes
- Tube Fork
- Tube Stopcock
- Chain
- Coil of Wire
- Torpedo
- Cruise Missile
- Rocket
- Wheel
- Truck
- Propeller
- Airplanes
- Canoe
- Guitar Body
- 7-Segment Display
- Ribbon Cable
- Cable Harness
|
|
Tube Fork
Objects: isosurface, cylinder.
Methods: #declare, #local, #macro, union, difference.
A tube fork base shape for connecting pipelines, for a faucet or for a stopcocks.
|
|
We consider two blob-like isosurfaces.
The dimensions for both:
#local R1 = 0.50; // tube radius
#local R2 = 0.35; // blob sphere radius
#local Box_L = 4*R1; // size of container box
#local Bloby = 0.15, // the blob factor |
First an isosurface tube with spherical blob:
isosurface{ //-----------------------------------
function{ (1+Bloby)
- pow( Bloby,(sqrt(x*x+y*y)-(R1)))
- pow( Bloby,(sqrt(y*y+z*z+x*x)-(R2)))
} // end function
contained_by{
box{<-Box_L,-Box_L,-Box_L>,<Box_L,Box_L,Box_L>}}
accuracy 0.001
max_gradient 7
texture{ pigment{ color rgb<0.45,1,0>}
finish { phong 1 reflection 0.10}}
} // end of isosurface -------------------------- |
|
An isosurface tube with a spherical blob.
|
Then an isosurface of crossed tubes:
isosurface{ //-----------------------------------
function{ (1+Bloby)
- pow( Bloby,(sqrt(x*x+y*y)-(R1)))
- pow( Bloby,(sqrt(y*y+z*z)-(R2)))
} // end function
contained_by{
box{<-Box_L,-Box_L,-Box_L>,<Box_L,Box_L,Box_L>}}
accuracy 0.001
max_gradient 7
texture{ pigment{ color rgb<1,0.7,0>}
finish { phong 1 reflection 0.10}}
} // end of isosurface -------------------------- |
|
An isosurface of crossed tubes.
|
|
How to make a Tube Fork:
Here we restrict each of the two isosurfaces to a different half of their container box
and then we add them together by using "union".
union{
isosurface{ //-----------------------------------
function{ (1+Bloby)
- pow( Bloby,(sqrt(x*x+y*y)-(R1)))
- pow( Bloby,(sqrt(y*y+z*z+x*x)-(R2)))
} // end function
contained_by{
box{<-Box_L,-Box_L,-Box_L>,<0,Box_L,Box_L>}}
accuracy 0.001
max_gradient 7
texture{ pigment{ color rgb<0.45,1,0>}
finish { phong 1 reflection 0.10}}
} // end of isosurface 1 ------------------------
function{ (1+Bloby)
- pow( Bloby,(sqrt(x*x+y*y)-(R1)))
- pow( Bloby,(sqrt(y*y+z*z)-(R2)))
} // end function
contained_by{
box{<0,-Box_L,-Box_L>,<Box_L,Box_L,Box_L>}}
accuracy 0.001
max_gradient 7
texture{ pigment{ color rgb<1,0.7,0>}
finish { phong 1 reflection 0.10}}
} // end of isosurface 2 ------------------------
} // end of union |
|
Two half isosurface shapes.
The isosurface of forked tube.
|
|
Adapting the Tube Fork to connect to other tubes:
Because these kind of isosurfaces do not have exactly the radius R1 resp. R2 at the
border of their container boxes, we have to add a correcting factor to each according radius.
(This is not exactly calculated - just use the "trial and error" method!)
Note: If you change the radi
you'll have to adapt this correcting factor!
To help with the adapting of the isosurface radi to other tube radi we add also some test tubes.
#local Cor = 0.06; isosuface radius correction
#local Test_Cylinders_ON = 1; // 1 = on; 0 = off
//-----------------------------------------------
union{
isosurface{ //-----------------------------------
function{ (1+Bloby)
- pow( Bloby,(sqrt(x*x+y*y)-(R1+Cor)))
- pow( Bloby,(sqrt(y*y+z*z+x*x)-(R2+Cor)))
} // end function
contained_by{
box{<-Box_L,-Box_L,-Box_L>,<0,Box_L,Box_L>}}
accuracy 0.001
max_gradient 7
texture{ pigment{ color rgb<0.45,1,0>}
finish { phong 1 reflection 0.10}}
} // end of isosurface 1 ------------------------
function{ (1+Bloby)
- pow( Bloby,(sqrt(x*x+y*y)-(R1+Cor)))
- pow( Bloby,(sqrt(y*y+z*z)-(R2+Cor)))
} // end function
contained_by{
box{<0,-Box_L,-Box_L>,<Box_L,Box_L,Box_L>}}
accuracy 0.001
max_gradient 7
texture{ pigment{ color rgb<1,0.7,0>}
finish { phong 1 reflection 0.10}}
} // end of isosurface 2 ------------------------
// ----------------------------------------------
#if(Test_Cylinders_ON=1)
union{ // test
cylinder{<0,0,Box_L>,<0,0,Box_L+0.5*R1>,R1}
cylinder{<0,0,-Box_L-0.5*R1>,<0,0,-Box_L>,R1}
cylinder{<Box_L,0,0>,<Box_L+0.5*R1,0,0>,R2}
texture{ pigment{ color rgb<1,0.7,0>} }
} // end of union 'test'
#end // of Test_Cylinders_ON
} // end of union ------------------------------- |
|
The tube fork with test cylinders
|
|
Caving out the inside and putting all in a macro
completes the tube fork:
The macro "Tube_Fork_000":
//---------------------------------------------
#macro Tube_Fork_000 (
R1, // ~0.50,
R2, // ~0.35 ~0.65,
Tube_D, // ~0.05, tube material thickness
Bloby, // blob factor, // 0.1~0.002,
Cor, // radius correction,
Test_Cylinders_ON, // on = 1; off = 0,
) // ----------------------------------------
//---------------------------------------------
#local D = 0.0001; // just a little bit !!!
#local Box_L = 4*R1;
//---------------------------------------------
//------------- default textures --------------
#ifndef (Slide_Body_Texture)
#declare Slide_Body_Texture =
texture{ pigment{ color rgb<1,1,1>*0.85}
normal { bumps 0.05 scale 0.3005}
finish { phong 0.7 reflection 0.05}}
#end
#ifndef (Slide_Inside_Texture)
#declare Slide_Inside_Texture =
texture{ pigment{ color rgb<1,1,1>*0.7}}
#end
#ifndef (Test_Tube_Texture)
#declare Test_Tube_Texture =
texture { pigment { color rgb<0.7,0.3,1>}}
#end
//-----------....----------- main part --------
union{ // main union
#if(Test_Cylinders_ON=1)
union{ // 1
#end
difference{
union{
isosurface{ //--------------------------------
function{
(1+Bloby)
- pow( Bloby, ( sqrt(x*x+y*y)-(R1+Cor) ) )
- pow( Bloby,( sqrt( y*y+z*z)-(R2+Cor) ) )
}// end function
contained_by{
box{<0,-Box_L,-Box_L>,<Box_L,Box_L,Box_L>} }
accuracy 0.001
max_gradient 7
} // end of isosurface -----------------------
isosurface{ //--------------------------------
function{
(1+Bloby)
- pow( Bloby, ( sqrt(x*x+y*y)-(R1+Cor) ) )
- pow( Bloby,( sqrt(y*y+z*z +x*x)-(R2+Cor) ) )
}// end function
contained_by{
box{<-Box_L,-Box_L,-Box_L>,<0,Box_L,Box_L>}}
accuracy 0.001
max_gradient 7
} // end of isosurface -----------------------
texture{Slide_Body_Texture}
}// end of union
cylinder{ <0,0,-Box_L-D>,<0,0,Box_L+D>,R1-Tube_D
texture{ Slide_Inside_Texture }}
cylinder{ <0,0,0>,<Box_L+D,0,0>, R2-Tube_D
texture{ Slide_Inside_Texture }}
}//end of difference //
#if(Test_Cylinders_ON=1)
union{ // 'test'
cylinder{<0,0, Box_L>,<0,0,Box_L+0.5*R1>, R1}
cylinder{<0,0,-Box_L-0.5*R1>,<0,0,-Box_L>,R1}
cylinder{<Box_L,0,0>,<Box_L+0.5*R1,0,0>, R2}
texture { Test_Tube_Texture }}
}// end union 'test'
} // end union of '#if(Test_Cylinders_ON = 1)'
#end // Test_Cylinders_ON=1
// ---------
} // end union main
#end // -------------------------- end of macro |
And here is a example for how to use this macro:
// -------------------------- optional textures
#declare Slide_Body_Texture =
texture{ pigment{ color rgb<0.75,1,0>}
finish { phong 1 reflection 0.1}}
#declare Slide_Inside_Texture =
texture{ pigment{ color rgb<0.3,0.7,0>*1.1}
finish { phong 1}}
#declare Test_Tube_Texture =
texture{ pigment { color rgb<1,0.7,0>}
} // end of texture
// ----------------------------------------------
object{
Tube_Fork_000 (
// total container box length = 4*R1
0.50, // R1, // main tube radius: 1 ~ 0.25
0.35, // R2, // side tube radius: 1.5 ~ 0.20
0.05, // Tube_D, // tube material thickness
0.15, // Blobfactor; // 0.1~0.002 ; max~0.2!!
0.06, // radius correction, ~ 0.06
0, // Test_cylinders_ON; on = 1; off = 0
) // ------------------------------------------
// rotate <0,0,90>
translate <0,0,0>
} // -------------------------------------------- |
|
The tube fork macro.
The tube fork macro
with R1 = 0.35, R2 = 0.50,
and rotate<0,0,90>.
For Download of this shape as a Ready-made POV-Ray object in an
include file with macro
and for example files look at the
POV-Ray Objects Page - Tubes
|
|