Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::FrameField Class Reference

Represents a 3D frame field, i.e. a function that associates a 3d orthonormal basis to each point in 3D space. More...

#include <geogram/mesh/mesh_frame_field.h>

Public Member Functions

 FrameField ()
 Constructs a new uninitialized FrameField.
 
void set_use_spatial_search (bool x)
 Specifies whether a spatial search structure should be created. More...
 
bool load (const Mesh &M, bool volumetric, const std::string &filename)
 Loads a frame field from a file. More...
 
void create_from_surface_mesh (const Mesh &M, bool volumetric, double sharp_angle_threshold=45.0)
 Creates a frame field that matches a given mesh. More...
 
index_t get_nearest_frame_index (const double *p) const
 Gets the index of the frame nearest to a given point. More...
 
void get_nearest_frame (const double *p, double *f) const
 Gets the frame nearest to a given point. More...
 
const vector< double > & frames () const
 Gets the vector that contains all the frames coordinates. More...
 

Static Public Member Functions

static void scale_frame_vector (double *frame, const vec3 &N, double s)
 
static void fix_frame (double *frame, const vec3 &N)
 Fixes a frame in such a way that it is orthogonal to a given vector. More...
 

Detailed Description

Represents a 3D frame field, i.e. a function that associates a 3d orthonormal basis to each point in 3D space.

Definition at line 59 of file mesh_frame_field.h.

Member Function Documentation

◆ create_from_surface_mesh()

void GEO::FrameField::create_from_surface_mesh ( const Mesh M,
bool  volumetric,
double  sharp_angle_threshold = 45.0 
)

Creates a frame field that matches a given mesh.

The frames are interpolated from the sharp features of the mesh.

Parameters
[in]Mthe input mesh
[in]volumetricif true, the frame field is extrapolated to the tetrahedra of the mesh (using nearest neighbors for now)
[in]sharp_angle_thresholdangles smaller than this threshold (in degrees) are considered to be sharp features

◆ fix_frame()

static void GEO::FrameField::fix_frame ( double *  frame,
const vec3 N 
)
static

Fixes a frame in such a way that it is orthogonal to a given vector.

Makes one of the frame vectors aligned with N and the two other ones orthogonal to N.

Parameters
[in,out]framethe frame to fix
[in]Nthe normal vector to be preserved

◆ frames()

const vector<double>& GEO::FrameField::frames ( ) const
inline

Gets the vector that contains all the frames coordinates.

Returns
a const reference to the vector of all the frame coordinates.

Definition at line 150 of file mesh_frame_field.h.

◆ get_nearest_frame()

void GEO::FrameField::get_nearest_frame ( const double *  p,
double *  f 
) const
inline

Gets the frame nearest to a given point.

Cannot be used if set_use_spatial_search(false) was called.

Parameters
[in]pthe 3d coordinates of the point
[out]fthe 9 coordinates of the three vectors that compose the fram

Definition at line 136 of file mesh_frame_field.h.

◆ get_nearest_frame_index()

index_t GEO::FrameField::get_nearest_frame_index ( const double *  p) const
inline

Gets the index of the frame nearest to a given point.

Cannot be used if set_use_spatial_search(false) was called.

Parameters
[in]pthe 3d coordinates of the point
Returns
the index of the frame nearest to p

Definition at line 123 of file mesh_frame_field.h.

◆ load()

bool GEO::FrameField::load ( const Mesh M,
bool  volumetric,
const std::string &  filename 
)

Loads a frame field from a file.

Parameters
[in]Ma tetrahedral mesh
[in]filenamename of the file that contains the frame vectors
[in]volumetricif true, the frames are attached to the tets of M, else they are attached to the facets

The file is supposed to be ASCII, with one vector per line. Alternatively, the frames can be attached to specified points. In this case, volumetric is ignored, and the file has 12 scalars per line, that correspond to the coordinates of a point and the three vectors attached to the point.

Return values
trueon success
falseotherwise

◆ set_use_spatial_search()

void GEO::FrameField::set_use_spatial_search ( bool  x)
inline

Specifies whether a spatial search structure should be created.

If a spatial search structure is created, then the field can be queried at any 3D location using get_nearest_frame() / get_nearest_frame_index(), this is the default mode. Otherwise, get_nearest_frame() and get_nearest_frame_index() cannot be used.

Parameters
[in]xtrue if spatial search should be used, false otherwise.

Definition at line 78 of file mesh_frame_field.h.


The documentation for this class was generated from the following file: