GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_abstractmanipulator.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
22 
24 #include "../viewport/glc_viewport.h"
25 #include "../maths/glc_geomtools.h"
26 
27 #include <QtGlobal>
28 
30 : m_pViewport(pViewport)
31 , m_SliddingPlane()
32 , m_PreviousPosition()
33 , m_IsInManipulateState(false)
34 {
35  Q_ASSERT(NULL != m_pViewport);
36 }
37 
39 : m_pViewport(abstractManipulator.m_pViewport)
40 , m_SliddingPlane(abstractManipulator.m_SliddingPlane)
41 , m_PreviousPosition(abstractManipulator.m_PreviousPosition)
42 , m_IsInManipulateState(abstractManipulator.m_IsInManipulateState)
43 {
44 
45 }
46 
48 {
49 }
50 
52 {
54 
55  m_PreviousPosition = startPoint;
57 }
58 
60 {
61  Q_ASSERT(m_IsInManipulateState);
62 
63  // Select the projection direction
64  GLC_Vector3d projectionDirection;
65  if (m_pViewport->useOrtho())
66  {
67  projectionDirection= m_pViewport->cameraHandle()->forward().normalize();
68  }
69  else
70  {
71  projectionDirection= (newPoint - m_pViewport->cameraHandle()->eye());
72  }
73 
74  // Use concrete class to compute matrix
75  GLC_Matrix4x4 transformation(doManipulate(newPoint, projectionDirection));
76 
77  return transformation;
78 }

©2005-2013 Laurent Ribon