Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
3DExtPoint.h
Go to the documentation of this file.
1//! @file 3DExtPoint.h
2//! @brief C3DExtPoint class is used internally by C3DExtObject during optimization computation
3//!
4//////////////////////////////////////////////////////////////////////
5
6#if !defined(AFX_3DEXTPOINT_H__BB3D80E9_003C_11D2_A0E3_000000000000__INCLUDED_)
7#define AFX_3DEXTPOINT_H__BB3D80E9_003C_11D2_A0E3_000000000000__INCLUDED_
8
9#ifdef _MSC_VER
10#pragma once
11#endif // _MSC_VER
12
13#include "3DPointList.h"
14#include "SymMatrix.h"
15#include "3DFaceList.h"
16
17BEGIN_MOOTOOLS_NAMESPACE
18
19//#define PLY_SEPARATE_CONSTRAINT 1
20
21class CExtPointList;
22class DLLFUNCTION C3DExtPoint : public C3DPoint
23{
24public:
25 using C3DPoint::operator=;
26 // DECLARE_SERIAL_XOBJECT(C3DExtPoint)
27
28 CSymMatrix quadric;
29#ifdef PLY_ALPHA_FEATURE
30 CSymMatrix constraint;
31#endif
32
33 C3DExtPoint(real = 0, real = 0, real = 0);
34 virtual ~C3DExtPoint();
35
36 CSymMatrix& GetQuadric();
37 CPt& operator=(const CPt& pt);
38 C3DExtPoint& operator=(const C3DPoint& pt);
39 C3DExtPoint& operator=(const C3DExtPoint& pt);
40
41 #ifdef _DEBUG
42 virtual bool IsKindOf(unsigned int classid) const;
43 virtual unsigned int ClassID() const;
44 #endif
45};
46
47inline CSymMatrix& C3DExtPoint::GetQuadric()
48{
49 return quadric;
50}
51
52inline CPt& C3DExtPoint::operator=(const CPt& pt)
53{
54 XASSERT(pt.ClassID() == ClassID());
55
56 ((C3DExtPoint*)this)->C3DPoint::operator=((C3DExtPoint&)pt);
57 ((C3DExtPoint *)this)->quadric = ((C3DExtPoint&)pt).quadric;
58
59 return *this;
60}
61
62inline C3DExtPoint& C3DExtPoint::operator=(const C3DPoint& pt)
63{
64 this->C3DPoint::operator=(pt);
65 return *this;
66}
67
68inline C3DExtPoint& C3DExtPoint::operator=(const C3DExtPoint& pt)
69{
70 this->C3DPoint::operator=(pt);
71 quadric = pt.quadric;
72 return *this;
73}
74
75class C3DExPointMethods : public C3DPointMethods
76{
77 // DECLARE_SERIAL_XOBJECT is a problem for dynamic data exchange because this class is not recognized by the default 3DModule
78 // and serializing the class can be possible from PolygonCruncher but reading the class will fails if PolygonCruncher is not here (ie during a dynamic exchange with sketchup for example)
79
80 SIZET GetSizeof() const;
81 ElementType GetType() const;
82 void ConstructElement(void* pNewData);
83 bool IsKindOf(const CElementMethods *methods) const;
84 void CopyElement(void* pDest, const CElementMethods *pDstMethods, const void* pSrc, const CElementMethods *pSrcMethods);
85};
86
87inline SIZET C3DExPointMethods::GetSizeof() const
88{
89 return sizeof(C3DExtPoint);
90}
91
92inline ElementType C3DExPointMethods::GetType() const
93{
94 return MAKE_CUSTOM_ID('3', 'D', 'E', 'P');
95}
96
97inline void C3DExPointMethods::ConstructElement(void* pNewData)
98{
99 xConstruct(C3DExtPoint, pNewData);
100}
101
103{
104 if (methods->GetType() == C3DPointMethods::GetType())
105 return true;
106
108}
109
110inline void C3DExPointMethods::CopyElement(void* pDest, const CElementMethods *pDstMethods, const void* pSrc, const CElementMethods *pSrcMethods)
111{
112 XASSERT(pDstMethods->GetType() == GetType() || pDstMethods->GetType() == C3DPointMethods::GetType());
113 XASSERT(pSrcMethods->GetType() == GetType() || pSrcMethods->GetType() == C3DPointMethods::GetType());
114 ((C3DPoint*)pDest)->C3DPoint::operator=(*((C3DPoint *)pSrc));
115}
116
117class DLLFUNCTION CExtPointList : public C3DPointList
118{
119 // DECLARE_SERIAL_XOBJECT is a problem for dynamic data exchange because this class is not recognized by the default 3DModule
120 // and serializing the class can be possible from PolygonCruncher but reading the class will fails if PolygonCruncher is not here (ie during a dynamic exchange with sketchup for example)
121 //
122 // Anyway we need to be able to differentiate C3DPointList and CExtPointList, this is why DECLARE_SERIAL_XOBJECT is set.
123 // But as a consequence C3DBaseObject::Serialize calls directly C3DPointList::Serialize and C3DExtPointList is forgot when performing dynamic data exchange
124public:
125 using C3DPointList::operator=;
126
127 DECLARE_SERIAL_XOBJECT(CExtPointList)
128
129 CExtPointList(CExtPointList *srcPoints = NULL);
130 virtual ~CExtPointList();
131
132 C3DExtPoint *GetFirst();
133 C3DExtPoint *GetNext(C3DExtPoint *pointList);
134 C3DExtPoint *ElementAt(int i);
135 C3DExtPoint *operator[](int i);
136
137 void SetAt(int nIndex, const C3DPoint *pt);
138 void SetAt(int nIndex, const C3DExtPoint *pt);
139};
140
141inline C3DExtPoint *CExtPointList::GetFirst()
142{
143 return (C3DExtPoint *)CElementArray::GetFirst();
144}
145
146inline C3DExtPoint *CExtPointList::GetNext(C3DExtPoint *pointList)
147{
148 return (C3DExtPoint *)CElementArray::GetNext(pointList);
149}
150
151inline C3DExtPoint *CExtPointList::ElementAt(int i)
152{
153 return ((C3DExtPoint *)CElementArray::ElementAt(i));
154}
155
156inline C3DExtPoint *CExtPointList::operator[](int i)
157{
158 return ((C3DExtPoint *)CElementArray::operator[](i));
159}
160
161inline void CExtPointList::SetAt(int nIndex, const C3DPoint *pt)
162{
163 if (nIndex < GetSize())
164 *((*this)[nIndex]) = *pt;
165}
166
167inline void CExtPointList::SetAt(int nIndex, const C3DExtPoint *pt)
168{
169 if (nIndex < GetSize())
170 *((*this)[nIndex]) = *pt;
171}
172
173END_MOOTOOLS_NAMESPACE
174
175#endif // !defined(AFX_3DEXTPOINT_H__BB3D80E9_003C_11D2_A0E3_000000000000__INCLUDED_)
C3DFaceList class definition which is a list of C3DFace.
C3DPointList class definition for handling a list of C3DPoint.
Definition 3DPointList.h:267
CElementMethods is provided to CElementArray and give some information on the data as well as the met...
Definition ElementArray.h:22
virtual bool IsKindOf(const CElementMethods *methods) const
For class we if this->GetBaseType() == B->GetType() that means that this knows how to copy from B.
CPt base only contains some flags that are used by the derived class.
Definition Point.h:60