Wednesday, November 28, 2012

possible netmap logo

Another pov-ray code


#include "colors.inc"
#include "finish.inc"
#include "math.inc"

/*Triganometry - need to write this somewhere
cosd() co-sine measured in degrees
f_sqr() a function to square a number
sqrt(A) Returns the value whose square is A.

Hypotenuse_Length = sqrt(x_axis_length*x_axis_length + y_axis_length*y_axis_length)

cosd(Angle) = adjacent_Length/Hypotenuse_Length


*/


global_settings { ambient_light rgb<1, 1, 1> }

/*
//background
plane
{
    z,+0.1
    pigment {rgb <0,0,0>}
    //either black or colorless
}
*/

//area of interest is
//    0.0 < x < 100
//    0.0 < y < -100
//    5.0 < z < -5.0
// bit this needs to be slightly expanded for a neat boarder

//eye centered aboce the shapes, although they are 3D ther should be no traces of that.
camera
{
    location <50,-50,-150>
    look_at <50,-50,0>
}
//I'm cheating with the illumination and placing a light where the camera is
//in this way I dont have to worry about shadows at all and should get clean colors.
light_source { <-11,0,-10> <0,0,1>}
light_source { <11,21,-10> <1,0,0>}
light_source { <-50,-50,-150> <1,1,1>}// same as camera location

/*
background     Black
web         yellow
PC        Cyan
hub        Blue
router        red

each color to fade into the next, so the connection from the router to the hub will
transition through magenta.

each nexus should appear to glow in its colour due to radiosity

then of the 8 simple computer colors only green and white are missing.
*/


//WWW also the boarder
cylinder //left
{
    <0,0,0>,
    <0,-100,0>,
    2
    pigment{
    gradient y
    frequency 0.01
    color_map {
        [0.0 color rgb <1,1,0> ]
        [1.0 color rgb <1,1,0> ]
    }
    //rotate z*90
    }
        //rotate z*45
}

cylinder//bottom
{
    <0,-100,0>,
    <66,-100,0>,
    2
    pigment{
    gradient z
    color_map {
        [0.0 color rgb <1,1,0> ]
        [1.0 color rgb <1,1,0> ]
    }
    }
}
cylinder//top
{
    <0,0,0>,
    <100,0,0>,
    2
    pigment{
    gradient z
    color_map {
        [0.0 color rgb <1,1,0> ]
        [1.0 color rgb <1,1,0> ]
    }
}
}
cylinder//right
{
    <100,0,0>,
    <100,-66,0>,
    2
    pigment{
    gradient z
    color_map {
        [0.0 color rgb <1,1,0> ]
        [1.0 color rgb <1,1,0> ]
    }
}
}

//router red
//4 port + Internet
//72° rotation
//<20,20,0>7
cone
{
    <0,0,0>, 2 //net
    <0,-100,0>,2 //router
    //first created along the y axis
    pigment{
    gradient y      //color changes from the bottom of the shape to the top
    frequency 0.01  //% of 100, because the shape is 100 units long on the y axis
    color_map
    {
        [0.0 color rgb <1,0,0> ]
        [1.0 color rgb <1,1,0> ]// the actual change in color
    }
        }
        scale y*.3  //shortenning the shape to what I want while maintainingthe color gradient
        rotate z*45 //rotating the bottom end to where it ends up
}
cone
{
    <0,0,0>, 2//hub8
    <0,-100,0>,2 //router
    pigment{
    gradient y
    frequency 0.01
    color_map
    {
        [0.0 color rgb <0,0,1> ]
        [0.5 color rgb <1,0,1> ]//dunno if this is really nessesary, possibly keeps things brighter
        [1.0 color rgb <1,0,0> ]
    }
    }
        scale y*0.6
        rotate z*9.5
        translate <20,-20,0>
}
cone
{
    <0,0,0>, 2.1//hub12
    <0,-100,0>,2 //router
    pigment{
    gradient y
    frequency 0.01
    color_map
    {
        [0.0 color rgb <0,0,1> ]
        [0.5 color rgb <1,0,1> ]
        [1.0 color rgb <1,0,0> ]
    }
    }
        scale y*0.7          //needs longer + trigonometry
        rotate z*56
        translate <20,-20,0>
}
cone
{
    <0,0,0>, 2//PC
    <0,-100,0>,2 //router
    pigment{
            gradient y
            frequency 0.01
            color_map
            {
                [0.0 color rgb <0,1,1> ]
                [1.0 color rgb <1,0,0> ]
            }
    }
        scale y*0.6
        rotate z*100
        translate <20,-20,0>
}
cone
{
    <0,0,0>, 2//PC
    <0,-100,0>,2 //router
    pigment{
            gradient y
            frequency 0.01
            color_map
            {
                [0.0 color rgb <0,1,1> ]
                [1.0 color rgb <1,0,0> ]
            }
    }
        scale y*0.6
        rotate z*80
        translate <20,-20,0>
}

//hub blue
//8 port
//45°
//<30,-80,0>, 15L
#declare hub8ports =
cone
{
    <0,0,0>, 1
    <0,-100,0>, 2
    pigment{
    gradient y
    frequency 0.01
    color_map {
        [0.0 color rgb <0,1,1> ]
        [1.0 color rgb <0,0,1> ]
    }
    }
    scale y*.15
}

#declare Count = 0;

#declare hub8 =
union
{
    #while (Count < 360)
    object {hub8ports rotate z*Count }
    #declare Count=Count +45;
    #end
    rotate z*9.3
}
object
{
        hub8
        translate <30,-80,0>
        //rotate z*10
}


//hub blue
//12 port
//30°
//<80,-60,0>, 10L
#declare hub12ports =
cone
{
    <0,0,0>, 1
    <0,-100,0>, 2
    pigment{
    gradient y
    frequency 0.01
    color_map {
        [0.0 color rgb <0,1,1> ]
        [1.0 color rgb <0,0,1> ]
    }
    }
        scale y*0.15
        rotate z*27.6
}

#declare Count = 0;
#declare hub12 =
union
{
    #while (Count < 360)
    object {hub12ports rotate z*Count }
    #declare Count=Count +30;
    #end
}
object
{
        hub12
    translate <80,-60,0>
}


// create a sphere shape to smoth the edges
#declare node =
sphere {
  <0, 0, 0> // center of sphere <X Y Z>
  2.0       // radius of sphere
  // scale <1,2,1> // <= Note: Spheres can become ellipses by uneven scaling
    pigment {rgb <1,1,0>}
}
object
{
       node
}
object
{
       node
    translate <0,-100,0>
}
object
{
       node
    translate <100,0,0>
}

/*
I wonder if I should turn this into a movie? It would be nice to make an animated CVG rather than a GIF
Since I decided against using green because we use it everywhere else the color transitions would be:
r-y-c-b-m ->back to red
Internet-router-hubs-PCs-nothing ->back to internet
this way everything should gently blend into the next colour and it should look like a rainbow moving from the internet to the PCs

Although programming this would almost require me to start from scratch.
*/