Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/distort/cylindricalLens.h

Go to the documentation of this file.
00001 // Filename: cylindricalLens.h
00002 // Created by:  drose (12Dec01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef CYLINDRICALLENS_H
00020 #define CYLINDRICALLENS_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "lens.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : CylindricalLens
00028 // Description : A cylindrical lens.  This is the kind of lens
00029 //               generally used for extremely wide panoramic shots.
00030 //               It behaves like a normal perspective lens in the
00031 //               vertical direction, but it is non-linear in the
00032 //               horizontal dimension: a point on the film corresponds
00033 //               to a point in space in linear proportion to its angle
00034 //               to the camera, not to its straight-line distance from
00035 //               the center.
00036 //
00037 //               This allows up to 360 degree lenses in the horizontal
00038 //               dimension, with relatively little distortion.  The
00039 //               distortion is not very apparent between two
00040 //               relatively nearby points on the film, but it becomes
00041 //               increasingly evident as you compare points widely
00042 //               spaced on the film.
00043 ////////////////////////////////////////////////////////////////////
00044 class EXPCL_PANDAFX CylindricalLens : public Lens {
00045 PUBLISHED:
00046   INLINE CylindricalLens();
00047 
00048 public:
00049   INLINE CylindricalLens(const CylindricalLens &copy);
00050   INLINE void operator = (const CylindricalLens &copy);
00051 
00052 public:
00053   virtual PT(Lens) make_copy() const;
00054 
00055 protected:
00056   virtual bool extrude_impl(const LPoint3f &point2d,
00057                             LPoint3f &near_point, LPoint3f &far_point) const;
00058   virtual bool project_impl(const LPoint3f &point3d, LPoint3f &point2d) const;
00059 
00060   virtual float fov_to_film(float fov, float focal_length, bool horiz) const;
00061   virtual float fov_to_focal_length(float fov, float film_size, bool horiz) const;
00062   virtual float film_to_fov(float film_size, float focal_length, bool horiz) const;
00063 
00064 public:
00065   virtual TypeHandle get_type() const {
00066     return get_class_type();
00067   }
00068   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00069   static TypeHandle get_class_type() {
00070     return _type_handle;
00071   }
00072   static void init_type() {
00073     Lens::init_type();
00074     register_type(_type_handle, "CylindricalLens",
00075                   Lens::get_class_type());
00076   }
00077 
00078 private:
00079   static TypeHandle _type_handle;
00080 };
00081 
00082 #include "cylindricalLens.I"
00083 
00084 #endif

Generated on Fri May 2 00:36:38 2003 for Panda by doxygen1.3