Blender  V3.3
normal_cycle.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * The Original Code is:
3  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
4  * Copyright 2000 Bruno Levy <levy@loria.fr> */
5 
6 #pragma once
7 
12 #include "Geom.h"
13 
14 #include "../system/FreestyleConfig.h"
15 
16 #ifdef WITH_CXX_GUARDEDALLOC
17 # include "MEM_guardedalloc.h"
18 #endif
19 
20 namespace Freestyle {
21 
22 using namespace Geometry;
23 
24 namespace OGF {
25 
26 template<class T> inline void ogf_swap(T &x, T &y)
27 {
28  T z = x;
29  x = y;
30  y = z;
31 }
32 
33 //_________________________________________________________
34 
43 class NormalCycle {
44  public:
45  void begin();
46  void end();
50  void accumulate_dihedral_angle(const Vec3r &edge, real angle, real neigh_area = 1.0);
51 
52  const Vec3r &eigen_vector(int i) const
53  {
54  return axis_[i_[i]];
55  }
56 
57  real eigen_value(int i) const
58  {
59  return eigen_value_[i_[i]];
60  }
61 
62  const Vec3r &N() const
63  {
64  return eigen_vector(2);
65  }
66 
67  const Vec3r &Kmax() const
68  {
69  return eigen_vector(1);
70  }
71 
72  const Vec3r &Kmin() const
73  {
74  return eigen_vector(0);
75  }
76 
77  real n() const
78  {
79  return eigen_value(2);
80  }
81 
82  real kmax() const
83  {
84  return eigen_value(1);
85  }
86 
87  real kmin() const
88  {
89  return eigen_value(0);
90  }
91 
92  private:
93  /* UNUSED */
94  // real center_[3];
95  Vec3r axis_[3];
96  real eigen_value_[3];
97  real M_[6];
98  int i_[3];
99 
100 #ifdef WITH_CXX_GUARDEDALLOC
101  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:OGF:NormalCycle")
102 #endif
103 };
104 
105 inline void NormalCycle::accumulate_dihedral_angle(const Vec3r &edge,
106  const double beta,
107  double neigh_area)
108 {
109  double s = beta * neigh_area / edge.norm();
110 
111  M_[0] += s * edge.x() * edge.x();
112  M_[1] += s * edge.x() * edge.y();
113  M_[2] += s * edge.y() * edge.y();
114  M_[3] += s * edge.x() * edge.z();
115  M_[4] += s * edge.y() * edge.z();
116  M_[5] += s * edge.z() * edge.z();
117 }
118 
119 //_________________________________________________________
120 
121 } // namespace OGF
122 
123 } /* namespace Freestyle */
_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 z
_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 y
Vectors and Matrices (useful type definitions)
Read Guarded memory(de)allocation.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
const Vec3r & eigen_vector(int i) const
Definition: normal_cycle.h:52
const Vec3r & N() const
Definition: normal_cycle.h:62
const Vec3r & Kmin() const
Definition: normal_cycle.h:72
const Vec3r & Kmax() const
Definition: normal_cycle.h:67
real eigen_value(int i) const
Definition: normal_cycle.h:57
#define T
void ogf_swap(T &x, T &y)
Definition: normal_cycle.h:26
inherits from class Rep
Definition: AppCanvas.cpp:18
static unsigned x[3]
Definition: RandGen.cpp:73
double real
Definition: Precision.h:12
ccl_device_inline float beta(float x, float y)
Definition: util/math.h:775