cgv
Loading...
Searching...
No Matches
cgv::render::gl::gl_implicit_surface_drawable_base Class Reference

drawable that visualizes implicit surfaces by contouring them with marching cubes or dual contouring. More...

#include <gl_implicit_surface_drawable_base.h>

Inheritance diagram for cgv::render::gl::gl_implicit_surface_drawable_base:
cgv::render::drawable cgv::media::mesh::streaming_mesh_callback_handler cgv::base::traverse_policy

Public Types

typedef cgv::math::v3_func< double, double > F
 type of the function describing the implicit surface
 

Public Member Functions

 gl_implicit_surface_drawable_base ()
 standard constructor does not initialize the function pointer such that nothing is drawn
 
void set_function (F *_func_ptr)
 
Fget_function () const
 
void set_resolution (unsigned int _res)
 
unsigned int get_resolution () const
 
void enable_wireframe (bool do_enable=true)
 
bool is_wireframe_enabled () const
 
void enable_sampling_grid (bool do_enable=true)
 
bool is_sampling_grid_enabled () const
 
void enable_sampling_locations (bool do_enable=true)
 
bool is_sampling_locations_enabled () const
 
void enable_box (bool do_enable=true)
 
bool is_box_enabled () const
 
void enable_normals (bool do_enable=true)
 
bool are_normals_enabled () const
 
void set_epsilon (double _epsilon)
 
double get_epsilon () const
 
void set_grid_epsilon (double _grid_epsilon)
 
double get_grid_epsilon () const
 
void set_box (const dbox3 &_box)
 
const dbox3get_box () const
 
unsigned int get_nr_triangles_of_last_extraction () const
 
unsigned int get_nr_vertices_of_last_extraction () const
 
void post_rebuild ()
 use this as callback to ask for a re-tesselation of the implicit surface
 
bool init (context &ctx)
 this method is called after creation or recreation of the context, return whether all necessary functionality is supported
 
void clear (context &ctx)
 clear all objects living in the context like textures or display lists
 
void draw (context &ctx)
 overload to draw the content of this drawable
 
void finish_frame (context &ctx)
 this method is called in one pass over all drawables after drawing
 
- Public Member Functions inherited from cgv::render::drawable
 drawable ()
 default construction
 
void hide ()
 hide the drawable
 
void show ()
 show the drawable
 
bool is_visible () const
 check whether the drawable is visible
 
contextget_context () const
 access the current context. The context will be available latestly in the init method but not in the contructor.
 
void set_context (context *_ctx)
 set the current focus context, this should only be called by the context itself
 
viewfind_view_as_node (size_t view_idx=0) const
 convenience function to find the view control in the current hierarchy
 
bool get_world_location (int x, int y, const view &V, dvec3 &world_location, double *window_z_ptr=0) const
 use given view together with depth buffer of context in order to compute the world location of the point at mouse pointer location (x,y)
 
void post_redraw ()
 posts a redraw event to the current context if one is available
 
void force_redraw ()
 forces a redraw right now. This cannot be called from init, init_frame, draw, finish_draw, finish_frame and clear
 
virtual void resize (unsigned int w, unsigned int h)
 callback to announce resizing of the output window
 
virtual void init_frame (context &)
 this method is called in one pass over all drawables before the draw method
 
virtual void finish_draw (context &)
 this method is called when the current drawable is left in a tree traversal that calls the draw method
 
virtual void after_finish (context &)
 this method is called in one pass over all drawables after finish frame
 
- Public Member Functions inherited from cgv::base::traverse_policy
 traverse_policy (int _policy=TP_ALL+TP_STOP_ON_SUCCESS, bool _active=true, int _focus=-1)
 construct default traverse policy that visits everything
 
int get_policy () const
 return the policy without the stop on success flag
 
bool stop_on_success () const
 return whether to stop on success
 
bool stop_on_failure () const
 return whether to stop on failure
 
void set_policy (int _policy)
 set a new policy, always add stop on success flag if needed
 
int get_focused_child () const
 return the focused child or -1 if none is focused
 
void set_focused_child (int _focused_child)
 set the focused child
 
bool get_active () const
 return whether the current node is active
 
void set_active (bool _active)
 set the active flag of the current node
 

Protected Member Functions

void add_normal (const dvec3 &p, const dvec3 &n, std::vector< vec3 > &nml_gradient_geometry) const
 
void new_vertex (unsigned int vi)
 allows to augment a newly computed vertex by additional data
 
void new_polygon (const std::vector< unsigned int > &vertex_indices)
 announces a new quad
 
void before_drop_vertex (unsigned int vertex_index)
 drop the currently first vertex that has the given global vertex index
 
bool save (const std::string &file_name)
 function used to save to obj file
 
virtual void surface_extraction ()
 call the selected surface extraction method
 
dvec3 compute_face_normal (const std::vector< unsigned int > &vis, dvec3 *c=0) const
 compute the normal of a face
 
virtual void extract_mesh ()
 helper function to extract mesh from implicit surface
 
void draw_implicit_surface (context &ctx)
 helper function to tesselate the implicit surface
 
dvec3 compute_corner_normal (const dvec3 &pk, const dvec3 &pi, const dvec3 &pj, const dvec3 &ni)
 

Protected Attributes

unsigned int res
 
dbox3 box
 
Ffunc_ptr
 
ContouringType contouring_type
 
double normal_threshold
 
double consistency_threshold
 
unsigned int max_nr_iters
 
NormalComputationType normal_computation_type
 
unsigned int ix
 
unsigned int iy
 
unsigned int iz
 
bool show_vertices
 
bool show_wireframe
 
bool show_surface
 
bool show_sampling_locations
 
bool show_sampling_grid
 
float sampling_grid_alpha
 
bool show_box
 
bool show_mini_box
 
bool show_gradient_normals
 
bool show_mesh_normals
 
box_render_style brs
 
sphere_render_style srs
 
cone_render_style crs
 
arrow_render_style ars
 
double epsilon
 
double grid_epsilon
 
int nr_faces
 
int nr_vertices
 
cgv::media::illum::surface_material material
 
bool triangulate
 
std::ostream * obj_out
 of this output stream is defined, use it to write currently extracted surface to it
 
unsigned normal_index
 normal index for face normals
 
- Protected Attributes inherited from cgv::base::traverse_policy
TraversePolicy policy
 
bool active
 
int focus
 

Detailed Description

drawable that visualizes implicit surfaces by contouring them with marching cubes or dual contouring.

>

Definition at line 28 of file gl_implicit_surface_drawable_base.h.

Member Typedef Documentation

◆ F

type of the function describing the implicit surface

Definition at line 34 of file gl_implicit_surface_drawable_base.h.

Constructor & Destructor Documentation

◆ gl_implicit_surface_drawable_base()

cgv::render::gl::gl_implicit_surface_drawable_base::gl_implicit_surface_drawable_base ( )

Member Function Documentation

◆ add_normal()

void cgv::render::gl::gl_implicit_surface_drawable_base::add_normal ( const dvec3 p,
const dvec3 n,
std::vector< vec3 > &  nml_gradient_geometry 
) const
protected

Definition at line 216 of file gl_implicit_surface_drawable_base.cxx.

◆ are_normals_enabled()

bool cgv::render::gl::gl_implicit_surface_drawable_base::are_normals_enabled ( ) const

Definition at line 158 of file gl_implicit_surface_drawable_base.cxx.

◆ before_drop_vertex()

void cgv::render::gl::gl_implicit_surface_drawable_base::before_drop_vertex ( unsigned int  vertex_index)
protectedvirtual

drop the currently first vertex that has the given global vertex index

Implements cgv::media::mesh::streaming_mesh_callback_handler.

Definition at line 345 of file gl_implicit_surface_drawable_base.cxx.

◆ clear()

void cgv::render::gl::gl_implicit_surface_drawable_base::clear ( context )
virtual

clear all objects living in the context like textures or display lists

Reimplemented from cgv::render::drawable.

Definition at line 434 of file gl_implicit_surface_drawable_base.cxx.

References cgv::render::ref_arrow_renderer(), cgv::render::ref_box_renderer(), cgv::render::ref_cone_renderer(), and cgv::render::ref_sphere_renderer().

◆ compute_corner_normal()

dvec3 cgv::render::gl::gl_implicit_surface_drawable_base::compute_corner_normal ( const dvec3 pk,
const dvec3 pi,
const dvec3 pj,
const dvec3 ni 
)
protected

Definition at line 349 of file gl_implicit_surface_drawable_base.cxx.

◆ compute_face_normal()

dvec3 cgv::render::gl::gl_implicit_surface_drawable_base::compute_face_normal ( const std::vector< unsigned int > &  vis,
dvec3 c = 0 
) const
protected

◆ draw()

◆ draw_implicit_surface()

◆ enable_box()

void cgv::render::gl::gl_implicit_surface_drawable_base::enable_box ( bool  do_enable = true)

Definition at line 136 of file gl_implicit_surface_drawable_base.cxx.

◆ enable_normals()

void cgv::render::gl::gl_implicit_surface_drawable_base::enable_normals ( bool  do_enable = true)

Definition at line 149 of file gl_implicit_surface_drawable_base.cxx.

◆ enable_sampling_grid()

void cgv::render::gl::gl_implicit_surface_drawable_base::enable_sampling_grid ( bool  do_enable = true)

Definition at line 110 of file gl_implicit_surface_drawable_base.cxx.

◆ enable_sampling_locations()

void cgv::render::gl::gl_implicit_surface_drawable_base::enable_sampling_locations ( bool  do_enable = true)

Definition at line 123 of file gl_implicit_surface_drawable_base.cxx.

◆ enable_wireframe()

void cgv::render::gl::gl_implicit_surface_drawable_base::enable_wireframe ( bool  do_enable = true)

Definition at line 102 of file gl_implicit_surface_drawable_base.cxx.

◆ extract_mesh()

void cgv::render::gl::gl_implicit_surface_drawable_base::extract_mesh ( )
protectedvirtual

◆ finish_frame()

void cgv::render::gl::gl_implicit_surface_drawable_base::finish_frame ( context )
virtual

◆ get_box()

const dbox3 & cgv::render::gl::gl_implicit_surface_drawable_base::get_box ( ) const

Definition at line 200 of file gl_implicit_surface_drawable_base.cxx.

◆ get_epsilon()

double cgv::render::gl::gl_implicit_surface_drawable_base::get_epsilon ( ) const

Definition at line 177 of file gl_implicit_surface_drawable_base.cxx.

◆ get_function()

gl_implicit_surface_drawable_base::F * cgv::render::gl::gl_implicit_surface_drawable_base::get_function ( ) const

Definition at line 86 of file gl_implicit_surface_drawable_base.cxx.

◆ get_grid_epsilon()

double cgv::render::gl::gl_implicit_surface_drawable_base::get_grid_epsilon ( ) const

Definition at line 188 of file gl_implicit_surface_drawable_base.cxx.

◆ get_nr_triangles_of_last_extraction()

unsigned int cgv::render::gl::gl_implicit_surface_drawable_base::get_nr_triangles_of_last_extraction ( ) const

Definition at line 205 of file gl_implicit_surface_drawable_base.cxx.

◆ get_nr_vertices_of_last_extraction()

unsigned int cgv::render::gl::gl_implicit_surface_drawable_base::get_nr_vertices_of_last_extraction ( ) const

Definition at line 210 of file gl_implicit_surface_drawable_base.cxx.

◆ get_resolution()

unsigned int cgv::render::gl::gl_implicit_surface_drawable_base::get_resolution ( ) const

Definition at line 97 of file gl_implicit_surface_drawable_base.cxx.

◆ init()

bool cgv::render::gl::gl_implicit_surface_drawable_base::init ( context )
virtual

this method is called after creation or recreation of the context, return whether all necessary functionality is supported

Reimplemented from cgv::render::drawable.

Definition at line 425 of file gl_implicit_surface_drawable_base.cxx.

References cgv::render::ref_arrow_renderer(), cgv::render::ref_box_renderer(), cgv::render::ref_cone_renderer(), and cgv::render::ref_sphere_renderer().

◆ is_box_enabled()

bool cgv::render::gl::gl_implicit_surface_drawable_base::is_box_enabled ( ) const

Definition at line 144 of file gl_implicit_surface_drawable_base.cxx.

◆ is_sampling_grid_enabled()

bool cgv::render::gl::gl_implicit_surface_drawable_base::is_sampling_grid_enabled ( ) const

Definition at line 118 of file gl_implicit_surface_drawable_base.cxx.

◆ is_sampling_locations_enabled()

bool cgv::render::gl::gl_implicit_surface_drawable_base::is_sampling_locations_enabled ( ) const

Definition at line 131 of file gl_implicit_surface_drawable_base.cxx.

◆ is_wireframe_enabled()

bool cgv::render::gl::gl_implicit_surface_drawable_base::is_wireframe_enabled ( ) const

Definition at line 165 of file gl_implicit_surface_drawable_base.cxx.

◆ new_polygon()

◆ new_vertex()

◆ post_rebuild()

void cgv::render::gl::gl_implicit_surface_drawable_base::post_rebuild ( )

use this as callback to ask for a re-tesselation of the implicit surface

Definition at line 379 of file gl_implicit_surface_drawable_base.cxx.

References cgv::render::drawable::post_redraw().

◆ save()

bool cgv::render::gl::gl_implicit_surface_drawable_base::save ( const std::string &  file_name)
protected

function used to save to obj file

callback used to save to obj file

Definition at line 67 of file gl_implicit_surface_drawable_base.cxx.

References normal_index, obj_out, and surface_extraction().

◆ set_box()

void cgv::render::gl::gl_implicit_surface_drawable_base::set_box ( const dbox3 _box)

Definition at line 194 of file gl_implicit_surface_drawable_base.cxx.

◆ set_epsilon()

void cgv::render::gl::gl_implicit_surface_drawable_base::set_epsilon ( double  _epsilon)

Definition at line 171 of file gl_implicit_surface_drawable_base.cxx.

◆ set_function()

void cgv::render::gl::gl_implicit_surface_drawable_base::set_function ( F _func_ptr)

Definition at line 79 of file gl_implicit_surface_drawable_base.cxx.

◆ set_grid_epsilon()

void cgv::render::gl::gl_implicit_surface_drawable_base::set_grid_epsilon ( double  _grid_epsilon)

Definition at line 182 of file gl_implicit_surface_drawable_base.cxx.

◆ set_resolution()

void cgv::render::gl::gl_implicit_surface_drawable_base::set_resolution ( unsigned int  _res)

Definition at line 91 of file gl_implicit_surface_drawable_base.cxx.

◆ surface_extraction()

void cgv::render::gl::gl_implicit_surface_drawable_base::surface_extraction ( )
protectedvirtual

Member Data Documentation

◆ ars

arrow_render_style cgv::render::gl::gl_implicit_surface_drawable_base::ars
protected

Definition at line 87 of file gl_implicit_surface_drawable_base.h.

◆ box

dbox3 cgv::render::gl::gl_implicit_surface_drawable_base::box
protected

Definition at line 48 of file gl_implicit_surface_drawable_base.h.

◆ brs

box_render_style cgv::render::gl::gl_implicit_surface_drawable_base::brs
protected

Definition at line 84 of file gl_implicit_surface_drawable_base.h.

◆ consistency_threshold

double cgv::render::gl::gl_implicit_surface_drawable_base::consistency_threshold
protected

Definition at line 55 of file gl_implicit_surface_drawable_base.h.

◆ contouring_type

ContouringType cgv::render::gl::gl_implicit_surface_drawable_base::contouring_type
protected

Definition at line 51 of file gl_implicit_surface_drawable_base.h.

◆ crs

cone_render_style cgv::render::gl::gl_implicit_surface_drawable_base::crs
protected

Definition at line 86 of file gl_implicit_surface_drawable_base.h.

◆ epsilon

double cgv::render::gl::gl_implicit_surface_drawable_base::epsilon
protected

Definition at line 90 of file gl_implicit_surface_drawable_base.h.

◆ func_ptr

F* cgv::render::gl::gl_implicit_surface_drawable_base::func_ptr
protected

Definition at line 49 of file gl_implicit_surface_drawable_base.h.

◆ grid_epsilon

double cgv::render::gl::gl_implicit_surface_drawable_base::grid_epsilon
protected

Definition at line 92 of file gl_implicit_surface_drawable_base.h.

◆ ix

unsigned int cgv::render::gl::gl_implicit_surface_drawable_base::ix
protected

Definition at line 61 of file gl_implicit_surface_drawable_base.h.

◆ iy

unsigned int cgv::render::gl::gl_implicit_surface_drawable_base::iy
protected

Definition at line 63 of file gl_implicit_surface_drawable_base.h.

◆ iz

unsigned int cgv::render::gl::gl_implicit_surface_drawable_base::iz
protected

Definition at line 65 of file gl_implicit_surface_drawable_base.h.

◆ material

cgv::media::illum::surface_material cgv::render::gl::gl_implicit_surface_drawable_base::material
protected

Definition at line 99 of file gl_implicit_surface_drawable_base.h.

◆ max_nr_iters

unsigned int cgv::render::gl::gl_implicit_surface_drawable_base::max_nr_iters
protected

Definition at line 57 of file gl_implicit_surface_drawable_base.h.

◆ normal_computation_type

NormalComputationType cgv::render::gl::gl_implicit_surface_drawable_base::normal_computation_type
protected

Definition at line 59 of file gl_implicit_surface_drawable_base.h.

◆ normal_index

unsigned cgv::render::gl::gl_implicit_surface_drawable_base::normal_index
protected

normal index for face normals

Definition at line 114 of file gl_implicit_surface_drawable_base.h.

Referenced by new_polygon(), and save().

◆ normal_threshold

double cgv::render::gl::gl_implicit_surface_drawable_base::normal_threshold
protected

Definition at line 53 of file gl_implicit_surface_drawable_base.h.

◆ nr_faces

int cgv::render::gl::gl_implicit_surface_drawable_base::nr_faces
protected

Definition at line 95 of file gl_implicit_surface_drawable_base.h.

◆ nr_vertices

int cgv::render::gl::gl_implicit_surface_drawable_base::nr_vertices
protected

Definition at line 97 of file gl_implicit_surface_drawable_base.h.

◆ obj_out

std::ostream* cgv::render::gl::gl_implicit_surface_drawable_base::obj_out
protected

of this output stream is defined, use it to write currently extracted surface to it

Definition at line 112 of file gl_implicit_surface_drawable_base.h.

Referenced by gl_implicit_surface_drawable_base(), new_polygon(), new_vertex(), and save().

◆ res

unsigned int cgv::render::gl::gl_implicit_surface_drawable_base::res
protected

Definition at line 47 of file gl_implicit_surface_drawable_base.h.

◆ sampling_grid_alpha

float cgv::render::gl::gl_implicit_surface_drawable_base::sampling_grid_alpha
protected

Definition at line 74 of file gl_implicit_surface_drawable_base.h.

◆ show_box

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_box
protected

Definition at line 76 of file gl_implicit_surface_drawable_base.h.

◆ show_gradient_normals

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_gradient_normals
protected

Definition at line 80 of file gl_implicit_surface_drawable_base.h.

◆ show_mesh_normals

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_mesh_normals
protected

Definition at line 82 of file gl_implicit_surface_drawable_base.h.

◆ show_mini_box

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_mini_box
protected

Definition at line 78 of file gl_implicit_surface_drawable_base.h.

◆ show_sampling_grid

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_sampling_grid
protected

Definition at line 73 of file gl_implicit_surface_drawable_base.h.

◆ show_sampling_locations

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_sampling_locations
protected

Definition at line 71 of file gl_implicit_surface_drawable_base.h.

◆ show_surface

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_surface
protected

Definition at line 69 of file gl_implicit_surface_drawable_base.h.

◆ show_vertices

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_vertices
protected

Definition at line 67 of file gl_implicit_surface_drawable_base.h.

◆ show_wireframe

bool cgv::render::gl::gl_implicit_surface_drawable_base::show_wireframe
protected

Definition at line 68 of file gl_implicit_surface_drawable_base.h.

◆ srs

sphere_render_style cgv::render::gl::gl_implicit_surface_drawable_base::srs
protected

Definition at line 85 of file gl_implicit_surface_drawable_base.h.

◆ triangulate

bool cgv::render::gl::gl_implicit_surface_drawable_base::triangulate
protected

Definition at line 110 of file gl_implicit_surface_drawable_base.h.


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