pcb 4.1.1
An interactive printed circuit board layout editor.

curvature.c File Reference

#include <math.h>
#include "gts.h"
Include dependency graph for curvature.c:

Go to the source code of this file.

Functions

static gboolean angle_obtuse (GtsVertex *v, GtsFace *f)
static gboolean triangle_obtuse (GtsVertex *v, GtsFace *f)
static gdouble cotan (GtsVertex *vo, GtsVertex *v1, GtsVertex *v2)
static gdouble angle_from_cotan (GtsVertex *vo, GtsVertex *v1, GtsVertex *v2)
static gdouble region_area (GtsVertex *v, GtsFace *f)
gboolean gts_vertex_mean_curvature_normal (GtsVertex *v, GtsSurface *s, GtsVector Kh)
gboolean gts_vertex_gaussian_curvature (GtsVertex *v, GtsSurface *s, gdouble *Kg)
void gts_vertex_principal_curvatures (gdouble Kh, gdouble Kg, gdouble *K1, gdouble *K2)
static void linsolve (gdouble m11, gdouble m12, gdouble b1, gdouble m21, gdouble m22, gdouble b2, gdouble *x1, gdouble *x2)
static void eigenvector (gdouble a, gdouble b, gdouble c, GtsVector e)
void gts_vertex_principal_directions (GtsVertex *v, GtsSurface *s, GtsVector Kh, gdouble Kg, GtsVector e1, GtsVector e2)

Function Documentation

static gdouble angle_from_cotan ( GtsVertex vo,
GtsVertex v1,
GtsVertex v2 
) [static]

Definition at line 64 of file curvature.c.

References GTS_POINT, gts_vector_init, gts_vector_scalar, and u().

Referenced by gts_vertex_gaussian_curvature().

Here is the call graph for this function:

static gboolean angle_obtuse ( GtsVertex v,
GtsFace f 
) [static]

Definition at line 23 of file curvature.c.

References GTS_POINT, GTS_SEGMENT, GTS_TRIANGLE, gts_triangle_edge_opposite(), gts_vector_init, and gts_vector_scalar.

Referenced by gts_vertex_principal_directions(), region_area(), and triangle_obtuse().

Here is the call graph for this function:

static gdouble cotan ( GtsVertex vo,
GtsVertex v1,
GtsVertex v2 
) [static]

Definition at line 43 of file curvature.c.

References GTS_POINT, gts_vector_init, gts_vector_scalar, and u().

Referenced by gts_vertex_mean_curvature_normal(), gts_vertex_principal_directions(), and region_area().

Here is the call graph for this function:

static void eigenvector ( gdouble  a,
gdouble  b,
gdouble  c,
GtsVector  e 
) [static]

Definition at line 305 of file curvature.c.

Referenced by gts_vertex_principal_directions().

gboolean gts_vertex_gaussian_curvature ( GtsVertex v,
GtsSurface s,
gdouble *  Kg 
)

gts_vertex_gaussian_curvature: : a GtsVertex. : a GtsSurface. : the Discrete Gaussian Curvature approximation at .

Computes the Discrete Gaussian Curvature approximation at .

This approximation is from the paper: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer, Mathieu Desbrun, Peter Schroder, Alan H. Barr VisMath '02, Berlin (Germany) http://www-grail.usc.edu/pubs.html

Returns: TRUE if the operator could be evaluated, FALSE if the evaluation failed for some reason ( is boundary or is the endpoint of a non-manifold edge.)

Definition at line 214 of file curvature.c.

References angle_from_cotan(), f, FALSE, GTS_SEGMENT, gts_vertex_faces(), gts_vertex_fan_oriented(), gts_vertex_is_boundary(), M_PI, region_area(), and TRUE.

Here is the call graph for this function:

gboolean gts_vertex_mean_curvature_normal ( GtsVertex v,
GtsSurface s,
GtsVector  Kh 
)

gts_vertex_mean_curvature_normal: : a GtsVertex. : a GtsSurface. : the Mean Curvature Normal at .

Computes the Discrete Mean Curvature Normal approximation at . The mean curvature at is half the magnitude of the vector .

Note: the normal computed is not unit length, and may point either into or out of the surface, depending on the curvature at . It is the responsibility of the caller of the function to use the mean curvature normal appropriately.

This approximation is from the paper: Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer, Mathieu Desbrun, Peter Schroder, Alan H. Barr VisMath '02, Berlin (Germany) http://www-grail.usc.edu/pubs.html

Returns: TRUE if the operator could be evaluated, FALSE if the evaluation failed for some reason ( is boundary or is the endpoint of a non-manifold edge.)

Definition at line 132 of file curvature.c.

References cotan(), f, FALSE, GTS_POINT, GTS_SEGMENT, gts_vertex_faces(), gts_vertex_fan_oriented(), gts_vertex_is_boundary(), region_area(), and TRUE.

Here is the call graph for this function:

void gts_vertex_principal_curvatures ( gdouble  Kh,
gdouble  Kg,
gdouble *  K1,
gdouble *  K2 
)

gts_vertex_principal_curvatures: : mean curvature. : Gaussian curvature. : first principal curvature. : second principal curvature.

Computes the principal curvatures at a point given the mean and Gaussian curvatures at that point.

The mean curvature can be computed as one-half the magnitude of the vector computed by gts_vertex_mean_curvature_normal().

The Gaussian curvature can be computed with gts_vertex_gaussian_curvature().

Definition at line 278 of file curvature.c.

Referenced by gts_vertex_principal_directions().

void gts_vertex_principal_directions ( GtsVertex v,
GtsSurface s,
GtsVector  Kh,
gdouble  Kg,
GtsVector  e1,
GtsVector  e2 
)

gts_vertex_principal_directions: : a GtsVertex. : a GtsSurface. : mean curvature normal (a GtsVector). : Gaussian curvature (a gdouble). : first principal curvature direction (direction of largest curvature). : second principal curvature direction.

Computes the principal curvature directions at a point given and , the mean curvature normal and Gaussian curvatures at that point, computed with gts_vertex_mean_curvature_normal() and gts_vertex_gaussian_curvature(), respectively.

Note that this computation is very approximate and tends to be unstable. Smoothing of the surface or the principal directions may be necessary to achieve reasonable results.

Definition at line 335 of file curvature.c.

References angle_obtuse(), c, cotan(), eigenvector(), gts_edge_face_number(), GTS_FACE, gts_face_has_parent_surface(), GTS_IS_EDGE, GTS_IS_FACE, GTS_POINT, GTS_SEGMENT, GTS_TRIANGLE, gts_triangle_area(), gts_triangle_normal(), gts_triangle_vertex_opposite(), gts_vector_cross, gts_vector_init, gts_vector_norm, gts_vector_normalize, gts_vector_scalar, gts_vertex_faces(), gts_vertex_principal_curvatures(), linsolve(), N, _GtsVertex::segments, triangle_obtuse(), _GtsEdge::triangles, x, and y.

Here is the call graph for this function:

static void linsolve ( gdouble  m11,
gdouble  m12,
gdouble  b1,
gdouble  m21,
gdouble  m22,
gdouble  b2,
gdouble *  x1,
gdouble *  x2 
) [static]

Definition at line 293 of file curvature.c.

Referenced by gts_vertex_principal_directions().

static gdouble region_area ( GtsVertex v,
GtsFace f 
) [static]
static gboolean triangle_obtuse ( GtsVertex v,
GtsFace f 
) [static]

Definition at line 34 of file curvature.c.

References angle_obtuse(), GTS_SEGMENT, GTS_TRIANGLE, and gts_triangle_edge_opposite().

Referenced by gts_vertex_principal_directions(), and region_area().

Here is the call graph for this function: