POV-Ray : Newsgroups : povray.newusers : Camera position for spline object : Re: Camera position for spline object Server Time
28 Apr 2024 08:59:17 EDT (-0400)
  Re: Camera position for spline object  
From: m@b
Date: 23 May 2022 11:13:21
Message: <628ba491@news.povray.org>
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>}


Post a reply to this message


Attachments:
Download '1.png' (7 KB) Download '2.png' (10 KB)

Preview of image '1.png'
1.png

Preview of image '2.png'
2.png


 

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