File talk:Parabola & cubic curve in projective space.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
// POV-Ray 3.7 Scene File
// By Rupert Millard
// http://www.rupertmillard.net
//
//
// DERIVED from "a_geo_sph1.pov"
// Author: Friedrich A. Lohmueller, 2005/2009
// email: Friedrich.Lohmueller_at_t-online.de 
// homepage: http://wwww.f-lohmueller.de
//
//------------------------------------------------------------------------
#if ( version < 3.7 ) global_settings{ assumed_gamma 1.0 } #end
//------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"          
#include "transforms.inc"
//------------------------------------------------------------------------
#declare Camera_0 = camera {                                 // xy-view
                             angle 20
                             location  <0.0 , 0.0 ,-10.0>
                             right     x*image_width/image_height
                             look_at   <0.0, 0.0 , 0.0>
                           }

#declare Camera_1 = camera {                                // diagonal view
                             location  <0,0,-3>
                             right     x*image_width/image_height
                             look_at   <0 , 0 ,0>
			     rotate <35,-15,0>
			     translate <0,1,0>
                           }
#declare Camera_2 = camera {                               // yz-view
                             angle 20          
                             location  <31.0 , 7.0 ,1.0>
                             right     x*image_width/image_height
                             look_at   <1.5 , 1.4 , 1.0>
                           }
#declare Camera_3 = camera { 
                             angle 20
                             location  < 0.0 , 37.5 ,-0.0001>
                             right     x*image_width/image_height
                             look_at   <0 , 0 , 2.0>
                           }

camera{Camera_1}

//------------------------------------------------------------------------
// sun -------------------------------------------------------------------
light_source{<3000,5500,-1000> color White rotate 20*y}
// sky -------------------------------------------------------------------
sky_sphere{ pigment{ gradient <0,1,0>
                     color_map{ [0   color rgb<1,1,1>         ]//White
                                [0.4 color rgb<1,1,1>]//~Navy
                                [0.6 color rgb<1,1,1>]//<0.14,0.14,0.56>]//~Navy
                                [1.0 color rgb<1,1,1>         ]//White
                              }
                     scale 2 }
           } // end of sky_sphere 
//------------------------------------------------------------------------

//------------------------------ the Axes --------------------------------
//------------------------------------------------------------------------
#macro Axis_( AxisLen, Dark_Texture,Light_Texture) 
 union{
    cylinder { <0,-AxisLen-3,0>,<0,AxisLen,0>,0.05
               texture{checker texture{Dark_Texture } 
                               texture{Light_Texture}
                       translate<0.1,0,0.1>}
             }
    cone{<0,AxisLen,0>,0.2,<0,AxisLen+0.7,0>,0
          texture{Dark_Texture}
         }
     } // end of union                   
#end // of macro "Axis()"
//------------------------------------------------------------------------
#macro AxisXYZ( AxisLenX, AxisLenY, AxisLenZ, Tex_Dark, Tex_Light)
//--------------------- drawing of 3 Axes --------------------------------
union{
#if (AxisLenX != 0)
 object { Axis_(AxisLenX, Tex_Dark, Tex_Light)   rotate< 0,0,-90>}// x-Axis
 text   { ttf "arial.ttf",  "x",  0.15,  0  texture{Tex_Dark} 
          scale 0.5 translate <AxisLenX+0.05,0.4,-0.10>}
#end // of #if 
#if (AxisLenY != 0)
 object { Axis_(AxisLenY, Tex_Dark, Tex_Light)   rotate< 0,0,  0>}// y-Axis
 text   { ttf "arial.ttf",  "y",  0.15,  0  texture{Tex_Dark}    
           scale 0.5 translate <-0.55,AxisLenY+0.20,-0.10>}
#end // of #if 
#if (AxisLenZ != 0)
 object { Axis_(AxisLenZ, Tex_Dark, Tex_Light)   rotate<90,0,  0>}// z-Axis
 text   { ttf "arial.ttf",  "z",  0.15,  0  texture{Tex_Dark}
               scale 0.5 translate <-0.55,0.1,AxisLenZ+0.10>}
#end // of #if 
} // end of union
#end// of macro "AxisXYZ( ... )"
//------------------------------------------------------------------------

#declare Texture_A_Dark  = texture {
                               pigment{color rgb<1,0.45,0>}
                               finish {ambient 0.15 diffuse 0.85 phong 1}
                             }
#declare Texture_A_Light = texture { 
                               pigment{color rgb<1,1,1>}
                               finish {ambient 0.15 diffuse 0.85 phong 1}
                             }

object{ AxisXYZ( 0, 0, 0, Texture_A_Dark, Texture_A_Light)} // <<<<<<<<<<<<<<<<< adapt the axes here !!!
//-------------------------------------------------- end of coordinate axes


// ground -----------------------------------------------------------------
//---------------------------------<<< settings of squered plane dimensions
#declare RasterScale = 1.0/2;
#declare RasterHalfLine  = 0.035/2;  
#declare RasterHalfLineZ = 0.035/2; 
//-------------------------------------------------------------------------
#macro Raster(RScale, HLine) 
       pigment{ gradient x scale RScale
                color_map{[0.000   color rgbt<1,1,1,1>*0.2]
                          [0+HLine color rgbt<1,1,1,1>*0.2]
                          [0+HLine color rgbt<1,1,1,1>]
                          [1-HLine color rgbt<1,1,1,1>]
                          [1-HLine color rgbt<1,1,1,1>*0.2]
                          [1.000   color rgbt<1,1,1,1>*0.2]} }
       finish { ambient 0.15 diffuse 0.85}
 #end// of Raster(RScale, HLine)-macro    
//-------------------------------------------------------------------------
    

plane { <0,1,0>, 0    // plane with layered textures
        texture { pigment{color rgbt<1,1,1,0.7>*1.1}
                  finish {ambient 0.45 diffuse 0.85}}
        texture { Raster(RasterScale,RasterHalfLine ) rotate<0,0,0> }
        texture { Raster(RasterScale,RasterHalfLineZ) rotate<0,90,0>}
        rotate<0,0,0>
        no_shadow
      }
//------------------------------------------------ end of squered plane XZ

//--------------------------------------------------------------------------
//---------------------------- objects in scene ----------------------------
//--------------------------------------------------------------------------
#default{ finish {ambient 0.15 diffuse 0.85} } // 

/* Some Sample rgb colors - Einige Beispiele f�r rgb Farben
                          - Qualche esempio per colori rgb     
//===========================================================================
               pigment { color Green } 
Black  rgb<0,0,0>  ;  Gray  rgb<1,1,1>*0.5 ; White rgb<1,1,1> ; 
Red    rgb<1,0,0>  ;  Green rgb<0,1,0>     ; Blue rgb<0,0,1>  ;  Yellow rgb<1,1,0> ;
Orange rgb<1,0.5,0>;  Cyan rgb<0,1,1>      ; Magenta<1,0,1,>  ;
orange yellow  rgba<1,0.65,0> ;  YellowGreen rgb<0.5,1,0> ; 
Dark Red rgb<0.5,0,0> ; dark green rgb<0,0.5,0> ; dark blue rgb<0,0,0.5>

transparent colors - halbtransparente Farben - colori semi trasparenti: 
Red  semi transparent:          
                pigment{ color Red transmit 0.5 } = pigment { color rgbt<1,0,0,0.5>}
*/

//-----------------------------------------------------------------------------------
#declare Rl  = 0.055; // radius of lines  - Radius der Strecken 
#declare Rp  = 0.105; // radius of points - Radius der Punkte 

// 
//------------------------------------------------------------------------------------
#include "analytical_g.inc" 
//------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------- 

// ----------------------------------------------------------------------------------- 
// ---------------------  Punti e Vettori  - Punkte und Vektoren -  Points and Vectors
//------------------------------------------------------------------------------------

#declare M1 = < 0.0, 1.0, 0.0>;  
#declare R1  = 1.0;   

#declare M2  = < 2.0,3.0, 1.0>;
#declare Rx  = 3.00;
#declare Ry  = 1.00;
#declare Rz  = 2.00;
 
 
 
/*object{ Show_Yxz( M1, Rl/2) pigment{ color Yellow }}
object{ Show_Yxz( M2, Rl/2) pigment{ color Yellow }}*/
//------------------------------------------------------------------------------------
// --------------------------------------------------------------- Zeichnen ---------- 
// ---------------------------------------------------------------- Drawing ---------- 
sphere{ M1, R1                          pigment{ color Yellow transmit 0.6 } finish {phong 1}}
/*object{ Vector( M1, M1+<0,R1,0>, Rl/2)  pigment{ color Red } }
object{ Vector( M1, M1+<0,0,-R1>, Rl/2) pigment{ color Red } }*//*
torus{ R1, Rl/2                 translate M1 pigment{ color Orange } }
torus{ R1, Rl/2 rotate< 90,0,0> translate M1 pigment{ color Orange } }
torus{ R1, Rl/2 rotate< 0,0,90> translate M1 pigment{ color Orange } }*/

#declare Points = 50;
#declare StartX = -10; // start X    attention: x != X  use capital letter X
#declare EndX = 10; // end   X

#declare lw = 0.01;

sphere_sweep {
    cubic_spline, Points,


    #declare X = StartX;
    #while ( X <= EndX )
	<X, 0, X*X>, lw

	#declare X = X + (EndX-StartX)/(Points-1);
	
    #end // --------------- end of loop  


    pigment{ color Red }
    no_shadow
}

#declare StartX = -2; // start X    attention: x != X  use capital letter X
#declare EndX = 10; // end   X

sphere_sweep {
    cubic_spline, Points,


    #declare X = StartX;
    #while ( X <= EndX )
	<X, 0, pow(X,3)>, lw

	#declare X = X + (EndX-StartX)/(Points-1);
	
    #end // --------------- end of loop  


    pigment{ color Blue }
    no_shadow
}

#declare Points = 25;
#declare StartX = 0; // start X    attention: x != X  use capital letter X
#declare EndX = 1; // end   X (never gets here)

#declare Projection1 = array[Points];
#declare Projection2 = array[Points];

#declare X = StartX;
#declare i = 0;
#while ( i < Points )
    #declare X = StartX + i/Points*(EndX-StartX);
    #declare U = (X/((1-X)*(1+X)));
    #declare q = sqrt(pow(U,2)+pow(U,4)+1);
    #declare Projection1[i]=<U/q, -1/q, pow(U,2)/q>;

    #declare q = sqrt(pow(U,2)+pow(U,6)+1);
    #declare Projection2[i]=<U/q, -1/q, pow(U,3)/q>;

//     #debug concat(str(q,5,5), "<", str(U/q,5,5), ",", str(-1/q,5,5), ",", str(pow(U,2)/q,5,5),">\n")

    #declare i=i+1;
#end

sphere_sweep {
    cubic_spline, Points*2+2,

    <0,0,1>, lw

    #declare i = Points-1;
    #while ( i >1)
	Projection1[i], lw
	
	#declare i=i-1;	
    #end

    #declare i = 0;
    #while ( i < Points)
	Projection1[i]*<-1,1,1>, lw
// 	#debug concat("<", str(Projection1[i].x,5,5), ",", str(Projection1[i].y,5,5), ",", str(Projection1[i].z,5,5),">\n")

	#declare i=i+1;	
    #end

    <0,0,1>, lw
    Projection1[Points-1], lw
    Projection1[Points-2], lw

    pigment{ color Red }
    translate <0,1,0>
    no_shadow
}

sphere_sweep {
    cubic_spline, Points*2+2,

    <0,0,-1>, lw

    #declare i = Points-1;
    #while ( i >1)
	<-1,-1,-1>*Projection1[i], lw
	
	#declare i=i-1;	
    #end

    #declare i = 0;
    #while ( i < Points)
	Projection1[i]*<1,-1,-1>, lw

	#declare i=i+1;	
    #end

    <0,0,-1>, lw
    <-1,-1,-1>*Projection1[Points-1], lw
    <-1,-1,-1>*Projection1[Points-2], lw

    pigment{ color Red }
    translate <0,1,0>
    no_shadow
}


#declare epsilon=1e-9;
#declare lw=lw-epsilon;

sphere_sweep {
    cubic_spline, Points*2+2

    <-epsilon,0,1>, lw
    <0,0,1>, lw

    #declare i = Points-1;
    #while ( i >1)
	Projection2[i], lw
	
	#declare i=i-1;	
    #end

    #declare i = 0;
    #while ( i < Points)
	Projection2[i]*<-1,1,-1>, lw

	#declare i=i+1;	
    #end

    <0,0,-1>, lw
    <epsilon,0,-1>, lw

    pigment{ color Blue }
    translate <0,1,0>
    no_shadow
}


sphere_sweep {
    cubic_spline, Points*2+2

    <epsilon,0,-1>, lw
    <0,0,-1>, lw

    #declare i = Points-1;
    #while ( i >1)
	Projection2[i]*<-1,-1,-1>, lw
	
	#declare i=i-1;	
    #end

    #declare i = 0;
    #while ( i < Points)
	Projection2[i]*<1,-1,1>, lw
	#debug concat("<", str(Projection1[i].x,5,5), ",", str(Projection1[i].y,5,5), ",", str(Projection1[i].z,5,5),">\n")

	#declare i=i+1;	
    #end

    <0,0,1>, lw
    <-epsilon,0,1>, lw

    pigment{ color Blue }
    translate <0,1,0>
    no_shadow
}

//------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------- end