Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

frustum.h

Go to the documentation of this file.
00001 // frustum.h
00002 // 
00003 // Copyright (C) 2000, Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #ifndef _FRUSTUM_H_
00011 #define _FRUSTUM_H_
00012 
00013 #include <celmath/plane.h>
00014 
00015 
00016 class Frustum
00017 {
00018  public:
00019     Frustum(float fov, float aspectRatio, float nearDist);
00020     Frustum(float fov, float aspectRatio, float nearDist, float farDist);
00021 
00022     void transform(const Mat3f&);
00023     void transform(const Mat4f&);
00024 
00025     inline Planef getPlane(int) const;
00026 
00027     enum {
00028         Bottom    = 0,
00029         Top       = 1,
00030         Left      = 2,
00031         Right     = 3,
00032         Near      = 4,
00033         Far       = 5,
00034     };
00035 
00036     enum Aspect {
00037         Outside   = 0,
00038         Inside    = 1,
00039         Intersect = 2,
00040     };
00041 
00042     Aspect test(const Point3f&) const;
00043     Aspect testSphere(const Point3f& center, float radius) const;
00044     Aspect testSphere(const Point3d& center, double radius) const;
00045 
00046  private:
00047     void init(float, float, float, float);
00048 
00049     Planef planes[6];
00050     bool infinite;
00051 };
00052 
00053 Planef Frustum::getPlane(int which) const
00054 {
00055     return planes[which];
00056 }
00057 
00058 #endif // _FRUSTUM_H_

Generated on Sat Jan 14 22:30:32 2006 for Celestia by  doxygen 1.4.1