Blender V5.0
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
15
16#include "Geom.h"
17
19
20#include "MEM_guardedalloc.h"
21
22namespace Freestyle {
23
24using namespace Geometry;
25
26namespace OGF {
27
28template<class T> inline void ogf_swap(T &x, T &y)
29{
30 T z = x;
31 x = y;
32 y = z;
33}
34
35//_________________________________________________________
36
46 public:
47 void begin();
48 void end();
52 void accumulate_dihedral_angle(const Vec3r &edge, real angle, real neigh_area = 1.0);
53
54 const Vec3r &eigen_vector(int i) const
55 {
56 return axis_[i_[i]];
57 }
58
59 real eigen_value(int i) const
60 {
61 return eigen_value_[i_[i]];
62 }
63
64 const Vec3r &N() const
65 {
66 return eigen_vector(2);
67 }
68
69 const Vec3r &Kmax() const
70 {
71 return eigen_vector(1);
72 }
73
74 const Vec3r &Kmin() const
75 {
76 return eigen_vector(0);
77 }
78
79 real n() const
80 {
81 return eigen_value(2);
82 }
83
84 real kmax() const
85 {
86 return eigen_value(1);
87 }
88
89 real kmin() const
90 {
91 return eigen_value(0);
92 }
93
94 private:
95 /* UNUSED */
96 // real center_[3];
97 Vec3r axis_[3];
98 real eigen_value_[3];
99 real M_[6];
100 int i_[3];
101
102 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:OGF:NormalCycle")
103};
104
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 */
Configuration definitions.
Vectors and Matrices (useful type definitions).
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Definition IK_Math.h:117
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 x() const
Definition VecMat.h:489
value_type z() const
Definition VecMat.h:509
value_type y() const
Definition VecMat.h:499
value_type norm() const
Definition VecMat.h:92
ccl_device_inline float beta(const float x, const float y)
Definition math_base.h:661
VecMat::Vec3< real > Vec3r
Definition Geom.h:30
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
i
Definition text_draw.cc:230