see describption

profiledecnt_
assignment_1-signed.pdf

The Catholic University of America School of Engineering

Department of Electrical Engineering and Computer Science

CSC  513:  Fundamentals  of  Computer  Graphics   Assignment  1  

 

   

1)  Write  the  parametric  form  of  a  ray  with  source  p  and  direction  d.  

2)  Assuming  d   in  the  above  ray  is  a  unit  vector,  write  an  algorithm  that,  for  an  arbitrary  non-­‐negative   integer  n,  generates  n  evenly  spaced  points  along  the  ray  at  1  unit  intervals.  

3)  Write  the  parametric  form  of  the  unit  circle.  

4)  Given  an  arbitrary  positive  integer  n,  write  an  algorithm  that  generates  n  evenly  spaced  points  that  are   sampled  along  the  unit  circle.  

5)  Suppose  you  have  access  to  the  functions  scale(sx,  sy),  translate(tx,  ty),  and  rotate(α)  which  generate  the   corresponding  2D  homogeneous  transformation  matrices.  Using  these  functions,  write  the  expression  of  a   transformation  T  such  that  if  p  lies  on  the  unit  circle,  Tp  will  lie  on  an  ellipse  centered  at  c,  with  a  major   radius  r1,  minor  radius  r2  and  rotated  at  an  angle  of  α.  You  do  not  have  to  compute  the  full  matrix.  You  may   leave  it  expressed  using  the  above  functions.  Hint:  remember  that  order  is  important  and  that  operations   associate  from  the  "inside  out".  

6)  Write  the  implicit  form  of  the  unit  sphere.    

7)  Given  an  arbitrary  point  p,  write  a  test  to  determine  if  p  is  inside  the  unit  sphere.  

8)  Suppose  you  are  given  an  affine  transformation  T  that  maps  the  unit  sphere  to  some  arbitrarily  located   and  oriented  ellipsoid.  Give  an  expression  which,  given  an  arbitrary  point  p,  determines  if  p  is  inside  said   ellipsoid.  Hint:  use  the  result  from  the  previous  exercise.  

9)  You  are  given  the  vertices  of  a  convex  polygon  in  the  2D  plane  in  counter-­‐clockwise  order  as  (p1,  ...,  pn).   The  coordinates  of  vertex  pi  are  (xi,  yi).    

 

9a)   (3   marks)   Give   an   expression   for   the   coordinates   of   the   outward-­‐facing   normal   ni   of   the   edge   connecting  pi  and  pi+1.  

9b)  (3  marks)  Let  q  =  (xq,  yq)  be  an  arbitrary  point  on  the  plane  containing  the  given  polygon.  Let  l  be  the   line  containing  pi  and  pi+1,  and  let  ni  be  the  outward-­‐facing  normal  vector  as  given  in  part  a).  What  is  a  test   that  determines  whether  or  not  q  lies  on  the  outward  side  of  l  (the  side  toward  which  ni  points)?  

9c)  (5  marks)  Provide  an  algorithm  that  determines  whether  a  2D  point  q   is  inside,  outside,  or  on  the   boundary  of  the  given  polygon.  Hint:  Each  edge  is  contained  in  an  infinite  line.  Each  infinite  line  divides  the   2D  plane  into  two  half-­‐planes:  the  "left"  half-­‐plane  and  the  "right"  half-­‐plane  (left  and  right  are  defined  with   respect  to  a  counter-­‐clockwise  direction  of  traversal  of  the  vertices).  The  key  insight  you  should  use  is  that  the   interior  of  a  convex  polygon  is  the  intersection  of  the  left  half-­‐planes  of  each  edge  of  the  polygon.  

10)   In   stereo   rendering,   two   cameras   are   needed,   with   slightly   different   vantage   points   and   view   directions;  each  is  used  to  render  an  image  for  the  corresponding  eye.    This  can  be  specified  with  the   following  parameters:  

• c:  The  center  of  interest,  a  point  in  world  space  that  lies  along  the  optical  axis  of  both  cameras.     • em:  The  midpoint  between  the  eye  positions  of  each  camera.   • t:  An  “up”  vector  that  allows  us  to  specify  a  tilt  rotation  about  the  axis  passing  through  c  and  em.    

The  z  axis  is  a  special  case.   • s:    The  distance  between  the  two  eyes.    

All   answers   should   be   given   in   terms   of   the   above   stereo   parameters,   as   well   as   any   intermediate   quantities  you  specify.  

 

10a)  Given     an  expression   for   the  unit  vector  d   that   is  perpendicular   to  both   t   and  c   -­‐  em  such   that     (c  -­‐  em,  t,  d)  is  a  right-­‐handed  coordinate  frame.  

10b)  Give  expressions  for  eL  and  eR,  the  eye  positions  of  each  camera.  

10c)  Give  expressions  for  the  basis  vectors  that  make  up  the  two  cameras'  coordinate  frames:  (uL,  vL,  wL)   and  (uR,  vR,  wR)  

10d)  Give  a  test  that  determines  whether  or  not  a  polygon  face  with  normal  n  is  a  back  face  that  can  be   culled  when  rendering  from  both  cameras.  

11)  This  illustration  shows  a  top-­‐down  view  of  a  3D  scene  where  each  blue  edge  corresponds  to  a  planar   square  perpendicular  to  the  image  plane  (i.e.  coming  out  of  the  page)  and  the  eye  e  of  a  possible  viewpoint   lies  in  the  image  plane.    The  short  vectors  are  normal  vectors.    

 

11a)  Assuming  the  particular  scene  and  camera  placement  shown  above,   is   it  possible  to  exclude  any   polygons  from  rendering?  Explain  your  answer.  

11b)  Draw  the  BSP  tree  for  the  above  scene  that  would  result  from  adding  the  polygons  to  the  tree  in  the   order  (S1,  S2,  S3,  S4,  S5,  S6).  

11c)  Describe  how  your  tree  will  be  traversed  when  rendering  the  scene  from  the  eye  location  specified.