basic/geometry/geo_rangesensor/MgcFrustum.cpp

Go to the documentation of this file.
00001 // Magic Software, Inc.
00002 // http://www.magic-software.com
00003 // Copyright (c) 2000, All Rights Reserved
00004 //
00005 // Source code from Magic Software is supplied under the terms of a license
00006 // agreement and may not be copied or disclosed except in accordance with the
00007 // terms of that agreement.  The various license agreements may be found at
00008 // the Magic Software web site.  This file is subject to the license
00009 //
00010 // FREE SOURCE CODE
00011 // http://www.magic-software.com/License.html/free.pdf
00012 
00013 #include "MgcFrustum.h"
00014 
00015 //----------------------------------------------------------------------------
00016 MgcFrustum::MgcFrustum ()
00017     :
00018     m_kOrigin(MgcVector3::ZERO),
00019     m_kLVector(MgcVector3::UNIT_X),
00020     m_kUVector(MgcVector3::UNIT_Y),
00021     m_kDVector(MgcVector3::UNIT_Z)
00022 {
00023     m_fLBound = 1.0;
00024     m_fUBound = 1.0;
00025     m_fDMin = 1.0;
00026     m_fDMax = 2.0;
00027 
00028     Update();
00029 }
00030 //----------------------------------------------------------------------------
00031 void MgcFrustum::ComputeVertices (MgcVector3 akVertex[8]) const
00032 {
00033     MgcVector3 kDScaled = m_fDMin*m_kDVector;
00034     MgcVector3 kLScaled = m_fLBound*m_kLVector;
00035     MgcVector3 kUScaled = m_fUBound*m_kUVector;
00036 
00037     akVertex[0] = kDScaled - kLScaled - kUScaled;
00038     akVertex[1] = kDScaled - kLScaled + kUScaled;
00039     akVertex[2] = kDScaled + kLScaled + kUScaled;
00040     akVertex[3] = kDScaled + kLScaled - kUScaled;
00041 
00042     for (int i = 0, ip = 4; i < 4; i++, ip++)
00043     {
00044         akVertex[ip] = m_kOrigin + m_fDRatio*akVertex[i];
00045         akVertex[i] += m_kOrigin;
00046     }
00047 }
00048 //----------------------------------------------------------------------------
00049 void MgcFrustum::Update ()
00050 {
00051     m_fDRatio = m_fDMax/m_fDMin;
00052     m_fMTwoLF = -2.0*m_fLBound*m_fDMax;
00053     m_fMTwoUF = -2.0*m_fUBound*m_fDMax;
00054 }
00055 //----------------------------------------------------------------------------

Generated on Sat Apr 1 21:30:31 2006 for Motion Planning Kernel by  doxygen 1.4.6-NO