CFx SDK Documentation  2023 SP0
GiTransformed.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 
26 
27 // GiBaseVectorizer.h: interface for the OdGiBaseVectorizer class.
28 //
30 
31 #ifndef _ODGITRANSFORMED_INCLUDED_
32 #define _ODGITRANSFORMED_INCLUDED_
33 
34 
35 #include "Gi/GiBaseVectorizer.h"
36 #include "OdStack.h"
37 
38 #include "TD_PackPush.h"
39 
45 template <class T> class OdGiTransformed : public T
46 {
47  struct Transforms
48  {
49  Transforms() : bWorldToModelValid(false) {}
50  OdGeMatrix3d xModelToWorld;
51  mutable OdGeMatrix3d xWorldToModel;
52  mutable bool bWorldToModelValid;
53  };
54  OdStack<Transforms> m_TransformStack;
55 
56  public:
57 
58  void pushModelTransform(const OdGeMatrix3d& xMat)
59  {
60  const Transforms* pPrev = m_TransformStack.top();
61  Transforms* pNew = m_TransformStack.push();
62  if(pPrev)
63  {
64  pNew->xModelToWorld.setToProduct(pPrev->xModelToWorld, xMat);
65  }
66  else
67  {
68  pNew->xModelToWorld = xMat;
69  }
70  }
71 
72  void pushModelTransform(const OdGeVector3d& vNormal)
73  {
75  }
76 
78  {
79  m_TransformStack.pop();
80  }
81 
83  {
84  if(m_TransformStack.top())
85  return m_TransformStack.top()->xModelToWorld;
87  }
88 
90  {
91  const Transforms* pTop = m_TransformStack.top();
92  if(pTop)
93  {
94  if(!pTop->bWorldToModelValid)
95  {
96  pTop->xWorldToModel = pTop->xModelToWorld.inverse();
97  pTop->bWorldToModelValid = true;
98  }
99  return pTop->xWorldToModel;
100  }
102  }
103 };
104 
105 #include "TD_PackPop.h"
106 
107 #endif // #ifndef _ODGITRANSFORMED_INCLUDED_
static OdGeMatrix3d planeToWorld(const OdGeVector3d &normal)
static GE_STATIC_EXPORT const OdGeMatrix3d kIdentity
Definition: GeMatrix3d.h:79
void popModelTransform()
Definition: GiTransformed.h:77
OdGeMatrix3d getModelToWorldTransform() const
Definition: GiTransformed.h:82
OdGeMatrix3d getWorldToModelTransform() const
Definition: GiTransformed.h:89
void pushModelTransform(const OdGeMatrix3d &xMat)
Definition: GiTransformed.h:58
void pushModelTransform(const OdGeVector3d &vNormal)
Definition: GiTransformed.h:72
const T * top() const
Definition: OdStack.h:77
void push(const T &inVal)
Definition: OdStack.h:61
void pop(T &outVal)
Definition: OdStack.h:70