Blender V5.0
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
19
20#include "../geometry/Geom.h"
21
23#include "../system/Precision.h"
24
25#include "MEM_guardedalloc.h"
26
27namespace Freestyle {
28
29using namespace Geometry;
30
31class WVertex;
32
34 public:
36 {
37 K1 = 0.0;
38 K2 = 0.0;
39 e1 = Vec3r(0.0, 0.0, 0.0);
40 e2 = Vec3r(0.0, 0.0, 0.0);
41 Kr = 0.0;
42 dKr = 0.0;
43 er = Vec3r(0.0, 0.0, 0.0);
44 }
45
47 {
48 K1 = iBrother.K1;
49 K2 = iBrother.K2;
50 e1 = iBrother.e1;
51 e2 = iBrother.e2;
52 Kr = iBrother.Kr;
53 dKr = iBrother.dKr;
54 er = iBrother.er;
55 }
56
58 {
59 K1 = ca.K1 + t * (cb.K1 - ca.K1);
60 K2 = ca.K2 + t * (cb.K2 - ca.K2);
61 e1 = ca.e1 + t * (cb.e1 - ca.e1);
62 e2 = ca.e2 + t * (cb.e2 - ca.e2);
63 Kr = ca.Kr + t * (cb.Kr - ca.Kr);
64 dKr = ca.dKr + t * (cb.dKr - ca.dKr);
65 er = ca.er + t * (cb.er - ca.er);
66 }
67
68 real K1; // maximum curvature
69 real K2; // minimum curvature
70 Vec3r e1; // maximum curvature direction
71 Vec3r e2; // minimum curvature direction
72 real Kr; // radial curvature
73 real dKr; // radial curvature
74 Vec3r er; // radial curvature direction
75
76 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:CurvatureInfo")
77};
78
80 public:
82
84 {
85 for (vector<CurvatureInfo *>::iterator ci = vec_curvature_info.begin(),
86 ciend = vec_curvature_info.end();
87 ci != ciend;
88 ++ci)
89 {
90 delete (*ci);
91 }
92 vec_curvature_info.clear();
93 }
94
95 vector<CurvatureInfo *> vec_curvature_info;
96
97 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Face_Curvature_Info")
98};
99
121
138
153void gts_vertex_principal_curvatures(real Kh, real Kg, real *K1, real *K2);
154
170
171namespace OGF {
172
173class NormalCycle;
174
175void compute_curvature_tensor(WVertex *start, double radius, NormalCycle &nc);
176
177void compute_curvature_tensor_one_ring(WVertex *start, NormalCycle &nc);
178
179} // namespace OGF
180
181} /* 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:46
CurvatureInfo(const CurvatureInfo &ca, const CurvatureInfo &cb, real t)
Definition Curvature.h:57
vector< CurvatureInfo * > vec_curvature_info
Definition Curvature.h:95
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