POV-Ray : Newsgroups : povray.newusers : Help with arc Server Time
29 Oct 2024 22:48:22 EDT (-0400)
  Help with arc (Message 1 to 5 of 5)  
From: Jack
Subject: Help with arc
Date: 23 Jul 2010 07:05:00
Message: <web.4c49771ad7a2dbc37f6843480@news.povray.org>
Hi All,

I'm new to POV-Ray and I'm trying to create a "bent cylinder" or a thick arc
that passes through 5 points. I think that a quadratic spline might do it, but
I'm not sure exactly how to go about it... The five points I would like it to go
through are the following and I would like are:

sphere {
<0,0,0>, 0.400000
translate <19.857401,2.216100,1.258800>
pigment { rgbt <0.000000,0.000000,1.000000,0.000000> }
}
sphere {
<0,0,0>, 0.400000
translate <21.089600,9.403000,4.822600>
pigment { rgbt <0.000000,0.000000,1.000000,0.000000> }
}
sphere {
<0,0,0>, 0.400000
translate <19.241899,0.224900,9.172700>
pigment { rgbt <0.000000,0.000000,1.000000,0.000000> }}
}
sphere {
<0,0,0>, 0.400000
translate <11.432800,2.216100,11.043700>
pigment { rgbt <0.000000,0.000000,1.000000,0.000000> }
}
sphere {
<0,0,0>, 0.400000
translate <10.200600,9.403000,7.479900>
pigment { rgbt <0.000000,0.000000,1.000000,0.000000> }
}


Help please!


Thanks in Advance,

Jack


Post a reply to this message

From: Alain
Subject: Re: Help with arc
Date: 23 Jul 2010 15:08:23
Message: <4c49e8a7$1@news.povray.org>

> Hi All,
>
> I'm new to POV-Ray and I'm trying to create a "bent cylinder" or a thick arc
> that passes through 5 points. I think that a quadratic spline might do it, but
> I'm not sure exactly how to go about it... The five points I would like it to go
> through are the following and I would like are:
>
> sphere {
> <0,0,0>, 0.400000
> translate<19.857401,2.216100,1.258800>
> pigment { rgbt<0.000000,0.000000,1.000000,0.000000>  }
> }
> sphere {
> <0,0,0>, 0.400000
> translate<21.089600,9.403000,4.822600>
> pigment { rgbt<0.000000,0.000000,1.000000,0.000000>  }
> }
> sphere {
> <0,0,0>, 0.400000
> translate<19.241899,0.224900,9.172700>
> pigment { rgbt<0.000000,0.000000,1.000000,0.000000>  }}
> }
> sphere {
> <0,0,0>, 0.400000
> translate<11.432800,2.216100,11.043700>
> pigment { rgbt<0.000000,0.000000,1.000000,0.000000>  }
> }
> sphere {
> <0,0,0>, 0.400000
> translate<10.200600,9.403000,7.479900>
> pigment { rgbt<0.000000,0.000000,1.000000,0.000000>  }
> }
>
>
> Help please!
>
>
> Thanks in Advance,
>
> Jack
>
>

You can use the sphere_sweep primitive. Try the b_spline and 
cubic_spline. Be warned that those splines uses the first and last 
points as control points and that the actual ubject don't reatch those.

You can also use the spline feature and use it to place many spheres and 
short cylinders to create your curve.
The quadratic_spline neede 2 control points. The natural_spline may be 
beter suited to your need. Please read the documentation carefuly and 
take a look at some sample scenes that use that feature. The 
splinefollow.pov scene from the animations folder is a good sample to start.

Once the spline is defined, you travel through it using a #while() loop.


Alain


Post a reply to this message

From: waggy
Subject: Re: Help with arc
Date: 23 Jul 2010 15:45:00
Message: <web.4c49f12baac6f43cf99d05c80@news.povray.org>
Alain wrote:

> > Hi All,
> >
> > I'm new to POV-Ray and I'm trying to create a "bent cylinder" or a thick arc
> > that passes through 5 points. I think that a quadratic spline might do it, but
> > I'm not sure exactly how to go about it... The five points I would like it to go
> > through are the following and I would like are:
[snip]
>
> You can use the sphere_sweep primitive. Try the b_spline and
> cubic_spline. Be warned that those splines uses the first and last
> points as control points and that the actual ubject don't reatch those.
>
[snip]

I just wrote something similar and found a sphere_sweep with a cubic_spline
works well by making the first point equal to the second, and the next-to-last
equal to the last.  In my case I was only connecting (for example) two corner
points c1 and c2 through a side point s5 in two dimensions.  The radius of the
"bent cylinder" is r.

sphere_sweep{ cubic_spline 5
<c1.x, c1.y, 0>, r
<c1.x, c1.y, 0>, r
<s5.x, s5.y, 0>, r
<c2.x, c2.y, 0>, r
<c2.x, c2.y, 0>, r
}

However, I have not figured out why this sometimes makes some odd loopy
artifacts.


Post a reply to this message

From: Alain
Subject: Re: Help with arc
Date: 24 Jul 2010 16:59:29
Message: <4c4b5431$1@news.povray.org>

> Alain wrote:

>>> Hi All,
>>>
>>> I'm new to POV-Ray and I'm trying to create a "bent cylinder" or a thick arc
>>> that passes through 5 points. I think that a quadratic spline might do it, but
>>> I'm not sure exactly how to go about it... The five points I would like it to go
>>> through are the following and I would like are:
> [snip]
>>
>> You can use the sphere_sweep primitive. Try the b_spline and
>> cubic_spline. Be warned that those splines uses the first and last
>> points as control points and that the actual ubject don't reatch those.
>>
> [snip]
>
> I just wrote something similar and found a sphere_sweep with a cubic_spline
> works well by making the first point equal to the second, and the next-to-last
> equal to the last.  In my case I was only connecting (for example) two corner
> points c1 and c2 through a side point s5 in two dimensions.  The radius of the
> "bent cylinder" is r.
>
> sphere_sweep{ cubic_spline 5
> <c1.x, c1.y, 0>, r
> <c1.x, c1.y, 0>, r
> <s5.x, s5.y, 0>, r
> <c2.x, c2.y, 0>, r
> <c2.x, c2.y, 0>, r
> }
>
> However, I have not figured out why this sometimes makes some odd loopy
> artifacts.
>
>
>

Up until the 2 last 3.7 betas, the sphere_sweep had some bugs causing 
all sort of artefacts.
Also, if you have a control point coincident with an end point, it can 
missbehave. It can work some times, and have some strange effects at others.



Alain


Post a reply to this message

From: Jack
Subject: Re: Help with arc
Date: 29 Jul 2010 08:35:01
Message: <web.4c517532aac6f43c7f6843480@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

> > Alain wrote:

> >>> Hi All,
> >>>
> >>> I'm new to POV-Ray and I'm trying to create a "bent cylinder" or a thick arc
> >>> that passes through 5 points. I think that a quadratic spline might do it, but
> >>> I'm not sure exactly how to go about it... The five points I would like it to go
> >>> through are the following and I would like are:
> > [snip]
> >>
> >> You can use the sphere_sweep primitive. Try the b_spline and
> >> cubic_spline. Be warned that those splines uses the first and last
> >> points as control points and that the actual ubject don't reatch those.
> >>
> > [snip]
> >
> > I just wrote something similar and found a sphere_sweep with a cubic_spline
> > works well by making the first point equal to the second, and the next-to-last
> > equal to the last.  In my case I was only connecting (for example) two corner
> > points c1 and c2 through a side point s5 in two dimensions.  The radius of the
> > "bent cylinder" is r.
> >
[snip]
>
> Up until the 2 last 3.7 betas, the sphere_sweep had some bugs causing
> all sort of artefacts.
> Also, if you have a control point coincident with an end point, it can
> missbehave. It can work some times, and have some strange effects at others.
>
>
>
> Alain


Thanks for your help!

I've got it working now to some extent based on the splinefollow example, I can
get the cylinder to start at one point (purple top), trace through the others in
order but not have it end at the point I would like (purple bottom). It seems to
go through no matter what I do...! Could it be a problem with the while? the
file is pasted below.

Thanks in advance,

Jack

#include "math.inc"
#include "transforms.inc"


camera {
location < 0.0, 0.0, 90.204815 >
right -4/3*x
angle 45.000000
look_at < 0, 0, 0 >
}


light_source {< 1,2,-2>*1000, color 1.0}
light_source {<-1,2, 1>*1000, color 0.7 shadowless}



#declare MySpline1 =
spline {
   cubic_spline

      -2, <15.646700,9.031800,1.374400>,
         -1, <15.646700,9.031800,1.374400>,

    00, <15.646700,9.031800,1.374400>,
   01, < 18.688101,13.562600,7.479900>,
   02, < 11.847900,16.089001,11.043700>,
   03, < 6.218900,10.321700,9.172700>,
   04, < 7.635600,8.793100,1.258800>,
   05, <13.243600,4.132500,4.822600>,
   06, < 15.646700,9.031800,10.928100>,

     12, <15.646700,9.031800,10.928100>,
   13, < 15.646700,9.031800,10.928100>,

}


// The yellow wire that shows the spline path.
union {
   #declare C = 0;
   #declare Cmax= 500;
   #while (C<=Cmax)
      #declare Value1 = C/Cmax*11;
      #declare Value2 = (C+1)/Cmax*11;
      #declare Point1 = -0.5*y+MySpline1(Value1);
      #declare Point2 = -0.5*y+MySpline1(Value2);
      sphere {Point1, 0.4}
      cylinder {Point1, Point2, 0.4}
      #declare C = C+1;
   #end
   pigment {color <1,1,0>}
   matrix < 0.440493, -0.865077, 0.240017,
         -0.873508, -0.474711, -0.107857,
         0.207243, -0.162147, -0.964758,
         0, 0, 0 >
translate< 0.541643, 18.311583, 3.783246 >

}




object {
#declare _WLVP_line_width = 0.02;
#declare _WLVP_dot_size   = 0.03;
#declare _WLVP_text_depth = 0.0;
#declare _WLVP_text_scale = 0.3;
#declare _WLVP_finish = finish { reflection 0.15 brilliance 6 diffuse 0.90
ambient 0.15 phong 0.5 phong_size 10 metallic specular 0.0 }
union {
//purple top
sphere {
<0,0,0>, 1.000000
translate <15.646700,9.031800,1.374400>
pigment { rgbt <0.501961,0.000000,0.501961,0.000000> }
finish { _WLVP_finish }
}
//red 5
sphere {
<0,0,0>, 0.500000
translate <13.243600,4.132500,4.822600>
pigment { rgbt <1.000000,0.000000,0.000000,0.000000> }
finish { _WLVP_finish }
}
//red 4
sphere {
<0,0,0>, 0.600000
translate <7.635600,8.793100,1.258800>
pigment { rgbt <1.000000,0.000000,0.000000,0.000000> }
finish { _WLVP_finish }
}

//red 3
sphere {
<0,0,0>, 0.700000
translate <6.218900,10.321700,9.172700>
pigment { rgbt <1.000000,0.000000,0.000000,0.000000> }
finish { _WLVP_finish }
}

//red 2
sphere {
<0,0,0>, 0.800000
translate <11.847900,16.089001,11.043700>
pigment { rgbt <1.000000,0.000000,0.000000,0.000000> }
finish { _WLVP_finish }
}
//red 1
sphere {
<0,0,0>, 0.900000
translate <18.688101,13.562600,7.479900>
pigment { rgbt <1.000000,0.000000,0.000000,0.000000> }
finish { _WLVP_finish }
}
//purple bottom
sphere {
<0,0,0>, 0.400000
translate <15.646700,9.031800,10.928100>
pigment { rgbt <0.501961,0.000000,0.501961,0.000000> }
finish { _WLVP_finish }
}
matrix < 0.440493, -0.865077, 0.240017,
         -0.873508, -0.474711, -0.107857,
         0.207243, -0.162147, -0.964758,
         0, 0, 0 >
translate< 0.541643, 18.311583, 3.783246 >

}}


Post a reply to this message

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