POV-Ray : Newsgroups : povray.newusers : Camera position for spline object : Re: Camera position for spline object Server Time
28 Mar 2024 11:37:57 EDT (-0400)
  Re: Camera position for spline object  
From: Aj
Date: 19 Jul 2022 14:20:00
Message: <web.62d6f5686b948b66cb63c1d33d902b29@news.povray.org>
"m@b" <sai### [at] googlemailcom> wrote:
> On 23/05/2022 1:08 am, Aj wrote:
> > Hello everyone,
> >
> > I created a spline object using the following code, but I could not get the
> > proper camera position. I was wondering if there is some systematic way to
> > figure out the camera position, and angle and look at vectors for a given shape.
> > Or is it just trial and error? Can someone please help me to get the proper
> > camera setup so as to obtain the figure attached:
> >
> >
>
> The points in your sphere_sweep don't plot the figure in the screen
> shot, the points form a more or less straight line in the z direction.
> (1.png) (Points 5 & 6 are the same.)
>
> Looking again at the screen shot, I notice that the 3 axes are at
> different scales. If I apply scaling and rotation to the points I can
> get something like your figure. Scale = <200,10,1> rotate<0,90,0> (2.png)
>
> Note that I have moved the camera to <0,0,-200>, looking at <0,0,0>. I
> find it easier to keep track of x,y,z if the camera is in the minus z
> position.
>
> If you want a point for the camera to look at, you can find the mean
> center of your plot thus:
>
>   #declare Thing_max = max_extent(Thing);
>   #declare Thing_min = min_extent(Thing);
>   #declare Thing_centre = (max_extent(Thing) + min_extent(Thing))/2;
>
> (Red sphere)
>
> ---------------------------------------------------------------
> #include"colors.inc"
>   camera {
>      //location <-0.0872 , -1.8850 ,   4.8301 >*3.5
>      location <0,0,-200>
>      look_at <0,0,0>
>      angle 22
>      }
>
>
> light_source { <100,100,-100>  color rgb<1,1,1> }
>
> background {color rgb<0.5,0.5,0.5> }
>
> #declare Scale = <200,10,1>;
> //#declare Scale = <1,1,1>;
>
> #declare P01 = Scale*< 0,         0,         -20>;
> #declare P02 = Scale*< 2.583e-09,-2.7093e-08, 3>;
> #declare P03 = Scale*< 0.075646, -0.91834,    8.9288>;
> #declare P04 = Scale*< 0.076898, -2.3756,    14.7492>;
> #declare P05 = Scale*<-0.15231,  -4.2038,    20.4593>;
> #declare P06 = Scale*<-0.15231,  -4.2038,    20.4593>;
>
> #declare Thing = union{
>
>      sphere{P01 0.9 pigment{rgb<0,1,0>}}
>      sphere{P02 0.9 pigment{rgb<0,1,0>}}
>      sphere{P03 0.9 pigment{rgb<0,1,0>}}
>      sphere{P04 0.9 pigment{rgb<0,1,0>}}
>      sphere{P05 0.9 pigment{rgb<0,1,0>}}
>      sphere{P06 0.5 pigment{rgb<0,1,0>}}
>
>
>          sphere_sweep {
>           //b_spline
>           linear_spline
>           6,
>               P01,0.5,
>               P02,0.5,
>               P03,0.5,
>               P04,0.5,
>               P05,0.5,
>               P06,0.5
>           tolerance 0.1
>           texture{ pigment{ color rgb<0.69,0.99,0.15>}
>            finish { phong 1
>             ambient 0.3
>           }
>           }
>           //scale<2,2,0.35>   rotate<-90,0,0>  translate<0,-2,3>
>
>          }
>
>
>
> //rotate<0,90,0>
> rotate<-90,0,0>
> }
>
>
>   #declare Thing_max = max_extent(Thing);
>   #declare Thing_min = min_extent(Thing);
>   #declare Thing_centre = (max_extent(Thing) + min_extent(Thing))/2;
>
> sphere{Thing_centre, 1.5 pigment{rgb<1,0,0>} rotate<0,360*clock,0>}
>
> //box{Thing_min, Thing_max pigment{rgbt<1,0,0,0.8>}
> rotate<0,360*clock,0>}
>
> object{Thing rotate<0,360*clock,0>}

Thank you so much for the help and really sorry I was not able to reply to
everyone as I met with an accident and now I am fit to work. So, I made the
changes in my code and got the following results( please refer to the picture
attached ). So if you see the green object appears to be smaller in length
compared to the white object. Is there a way to restrict the length of the
spline object such that it does not change when the control points move and only
the curvature changes?
To make more sense of what I mean by that, please refer to the website :
https://www.cosseratrods.org/videos/RALvideos/Case2-front_view_web.mp4


Post a reply to this message


Attachments:
Download 'pyel1.png' (15 KB)

Preview of image 'pyel1.png'
pyel1.png


 

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