27#error PolygonCruncherConfig.h is not included
33BEGIN_MOOTOOLS_NAMESPACE
36 UNDEFINED_OPTIMAL = 0,
37 INVERSEMATRIX_OPTIMAL = 1,
47 MINIMUM_CONTRACTION_PRIORITY = 0,
48 DEFAULT_CONTRACTION_PRIORITY,
49 FLAT_TRIANGLE_CONTRACTION_PRIORITY,
50 FLIP_FACE_CONTRACTION_PRIORITY,
53} CONTRACTION_PRIORITY;
69#define SET_CONTRACTION_INFO(type, priority) ((unsigned char)((type << 2) + priority))
70#define SET_CONTRACTION_PRIORITY(info, priority) ((unsigned char)((info & 0xFC) | (priority & 0x03)))
71#define SET_CONTRACTION_ORDER(info, order) ((unsigned char)((info & 0x1F)|(unsigned char)((order) << 5)))
73#define GET_CONTRACTION_PRIORITY(info) ((unsigned char)(info & 0x03))
74#define GET_CONTRACTION_TYPE(info) ((unsigned char)((info >> 2) & 0x07))
75#define GET_CONTRACTION_ORDER(info) ((unsigned char)(info >> 5))
77class CContractionCost;
78class CInitialCost :
public C3DEdge
80 friend CContractionCost;
94#ifdef MOOTOOLS_PRIVATE_DEBUG
98#ifdef MOOTOOLS_PRIVATE_DEBUG
102 real GetCost()
const;
105 void InitContraction(CONTRACTION_TYPE type, CONTRACTION_PRIORITY priority);
107 CONTRACTION_TYPE GetType()
const;
108 void SetPriority(CONTRACTION_PRIORITY priority);
109 CONTRACTION_PRIORITY GetPriority()
const;
110 void SetOrder(
unsigned char value);
111 unsigned char GetOrder()
const;
112 double GetLineCoef()
const;
117 void SetLineCoef(
double value);
120#ifdef MOOTOOLS_PRIVATE_DEBUG
131 int GetRemainingIndex();
132 int GetReplacedIndex();
137#ifndef MOOTOOLS_NO_INLINE
138inline real CInitialCost::GetCost()
const
143inline void CInitialCost::SetCost(
double newcost)
148inline void CInitialCost::InitContraction(CONTRACTION_TYPE type, CONTRACTION_PRIORITY priority)
150 info = SET_CONTRACTION_INFO(type, priority);
151 #ifdef MOOTOOLS_PRIVATE_DEBUG
152 if (type >= LINE_OPTIMAL)
157inline CONTRACTION_TYPE CInitialCost::GetType()
const
159 MOOTOOLS_PRIVATE_ASSERT(GET_CONTRACTION_TYPE(info) >= UNDEFINED_OPTIMAL && GET_CONTRACTION_TYPE(info) <= POINT2_OPTIMAL);
160 return (CONTRACTION_TYPE)GET_CONTRACTION_TYPE(info);
163inline void CInitialCost::SetPriority(CONTRACTION_PRIORITY priority)
165 info = SET_CONTRACTION_PRIORITY(info, priority);
168inline CONTRACTION_PRIORITY CInitialCost::GetPriority()
const
170 MOOTOOLS_PRIVATE_ASSERT(GET_CONTRACTION_PRIORITY(info) >= MINIMUM_CONTRACTION_PRIORITY && GET_CONTRACTION_PRIORITY(info) <= FLIP_FACE_CONTRACTION_PRIORITY);
171 return (CONTRACTION_PRIORITY)GET_CONTRACTION_PRIORITY(info);
174inline void CInitialCost::SetOrder(
unsigned char value)
176 info = SET_CONTRACTION_ORDER(info, value);
179inline unsigned char CInitialCost::GetOrder()
const
181 return GET_CONTRACTION_ORDER(info);
184inline double CInitialCost::GetLineCoef()
const
186 MOOTOOLS_PRIVATE_ASSERT(GetType() >= LINE_OPTIMAL);
187 MOOTOOLS_PRIVATE_ASSERT(linecoef != -1.0 && linecoef >= 0.0 && linecoef <= 1.0);
194inline void CInitialCost::SetLineCoef(
double value)
196 MOOTOOLS_PRIVATE_ASSERT(GetType() >= LINE_OPTIMAL);
197 MOOTOOLS_PRIVATE_ASSERT(value >= 0.0 && value <= 1.0);
201inline void CInitialCost::SetPos(
const C3DPoint&
pt)
203 MOOTOOLS_PRIVATE_ASSERT(GetType() == INVERSEMATRIX_OPTIMAL);
204 memcpy(pos,
pt.ValPtr(), 3 *
sizeof(real));
212inline int CInitialCost::GetRemainingIndex()
214 if (GetType() == POINT2_OPTIMAL)
216 MOOTOOLS_PRIVATE_ASSERT(linecoef == 0.0f);
225inline int CInitialCost::GetReplacedIndex()
227 if (GetType() == POINT2_OPTIMAL)
229 MOOTOOLS_PRIVATE_ASSERT(linecoef == 0.0f);
239class CContractionCost :
public CInitialCost
242 CContractionCost **heapPtr;
246#ifdef MOOTOOLS_PRIVATE_DEBUG
251#ifndef MOOTOOLS_NO_INLINE
252inline bool CContractionCost::operator < (
const CContractionCost&
refcost)
const
255 if (GET_CONTRACTION_PRIORITY(info) == GET_CONTRACTION_PRIORITY(
refcost.info))
259 if (GET_CONTRACTION_ORDER(info) == GET_CONTRACTION_ORDER(
refcost.info))
261 if (GET_CONTRACTION_TYPE(info) == GET_CONTRACTION_TYPE(
refcost.info))
266 return point2 <
refcost.point2;
268 return point1 <
refcost.point1;
271 return GET_CONTRACTION_TYPE(info) < GET_CONTRACTION_TYPE(
refcost.info);
274 return GET_CONTRACTION_ORDER(info) < GET_CONTRACTION_ORDER(
refcost.info);
281 return GET_CONTRACTION_PRIORITY(info) < GET_CONTRACTION_PRIORITY(
refcost.info);
295 void InitHeap(
const CContractionCost *,
unsigned int,
C3DExtObject *);
297#ifdef MOOTOOLS_PRIVATE_DEBUG
305 CContractionCost **Insert(CContractionCost *X);
308 void DeleteMin(CContractionCost *&X );
311 unsigned int GetSize();
312 CContractionCost *GetAt(
unsigned int i);
314 void RemoveAt(CContractionCost **X );
322 unsigned int MaxSize;
323 unsigned int CurrentSize;
325 CContractionCost **Array;
326 CContractionCost lowestVal;
328#ifdef MOOTOOLS_PRIVATE_DEBUG
333 void PercolateDown(
unsigned int Index );
337#ifndef MOOTOOLS_NO_INLINE
338inline CContractionCost *CostHeap::GetAt(
unsigned int i)
340 MOOTOOLS_PRIVATE_ASSERT(
i < CurrentSize);
345END_MOOTOOLS_NAMESPACE
C3DFaceList class definition which is a list of C3DFace.
C3DPointList class definition for handling a list of C3DPoint.
C3DEdge is a class containing 2 point indexes that represent the edge of a face.
Definition FaceList.h:72
This class handles static optimization of an object.
Definition 3DExtObject.h:66
Definition 3DPointList.h:267
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27