Blender V4.3
Curvature.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 1999 Stephane Popinet
2 * SPDX-FileCopyrightText: 2000-2003 `Bruno Levy <levy@loria.fr>`
3 * SPDX-FileCopyrightText: 2023 Blender Authors
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 *
7 * The Original Code is:
8 * - GTS - Library for the manipulation of triangulated surfaces.
9 * - OGF/Graphite: Geometry and Graphics Programming Library + Utilities.
10 */
11
12#pragma once
13
20#include "../geometry/Geom.h"
21
23#include "../system/Precision.h"
24
25#ifdef WITH_CXX_GUARDEDALLOC
26# include "MEM_guardedalloc.h"
27#endif
28
29namespace Freestyle {
30
31using namespace Geometry;
32
33class WVertex;
34
36 public:
38 {
39 K1 = 0.0;
40 K2 = 0.0;
41 e1 = Vec3r(0.0, 0.0, 0.0);
42 e2 = Vec3r(0.0, 0.0, 0.0);
43 Kr = 0.0;
44 dKr = 0.0;
45 er = Vec3r(0.0, 0.0, 0.0);
46 }
47
49 {
50 K1 = iBrother.K1;
51 K2 = iBrother.K2;
52 e1 = iBrother.e1;
53 e2 = iBrother.e2;
54 Kr = iBrother.Kr;
55 dKr = iBrother.dKr;
56 er = iBrother.er;
57 }
58
60 {
61 K1 = ca.K1 + t * (cb.K1 - ca.K1);
62 K2 = ca.K2 + t * (cb.K2 - ca.K2);
63 e1 = ca.e1 + t * (cb.e1 - ca.e1);
64 e2 = ca.e2 + t * (cb.e2 - ca.e2);
65 Kr = ca.Kr + t * (cb.Kr - ca.Kr);
66 dKr = ca.dKr + t * (cb.dKr - ca.dKr);
67 er = ca.er + t * (cb.er - ca.er);
68 }
69
70 real K1; // maximum curvature
71 real K2; // minimum curvature
72 Vec3r e1; // maximum curvature direction
73 Vec3r e2; // minimum curvature direction
74 real Kr; // radial curvature
75 real dKr; // radial curvature
76 Vec3r er; // radial curvature direction
77
78#ifdef WITH_CXX_GUARDEDALLOC
79 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:CurvatureInfo")
80#endif
81};
82
84 public:
86
88 {
89 for (vector<CurvatureInfo *>::iterator ci = vec_curvature_info.begin(),
90 ciend = vec_curvature_info.end();
91 ci != ciend;
92 ++ci)
93 {
94 delete (*ci);
95 }
96 vec_curvature_info.clear();
97 }
98
99 vector<CurvatureInfo *> vec_curvature_info;
100
101#ifdef WITH_CXX_GUARDEDALLOC
102 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Face_Curvature_Info")
103#endif
104};
105
127
144
159void gts_vertex_principal_curvatures(real Kh, real Kg, real *K1, real *K2);
160
176
177namespace OGF {
178
179class NormalCycle;
180
181void compute_curvature_tensor(WVertex *start, double radius, NormalCycle &nc);
182
183void compute_curvature_tensor_one_ring(WVertex *start, NormalCycle &nc);
184
185} // namespace OGF
186
187} /* namespace Freestyle */
Configuration definitions.
Vectors and Matrices (useful type definitions)
Read Guarded memory(de)allocation.
Define the float precision used in the program.
ATTR_WARN_UNUSED_RESULT const BMVert * v
CurvatureInfo(const CurvatureInfo &iBrother)
Definition Curvature.h:48
CurvatureInfo(const CurvatureInfo &ca, const CurvatureInfo &cb, real t)
Definition Curvature.h:59
vector< CurvatureInfo * > vec_curvature_info
Definition Curvature.h:99
VecMat::Vec3< real > Vec3r
Definition Geom.h:30
void compute_curvature_tensor(WVertex *start, real radius, NormalCycle &nc)
void compute_curvature_tensor_one_ring(WVertex *start, NormalCycle &nc)
inherits from class Rep
Definition AppCanvas.cpp:20
void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, Vec3r &e2)
bool gts_vertex_gaussian_curvature(WVertex *v, real *Kg)
bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh)
Definition Curvature.cpp:88
void gts_vertex_principal_curvatures(real Kh, real Kg, real *K1, real *K2)
double real
Definition Precision.h:14