POV-Ray : Newsgroups : povray.general : show a line in 3D ? Server Time
6 Nov 2024 12:20:33 EST (-0500)
  show a line in 3D ? (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: 1ternaut
Subject: show a line in 3D ?
Date: 15 Jun 2004 21:20:56
Message: <40cfa078@news.povray.org>
newbe, I have just installed pov ray 3.6 and I seek has to visualize the
line of coordonees x, y, z such as x=y=z somebody can he help me?
I will need the textual file for "run";o)


Post a reply to this message

From: Slime
Subject: Re: show a line in 3D ?
Date: 15 Jun 2004 22:18:02
Message: <40cfadda@news.povray.org>
> newbe, I have just installed pov ray 3.6 and I seek has to visualize the
> line of coordonees x, y, z such as x=y=z somebody can he help me?
> I will need the textual file for "run";o)

That particular function (x = y = z) is quite simple; it could be
demonstrated by a thin cylinder from <-100,-100,-100> to <100,100,100>,
which would pass through points like <0,0,0>, <3,3,3>, etc.

If you have more complicated functions that you need to show, then graphing
the solution may be slightly more complex.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: 1ternaut
Subject: Re: show a line in 3D ?
Date: 16 Jun 2004 00:32:29
Message: <40cfcd5d@news.povray.org>
Yes ..... But, if you could give the exactly source code of the function, i
just have to run, it would help me to start ;o) Thanks you



news:40cfadda@news.povray.org...
> > newbe, I have just installed pov ray 3.6 and I seek has to visualize the
> > line of coordonees x, y, z such as x=y=z somebody can he help me?
> > I will need the textual file for "run";o)
>
> That particular function (x = y = z) is quite simple; it could be
> demonstrated by a thin cylinder from <-100,-100,-100> to <100,100,100>,
> which would pass through points like <0,0,0>, <3,3,3>, etc.
>
> If you have more complicated functions that you need to show, then
graphing
> the solution may be slightly more complex.
>
>  - Slime
>  [ http://www.slimeland.com/ ]
>
>


Post a reply to this message

From: Slime
Subject: Re: show a line in 3D ?
Date: 16 Jun 2004 01:40:48
Message: <40cfdd60@news.povray.org>
> Yes ..... But, if you could give the exactly source code of the function,
i
> just have to run, it would help me to start ;o) Thanks you

Well, the cylinder that I described is:

cylinder {
<-100,-100,-100>, // starting point
<100,100,100>, // ending point
0.1 // radius

pigment {rgb 1} // white
}

You'll also need a light source and a camera.

If this is new to you, then I strongly suggest you read the tutorials that
come with POV-Ray. Start by clicking on the button in POV-Ray that says
"Scene", which will bring you to the help files.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: 1ternaut
Subject: Re: show a line in 3D ?
Date: 16 Jun 2004 03:25:36
Message: <40cff5f0@news.povray.org>
Thank you, i progress ;o)



news:40cfdd60@news.povray.org...
> > Yes ..... But, if you could give the exactly source code of the
function,
> i
> > just have to run, it would help me to start ;o) Thanks you
>
> Well, the cylinder that I described is:
>
> cylinder {
> <-100,-100,-100>, // starting point
> <100,100,100>, // ending point
> 0.1 // radius
>
> pigment {rgb 1} // white
> }
>
> You'll also need a light source and a camera.
>
> If this is new to you, then I strongly suggest you read the tutorials that
> come with POV-Ray. Start by clicking on the button in POV-Ray that says
> "Scene", which will bring you to the help files.
>
>  - Slime
>  [ http://www.slimeland.com/ ]
>
>


Post a reply to this message

From: Harold
Subject: Re: show a line in 3D ?
Date: 16 Jun 2004 15:09:42
Message: <40d09af6@news.povray.org>
Another approach is to use a sphere_sweep. If it is a straight
line then you only need to define the begin and end points.

Here is a POV script to make a line chart. It uses sphere_sweep
to draw lines between points to illustrate changes in the number of
children placed in foster homes (real data). Not elegant POV script
but it works.

Harold

//=========BEGIN POV===============================
//--- POV Ray Line Chart Scene File --- 


global_settings { assumed_gamma 2.2 }
#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"


// ---------- Lights, Camera, Action -----------

//  Single camera
#declare Camx=-0.1;

 camera {location <Camx, 0.6, -3> look_at <Camx,0.6,0> angle 40}

 light_source { < 10,10,-40> color rgb <1,1,1> }
 light_source { <-30,20,-40> color rgb <0.75,0.75,0.75> }
 light_source { <0.5,10,-12> color rgb <0.55,0.55,0.55> }


background {Black}

// Un-comment the following lines to check parameter values,
//   put the name of the parameter after Str(
//text {ttf  "crystal.ttf",  str(l1P1,8,4), 2, 0 translate <-1,1,-2>
texture{White_Marble}}
//text {ttf  "crystal.ttf",  str(l1P2,8,4), 2, 0 translate <-1,0,-2>
texture{White_Marble}}
//text {ttf  "crystal.ttf",  str(l1P3,8,4), 2, 0 translate <-1,-1,-2>
texture{White_Marble}}

//#declare VertScale =  0.03658 ;

// Line for Butte County out of home placements
sphere_sweep {linear_spline 16,
          <-.8, 1.0337, 0>, .01
          <-.7, 1.0155, 0>, .01
          <-.6, 1.0074, 0>, .01
          <-.5, 1.0398, 0>, .01
          <-.4, 1.0196, 0>, .01
          <-.3, 1.0115, 0>, .01
          <-.2, 1.058 , 0>, .01
          <-.1, 1.058 , 0>, .01
          < .0, 1.0721, 0>, .01
          < .1, 1.0742, 0>, .01
          < .2, 1.0984, 0>, .01
          < .3, 1.1065, 0>, .01
          < .4, 1.0863, 0>, .01
          < .5, 1.0519, 0>, .01
          < .6, 1.0438, 0>, .01
          < .7, 1.0641, 0>, .01
       texture {PinkAlabaster}
    }

// Spheres to mark monthly data points
sphere {  <-.8, 1.0337, 0>, .02 texture {PinkAlabaster}}
sphere {  <-.7, 1.0155, 0>, .02 texture {PinkAlabaster}}
sphere {  <-.6, 1.0074, 0>, .02 texture {PinkAlabaster}}
sphere {  <-.5, 1.0398, 0>, .02 texture {PinkAlabaster}}
sphere {  <-.4, 1.0196, 0>, .02 texture {PinkAlabaster}}
sphere {  <-.3, 1.0115, 0>, .02 texture {PinkAlabaster}}
sphere {  <-.2, 1.058 , 0>, .02 texture {PinkAlabaster}}
sphere {  <-.1, 1.058 , 0>, .02 texture {PinkAlabaster}}
sphere {  < .0, 1.0721, 0>, .02 texture {PinkAlabaster}}
sphere {  < .1, 1.0742, 0>, .02 texture {PinkAlabaster}}
sphere {  < .2, 1.0984, 0>, .02 texture {PinkAlabaster}}
sphere {  < .3, 1.1065, 0>, .02 texture {PinkAlabaster}}
sphere {  < .4, 1.0863, 0>, .02 texture {PinkAlabaster}}
sphere {  < .5, 1.0519, 0>, .02 texture {PinkAlabaster}}
sphere {  < .6, 1.0438, 0>, .02 texture {PinkAlabaster}}
sphere {  < .7, 1.0641, 0>, .02 texture {PinkAlabaster}}

// Line for California out-of-home placements
sphere_sweep {linear_spline 16,
          <-.8, 0.5581, 0>, .01
          <-.7, 0.5568, 0>, .01
          <-.6, 0.5586, 0>, .01
          <-.5, 0.5595, 0>, .01
          <-.4, 0.5585, 0>, .01
          <-.3, 0.5549, 0>, .01
          <-.2, 0.5537, 0>, .01
          <-.1, 0.5540, 0>, .01
          <  0, 0.5534, 0>, .01
          < .1, 0.5576, 0>, .01
          < .2, 0.5531, 0>, .01
          < .3, 0.5503, 0>, .01
          < .4, 0.5519, 0>, .01
          < .5, 0.5493, 0>, .01
          < .6, 0.5518, 0>, .01
          < .7, 0.5499, 0>, .01
       texture {Blue_Agate}
    }

 // boxes to mark monthly data points
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <-.8, 0.5581,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <-.7, 0.5568,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <-.6, 0.5586,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <-.5, 0.5595,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <-.4, 0.5585,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <-.3, 0.5549,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <-.2, 0.5537,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <-.1, 0.5540,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate <  0, 0.5534,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate < .1, 0.5576,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate < .2, 0.5531,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate < .3, 0.5503,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate < .4, 0.5519,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate < .5, 0.5493,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate < .6, 0.5518,
0> texture {Blue_Agate}}
box { <-1, -1, -1>, <1, 1, 1> scale 0.02 rotate y*45 translate < .7, 0.5499,
0> texture {Blue_Agate}}


// Vertical scale labels
 text {ttf "times.ttf","1.2", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 1.2 , 0 >}
 text {ttf "times.ttf","1.1", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 1.1 , 0 >}
 text {ttf "times.ttf","1.0", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 1.0 , 0 >}
 text {ttf "times.ttf","0.9", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.9 , 0 >}
 text {ttf "times.ttf","0.8", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.8 , 0 >}
 text {ttf "times.ttf","0.7", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.7 , 0 >}
 text {ttf "times.ttf","0.6", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.6 , 0 >}
 text {ttf "times.ttf","0.5", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.5 , 0 >}
 text {ttf "times.ttf","0.4", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.4 , 0 >}
 text {ttf "times.ttf","0.3", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.3 , 0 >}
 text {ttf "times.ttf","0.2", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.2 , 0 >}
 text {ttf "times.ttf","0.1", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.1 , 0 >}
 text {ttf "times.ttf","0.0", 0.5, 0 scale 0.05 texture {PinkAlabaster}
             translate <-0.9 , 0.0 , 0 >}

// Vertical scale lines
sphere_sweep {linear_spline 2, <-.81, 1.2, 0>, .002 < .71, 1.2, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 1.1, 0>, .002 < .71, 1.1, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 1.0, 0>, .002 < .71, 1.0, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.0, 0>, .002 < .71, 0.0, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.9, 0>, .002 < .71, 0.9, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.8, 0>, .002 < .71, 0.8, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.7, 0>, .002 < .71, 0.7, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.6, 0>, .002 < .71, 0.6, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.5, 0>, .002 < .71, 0.5, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.4, 0>, .002 < .71, 0.4, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.3, 0>, .002 < .71, 0.3, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.2, 0>, .002 < .71, 0.2, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.1, 0>, .002 < .71, 0.1, 0>, .002
texture {Blue_Agate}}
sphere_sweep {linear_spline 2, <-.81, 0.0, 0>, .002 < .71, 0.0, 0>, .002
texture {Blue_Agate}}

// Month labels ( x axis labels )
text {ttf "times.ttf","Jul-01", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate <-0.8-0.03 , -0.05 , 0 >}
text {ttf "times.ttf","Aug-01", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate <-0.7-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Sep-01", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate <-0.6-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Oct-01", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate <-0.5-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Nov-01", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate <-0.4-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Dec-01", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate <-0.3-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Jan-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate <-0.2-0.03 , -0.05 , 0 >}
text {ttf "times.ttf","Feb-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate <-0.1-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Mar-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate < 0.0-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Apr-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate < 0.1-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","May-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate < 0.2-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Jun-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate < 0.3-0.03 , -0.05 , 0 >}
text {ttf "times.ttf","Jul-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate < 0.4-0.03 , -0.05 , 0 >}
text {ttf "times.ttf","Aug-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate < 0.5-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Sep-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate < 0.6-0.04 , -0.05 , 0 >}
text {ttf "times.ttf","Oct-02", 0.5, 0 scale 0.03 texture {PinkAlabaster}
             translate < 0.7-0.04 , -0.05 , 0 >}

// X axis tick marks
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate <-0.8 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate <-0.7 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate <-0.6 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate <-0.5 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate <-0.4 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate <-0.3 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate <-0.2 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate <-0.1 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate < 0.0 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate < 0.1 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate < 0.2 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate < 0.3 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate < 0.4 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate < 0.5 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate < 0.6 , 0, 0 >}
cylinder { <0, 0, 0>, <0, 0.01, 0>, 0.002 texture {Blue_Agate}
             translate < 0.7 , 0, 0 >}
//linder { <0, 0, 0>, <0.007, 0, 0>, 0.002 texture {Blue_Agate}
//           translate < 0.8 , 0.005 , 0 >}






// Declare titles and labels
#declare MainTitle = text {ttf "times.ttf", "Out of Home Placements",
     1, 0  scale 0.10 texture {pigment{color rgb <1.9,1.2,0.15>}}}
#declare SubTitle  = text {ttf "times.ttf", "Butte County and California",
     1, 0 scale 0.06 texture {pigment{color rgb <1.2,1.1,0.05>}}}
#declare footnote  = text {ttf "timesi.ttf",
      "Source: California Department of Social Services, Research and
Development Division",
     1, 0 scale 0.025 texture {PinkAlabaster}}
#declare YLabel  = text {ttf "times.ttf", "Percent of Youth Population",
     1, 0 scale 0.045 texture {PinkAlabaster}}
#declare XLabel  = text {ttf "times.ttf", "",
     2, 0 scale 0.20 texture {PinkAlabaster}}
#declare ZLabel  = text {ttf "times.ttf", "",
     2, 0 scale 0.08 texture {PinkAlabaster}}

//==== Place text in the scene ====
 object {MainTitle translate -x*max_extent(MainTitle).x/2 translate <   0,
1.35, 0.2  > rotate x*-1}
 object {SubTitle  translate -x*max_extent(SubTitle ).x/2 translate <   0,
1.27, 0.23 > rotate x*-1}
 object {footnote  translate -x*max_extent(footnote ).x/2 translate
<-0.6,-0.10, 0.0  > rotate y*0}
 object {XLabel    translate -x*max_extent(XLabel   ).x/2 translate < 2.2, 0
,  0   > rotate y*10}
 object {YLabel    translate -x*max_extent(YLabel   ).x/2  rotate <-8,0,90>
translate < -0.95, 0.6,  0   >}
 object {ZLabel    translate -x*max_extent(ZLabel   ).x/2 translate <
0,-1.47,-4.5 > rotate x*5}




"Slime" <fak### [at] emailaddress> wrote in message
news:40cfdd60@news.povray.org...
> > Yes ..... But, if you could give the exactly source code of the
function,
> i
> > just have to run, it would help me to start ;o) Thanks you
>
> Well, the cylinder that I described is:
>
> cylinder {
> <-100,-100,-100>, // starting point
> <100,100,100>, // ending point
> 0.1 // radius
>
> pigment {rgb 1} // white
> }
>
> You'll also need a light source and a camera.
>
> If this is new to you, then I strongly suggest you read the tutorials that
> come with POV-Ray. Start by clicking on the button in POV-Ray that says
> "Scene", which will bring you to the help files.
>
>  - Slime
>  [ http://www.slimeland.com/ ]
>
>


Post a reply to this message

From: Harold
Subject: Re: show a line in 3D ?
Date: 16 Jun 2004 15:19:32
Message: <40d09d44$1@news.povray.org>
If you try to run that code it may not work because the
text has been wrapped.

For example, this should be on one line and commented
but the mail/news reader has put it on two lines:

-----------------
//text {ttf  "crystal.ttf",  str(l1P1,8,4), 2, 0 translate <-1,1,-2>
texture{White_Marble}}
----------------

To fix you'd need to put "//" before "texture{White_Marble}}"
so POV knows not to parse it as a script line.

H


Post a reply to this message

From: Shay
Subject: Re: show a line in 3D ?
Date: 17 Jun 2004 14:00:19
Message: <40d1dc33@news.povray.org>
"1ternaut" <ded### [at] sparkwirecom> wrote in message
news:40cfa078@news.povray.org...

Look in povray.text.scene-files for an example scene with documentation
references

 -Shay


Post a reply to this message

From:
Subject: Re: show a line in 3D ?
Date: 17 Jun 2004 21:50:37
Message: <40d24a6d$1@news.povray.org>
/*

Hi Harold,

you definitely should learn to use while loops,
arrays and macros; I don't think your chart script
is helpful for beginners.

Your code is very edit-unfriendly -- just try to
leave out the first three months and append three
new months at the end. In your script extensive
rearrangements would be required, in my version
below only the data arrays need to be changed.

Or assume you want other symbols for the blue
graph: this would require changing 16 textures.
In my code this is concentrated in a single place:
the declaration of Box, used in the statement
Sweep (CaliData, Box, Blue_Agate)

Of course much more could be done: automatic
adaption to the number of data points and the
number of graphs, automatic determination of the
range of the values and of nice min/max/stepsize
for the y-axis, automatic fitting to the aspect
ratio of the picture, ...

This whole post is a POV-Ray scene file -- just
render it at 800 by 600 with options
// +SP4 +EP4 +GD +A0.3 +AM2 +R3 -FN
to see an almost exact replica of your chart; then
change the macros and have fun!

I hope this didn't sound too rude, but as this was
offered as help to a beginner, I had to react ...

   Sputnik


*/

//=========BEGIN POV===============================
//--- POV Ray Line Chart Scene File --- 



global_settings { assumed_gamma 2.2 }
#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"


// ---------- Data -----------

#declare ButteData = array [16] {
  1.0337,
  1.0155,
  1.0074,
  1.0398,
  1.0196,
  1.0115,
  1.058 ,
  1.058 ,
  1.0721,
  1.0742,
  1.0984,
  1.1065,
  1.0863,
  1.0519,
  1.0438,
  1.0641 }

#declare CaliData = array [16] {
  0.5581,
  0.5568,
  0.5586,
  0.5595,
  0.5585,
  0.5549,
  0.5537,
  0.5540,
  0.5534,
  0.5576,
  0.5531,
  0.5503,
  0.5519,
  0.5493,
  0.5518,
  0.5499 }

#declare Months = array [16] {
  "Jul-01",
  "Aug-01",
  "Sep-01",
  "Oct-01",
  "Nov-01",
  "Dec-01",
  "Jan-02",
  "Feb-02",
  "Mar-02",
  "Apr-02",
  "May-02",
  "Jun-02",
  "Jul-02",
  "Aug-02",
  "Sep-02",
  "Oct-02" }

// ---------- macro to draw a data line and symbols -----------

#macro Sweep (DataArray, Symbol, Tex)

  union {

    sphere_sweep {linear_spline 16,

      #local Index = 0;
      #while (Index<16)
        <Index/10-.8, DataArray[Index], 0>, .01
        #local Index = Index+1;
      #end//while
    }

    #local Index = 0;
    #while (Index<16)
      object { Symbol translate <Index/10-.8, DataArray[Index], 0> }
      #local Index = Index+1;
    #end//while

    texture {Tex}

  }

#end//macro Sweep


// ---------- untextured symbols for data points -----------

#declare Sphere = sphere { 0, 0.02 }

#declare Box = box { -0.02, 0.02 rotate y*45 }


// ---------- macro to draw vertical labels and lines -----------

#macro LabelsAndLines (LabelTex, LineTex)

  #local Index = 0;
  #while (Index<=12)

    text {ttf "times.ttf",str(Index/10,3,1), 0.5, 0
      scale 0.05
      texture {LabelTex}
      translate <-0.9, Index/10, 0 >
    }

    sphere_sweep {linear_spline 2,
      <-.81, Index/10, 0>, .002
      < .71, Index/10, 0>, .002
      texture {LineTex}
    }

    #local Index = Index+1;
  #end//while

#end//macro LabelsAndLines


// ---------- macro to make centered text -----------

#macro CenteredText (TTFFont, TextString, Thick)

  #local Txt = text {ttf TTFFont, TextString, Thick, 0 }
  #local Mid = max_extent(Txt)/2;

  object { Txt translate -Mid*x }

#end//macro CenteredText


// ---------- macro to draw months and x-ticks -----------

#macro MonthsAndTicks (MonthThick, MonthTex, TickTex)

  #local Index = 0;
  #while (Index<16)

    object { CenteredText ("times.ttf", Months[Index], MonthThick)
      scale 0.03
      texture {MonthTex}
      translate <Index/10-0.8, -0.05, 0>
    }

    cylinder { 0, 0.01*y, 0.002
      texture {TickTex}
      translate (Index/10-0.8)*x
    }

    #local Index = Index+1;
  #end//while

#end//macro LabelsAndLines


// ---------- Lights, Camera, Action -----------

//  Single camera
#declare Camx=-0.1;

 camera {location <Camx, 0.6, -3> look_at <Camx,0.6,0> angle 40}

 light_source { < 10,10,-40> color rgb <1,1,1> }
 light_source { <-30,20,-40> color rgb <0.75,0.75,0.75> }
 light_source { <0.5,10,-12> color rgb <0.55,0.55,0.55> }


background {Black}

// Un-comment the following lines to check parameter values,
//   put the name of the parameter after Str(
//text {ttf  "crystal.ttf",  str(l1P1,8,4), 2, 0 translate <-1,1,-2>
texture{White_Marble}}
//text {ttf  "crystal.ttf",  str(l1P2,8,4), 2, 0 translate <-1,0,-2>
texture{White_Marble}}
//text {ttf  "crystal.ttf",  str(l1P3,8,4), 2, 0 translate <-1,-1,-2>
texture{White_Marble}}

//#declare VertScale =  0.03658 ;


// draw it all (short, readable, editable, isn't it?)

Sweep (ButteData, Sphere, PinkAlabaster)
Sweep (CaliData, Box, Blue_Agate)
LabelsAndLines (PinkAlabaster, Blue_Agate)
MonthsAndTicks (0.5, PinkAlabaster, Blue_Agate)


object { CenteredText ("times.ttf", "Out of Home Placements", 1)
  scale 0.10
  texture {pigment{color rgb <1.9,1.2,0.15>}}
  translate <   0, 1.35, 0.2  >
  rotate x*-1 // why this?!?
}

object { CenteredText ("times.ttf", "Butte County and California", 1)
  scale 0.06
  texture {pigment{color rgb <1.2,1.1,0.05>}}
  translate <   0, 1.27, 0.23 >
  rotate x*-1
}

text {
  ttf "timesi.ttf",
  "Source: California Department of Social Services, Research and
Development Division",
  1, 0
  scale 0.025
  texture {PinkAlabaster}
  translate <-1.05, -0.1, 0>
}

object { CenteredText ("times.ttf", "", 2)
  scale 0.20
  texture {PinkAlabaster}
  translate 2.2*x
  rotate y*10
}

object { CenteredText ("times.ttf", "Percent of Youth Population", 1)
  scale 0.045
  texture {PinkAlabaster}
  rotate <-8,0,90>
  translate < -0.95, 0.6,  0   >
}

object { CenteredText ("times.ttf", "", 2)
  scale 0.08
  texture {PinkAlabaster}
  translate <0,-1.47,-4.5 >
  rotate x*5
}

// ========= That's all =================


Post a reply to this message

From: Richard Dybiec
Subject: Re: show a line in 3D ?
Date: 17 Jun 2004 22:59:50
Message: <40d25aa6@news.povray.org>
1ternaut wrote:
> newbe, I have just installed pov ray 3.6 and I seek has to visualize the
> line of coordonees x, y, z such as x=y=z somebody can he help me?
> I will need the textual file for "run";o)
> 
> 
Here's a simple 3d coordinate symbol; you'll need to change the colors 
to something that 's on your system.

//xyz coordinates symbol
//d = diam of 'lines'
//l = length of leg from origin
#macro coordSys(d,l)
   union {
     cylinder {
       <-l,0,0>,<l,0,0>,d
       texture {
         pigment {color lightRed} finish {flat} //xline
       }
     }
   cylinder {
     <0,-l,0>,<0,l,0>,d
     texture {
       pigment {color lightGreen} finish {flat} //yline
     }
   }
   cylinder {
     <0,0,-l>,<0,0,l>,d
     texture {
       pigment {color lightBlue} finish {flat} //zline
     }
   }
}
#end


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

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