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