Blender  V3.3
Interface1D.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include <float.h>
11 #include <iostream>
12 #include <string>
13 
14 #include "Functions0D.h"
15 
16 #include "../system/Id.h"
17 #include "../system/Precision.h"
18 
19 #include "../winged_edge/Nature.h"
20 
21 #ifdef WITH_CXX_GUARDEDALLOC
22 # include "MEM_guardedalloc.h"
23 #endif
24 
25 using namespace std;
26 
27 namespace Freestyle {
28 
29 // Integration method
34 typedef enum {
43  MIN,
48  MAX,
60 
72 template<class T>
75  Interface0DIterator it_end,
76  IntegrationType integration_type = MEAN)
77 {
78  T res;
79  unsigned size;
80  switch (integration_type) {
81  case MIN:
82  fun(it);
83  res = fun.result;
84  ++it;
85  for (; !it.isEnd(); ++it) {
86  fun(it);
87  if (fun.result < res) {
88  res = fun.result;
89  }
90  }
91  break;
92  case MAX:
93  fun(it);
94  res = fun.result;
95  ++it;
96  for (; !it.isEnd(); ++it) {
97  fun(it);
98  if (fun.result > res) {
99  res = fun.result;
100  }
101  }
102  break;
103  case FIRST:
104  fun(it);
105  res = fun.result;
106  break;
107  case LAST:
108  fun(--it_end);
109  res = fun.result;
110  break;
111  case MEAN:
112  default:
113  fun(it);
114  res = fun.result;
115  ++it;
116  for (size = 1; !it.isEnd(); ++it, ++size) {
117  fun(it);
118  res += fun.result;
119  }
120  res /= (size ? size : 1);
121  break;
122  }
123  return res;
124 }
125 
126 //
127 // Interface1D
128 //
130 
132 class Interface1D {
133  public:
136  {
137  _timeStamp = 0;
138  }
139 
141  virtual ~Interface1D(){};
142 
144  virtual string getExactTypeName() const
145  {
146  return "Interface1D";
147  }
148 
149  // Iterator access
150 
152  virtual Interface0DIterator verticesBegin();
153 
155  virtual Interface0DIterator verticesEnd();
156 
163  virtual Interface0DIterator pointsBegin(float t = 0.0f);
164 
171  virtual Interface0DIterator pointsEnd(float t = 0.0f);
172 
173  // Data access methods
174 
176  virtual real getLength2D() const;
177 
179  virtual Id getId() const;
180 
181  // FIXME: ce truc n'a rien a faire la...(c une requete complexe qui doit etre ds les Function1D)
183  virtual Nature::EdgeNature getNature() const;
184 
186  virtual unsigned getTimeStamp() const
187  {
188  return _timeStamp;
189  }
190 
192  inline void setTimeStamp(unsigned iTimeStamp)
193  {
194  _timeStamp = iTimeStamp;
195  }
196 
197  protected:
198  unsigned _timeStamp;
199 
200 #ifdef WITH_CXX_GUARDEDALLOC
201  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Interface1D")
202 #endif
203 };
204 
205 } /* namespace Freestyle */
#define MAX(a, b)
Definition: Common.h:13
Functions taking 0D input.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
virtual bool isEnd() const
Definition: Interface0D.h:282
virtual unsigned getTimeStamp() const
Definition: Interface1D.h:186
virtual string getExactTypeName() const
Definition: Interface1D.h:144
void setTimeStamp(unsigned iTimeStamp)
Definition: Interface1D.h:192
@ FIRST
Definition: curve_intern.h:49
@ LAST
Definition: curve_intern.h:50
#define T
unsigned short EdgeNature
Definition: Nature.h:32
inherits from class Rep
Definition: AppCanvas.cpp:18
T integrate(UnaryFunction0D< T > &fun, Interface0DIterator it, Interface0DIterator it_end, IntegrationType integration_type=MEAN)
Definition: Interface1D.h:73
double real
Definition: Precision.h:12