MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::SurfaceManipulationWidget Class Reference

widget for surface modifying @detail available 3 modes: add (move surface region in direction of normal) remove (move surface region in opposite direction to normal) relax (relax surface region) More...

#include <MRSurfaceManipulationWidget.h>

+ Inheritance diagram for MR::SurfaceManipulationWidget:

Classes

struct  Settings
 Mesh change settings. More...
 

Public Types

enum class  WorkMode {
  Add , Remove , Relax , Laplacian ,
  Patch
}
 widget work modes More...
 
enum class  DeviationCalculationMethod { PointToPoint , PointToPlane , ExactDistance }
 Method for calculating mesh changes. More...
 

Public Member Functions

MRVIEWER_API SurfaceManipulationWidget ()
 
virtual MRVIEWER_API ~SurfaceManipulationWidget ()
 
MRVIEWER_API void init (const std::shared_ptr< ObjectMesh > &objectMesh)
 initialize widget according ObjectMesh
 
MRVIEWER_API void reset ()
 reset widget state
 
MRVIEWER_API void setFixedRegion (const FaceBitSet &region)
 
MRVIEWER_API void setSettings (const Settings &settings)
 set widget settings (mesh change settings)
 
MRVIEWER_API const SettingsgetSettings ()
 get widget settings
 
MRVIEWER_API float getMinRadius ()
 mimum radius of editing area.
 
Palettepalette ()
 get palette used for visualization point shifts
 
MRVIEWER_API void updateTexture ()
 update texture used for colorize surface (use after change colorMap in palette)
 
MRVIEWER_API void updateUVs ()
 update texture uv coords used for colorize surface (use after change ranges in palette)
 
MRVIEWER_API void enableDeviationVisualization (bool enable)
 enable visualization of mesh deviations
 
MRVIEWER_API void setDeviationCalculationMethod (DeviationCalculationMethod method)
 set method for calculating mesh changes
 
MRVIEWER_API DeviationCalculationMethod deviationCalculationMethod () const
 get method for calculating mesh changes
 
MRVIEWER_API bool sameValidVerticesAsInOriginMesh () const
 checks for a one-to-one correspondence between the vertices of the original grid and the modified one
 
MRVIEWER_API Vector2f getMinMax ()
 get min / max point shifts for (usefull for setup palette)
 
MRVIEWER_API void setIgnoreOcclusion (bool ignore)
 allow the user to edit parts of object that are hidden in the current view by other objects
 
MRVIEWER_API bool ignoreOcclusion () const
 
void setEditOnlyCodirectedSurface (bool edit)
 restricts editable area to vertices whose normals look into the same half-space as normal under cursor
 
bool isEditOnlyCodirectedSurface () const
 get state of an editable region restriction
 
- Public Member Functions inherited from MR::MultiListener< MouseDownListener, MouseMoveListener, MouseUpListener, PostDrawListener >
virtual ~MultiListener ()=default
 
virtual void connect (Viewer *viewer, int group=0, boost::signals2::connect_position pos=boost::signals2::connect_position::at_back)
 
virtual void disconnect ()
 

Protected Member Functions

MRVIEWER_API bool onMouseDown_ (MouseButton button, int modifiers) override
 start modifying mesh surface
 
MRVIEWER_API bool onMouseUp_ (MouseButton button, int modifiers) override
 stop modifying mesh surface, generate history action
 
MRVIEWER_API bool onMouseMove_ (int mouse_x, int mouse_y) override
 update
 
MRVIEWER_API void postDraw_ () override
 need to visualize bad region (draw grey circle)
 
virtual MRVIEWER_API void appendMeshChangeHistory_ (std::shared_ptr< Mesh > newMesh, const FaceBitSet &newFaces)
 
void reallocData_ (size_t size)
 
void clearData_ ()
 
void initConnections_ ()
 
void resetConnections_ ()
 
void changeSurface_ ()
 
void updateUVmap_ (bool set, bool wholeMesh=false)
 
void updateRegion_ (const Vector2f &mousePos)
 
void abortEdit_ ()
 
void laplacianPickVert_ (const PointOnFace &pick)
 Laplacian.
 
void laplacianMoveVert_ (const Vector2f &mousePos)
 
void updateVizualizeSelection_ ()
 
void updateRegionUVs_ (const VertBitSet &region)
 
void updateValueChanges_ (const VertBitSet &region)
 
void updateValueChangesPointToPoint_ (const VertBitSet &region)
 
void updateValueChangesPointToPlane_ (const VertBitSet &region)
 
void updateValueChangesExactDistance_ (const VertBitSet &region)
 
void createLastStableObjMesh_ ()
 
void removeLastStableObjMesh_ ()
 
void compressChangePointsAction_ ()
 
void updateDistancesAndRegion_ (const Mesh &mesh, const VertBitSet &start, VertScalars &distances, VertBitSet &region, const VertBitSet *untouchable)
 

Protected Attributes

Settings settings_
 
std::shared_ptr< ObjectMeshobj_
 
VertBitSet unchangeableVerts_
 
float minRadius_ = 1.f
 
Vector2f mousePos_
 mouse position of last updateRegion_
 
VertBitSet activePickedVertices_
 vertices that are considered under mouse in curernt frame (could be many in case of fast mouse mouvement)
 
VertBitSet singleEditingRegion_
 current (under the cursor) region of tool application
 
VertBitSet visualizationRegion_
 vertices of triangles partially or fully highlighted with red
 
VertBitSet generalEditingRegion_
 united region of tool application since the last mouse down
 
VertScalars pointsShift_
 
VertScalars editingDistanceMap_
 
VertScalars visualizationDistanceMap_
 
VertBitSet changedRegion_
 
VertScalars valueChanges_
 
VertScalars lastStableValueChanges_
 
std::shared_ptr< MeshoriginalMesh_
 original input mesh
 
VertBitSet unknownSign_
 cached data to avoid reallocating memory
 
std::shared_ptr< ObjectMeshlastStableObjMesh_
 
bool firstInit_ = true
 
bool badRegion_ = false
 need to save settings in re-initial
 
bool mousePressed_ = false
 in selected region less than 3 points
 
std::chrono::time_point< std::chrono::high_resolution_clock > timePoint_
 
boost::signals2::scoped_connection meshChangedConnection_
 
bool ownMeshChangedSignal_ = false
 
bool connectionsInitialized_ = false
 
VertId touchVertId_
 Laplacian.
 
Vector3f touchVertIniPos_
 we fix this vertex in Laplacian and move it manually
 
Vector2i storedDown_
 initial position of fixed vertex
 
std::unique_ptr< Laplacianlaplacian_
 
std::shared_ptr< SmartChangeMeshPointsAction > historyAction_
 
bool appendHistoryAction_ = false
 true if historyAction_ is prepared but not yet appended to HistoryStore, which is done on first mouse move
 
std::shared_ptr< Palettepalette_
 
bool enableDeviationTexture_ = false
 
DeviationCalculationMethod deviationCalculationMethod_ = DeviationCalculationMethod::ExactDistance
 
bool sameValidVerticesAsInOriginMesh_ = true
 
bool ignoreOcclusion_ = false
 allow the user to edit parts of object that are hidden in the current view by other objects
 
bool editOnlyCodirectedSurface_ = true
 

Detailed Description

widget for surface modifying @detail available 3 modes: add (move surface region in direction of normal) remove (move surface region in opposite direction to normal) relax (relax surface region)

Member Enumeration Documentation

◆ DeviationCalculationMethod

Method for calculating mesh changes.

Enumerator
PointToPoint 

distance between the start and end points

PointToPlane 

distance between the initial plane (starting point and normal to it) and the end point

ExactDistance 

distance between the start and end meshes

◆ WorkMode

widget work modes

Enumerator
Add 
Remove 
Relax 
Laplacian 
Patch 

Constructor & Destructor Documentation

◆ SurfaceManipulationWidget()

MRVIEWER_API MR::SurfaceManipulationWidget::SurfaceManipulationWidget ( )

◆ ~SurfaceManipulationWidget()

virtual MRVIEWER_API MR::SurfaceManipulationWidget::~SurfaceManipulationWidget ( )
virtual

Member Function Documentation

◆ abortEdit_()

void MR::SurfaceManipulationWidget::abortEdit_ ( )
protected

◆ appendMeshChangeHistory_()

virtual MRVIEWER_API void MR::SurfaceManipulationWidget::appendMeshChangeHistory_ ( std::shared_ptr< Mesh > newMesh,
const FaceBitSet & newFaces )
protectedvirtual

called to change mesh with history record newFaces seems to be useful

◆ changeSurface_()

void MR::SurfaceManipulationWidget::changeSurface_ ( )
protected

◆ clearData_()

void MR::SurfaceManipulationWidget::clearData_ ( )
protected

◆ compressChangePointsAction_()

void MR::SurfaceManipulationWidget::compressChangePointsAction_ ( )
protected

this function is called after all modifications are finished; if we previously appended SmartChangeMeshPointsAction, then switch it from uncompressed to compressed format to occupy less amount of memory

◆ createLastStableObjMesh_()

void MR::SurfaceManipulationWidget::createLastStableObjMesh_ ( )
protected

◆ deviationCalculationMethod()

MRVIEWER_API DeviationCalculationMethod MR::SurfaceManipulationWidget::deviationCalculationMethod ( ) const
inline

get method for calculating mesh changes

◆ enableDeviationVisualization()

MRVIEWER_API void MR::SurfaceManipulationWidget::enableDeviationVisualization ( bool enable)

enable visualization of mesh deviations

◆ getMinMax()

MRVIEWER_API Vector2f MR::SurfaceManipulationWidget::getMinMax ( )

get min / max point shifts for (usefull for setup palette)

◆ getMinRadius()

MRVIEWER_API float MR::SurfaceManipulationWidget::getMinRadius ( )
inline

mimum radius of editing area.

◆ getSettings()

MRVIEWER_API const Settings & MR::SurfaceManipulationWidget::getSettings ( )
inline

get widget settings

◆ ignoreOcclusion()

MRVIEWER_API bool MR::SurfaceManipulationWidget::ignoreOcclusion ( ) const
inline

◆ init()

MRVIEWER_API void MR::SurfaceManipulationWidget::init ( const std::shared_ptr< ObjectMesh > & objectMesh)

initialize widget according ObjectMesh

◆ initConnections_()

void MR::SurfaceManipulationWidget::initConnections_ ( )
protected

◆ isEditOnlyCodirectedSurface()

bool MR::SurfaceManipulationWidget::isEditOnlyCodirectedSurface ( ) const
inline

get state of an editable region restriction

◆ laplacianMoveVert_()

void MR::SurfaceManipulationWidget::laplacianMoveVert_ ( const Vector2f & mousePos)
protected

◆ laplacianPickVert_()

void MR::SurfaceManipulationWidget::laplacianPickVert_ ( const PointOnFace & pick)
protected

◆ onMouseDown_()

MRVIEWER_API bool MR::SurfaceManipulationWidget::onMouseDown_ ( MouseButton button,
int modifiers )
overrideprotected

start modifying mesh surface

◆ onMouseMove_()

MRVIEWER_API bool MR::SurfaceManipulationWidget::onMouseMove_ ( int mouse_x,
int mouse_y )
overrideprotected

update

◆ onMouseUp_()

MRVIEWER_API bool MR::SurfaceManipulationWidget::onMouseUp_ ( MouseButton button,
int modifiers )
overrideprotected

stop modifying mesh surface, generate history action

◆ palette()

Palette & MR::SurfaceManipulationWidget::palette ( )
inline

get palette used for visualization point shifts

◆ postDraw_()

MRVIEWER_API void MR::SurfaceManipulationWidget::postDraw_ ( )
overrideprotected

need to visualize bad region (draw grey circle)

◆ reallocData_()

void MR::SurfaceManipulationWidget::reallocData_ ( size_t size)
protected

◆ removeLastStableObjMesh_()

void MR::SurfaceManipulationWidget::removeLastStableObjMesh_ ( )
protected

◆ reset()

MRVIEWER_API void MR::SurfaceManipulationWidget::reset ( )

reset widget state

◆ resetConnections_()

void MR::SurfaceManipulationWidget::resetConnections_ ( )
protected

◆ sameValidVerticesAsInOriginMesh()

MRVIEWER_API bool MR::SurfaceManipulationWidget::sameValidVerticesAsInOriginMesh ( ) const
inline

checks for a one-to-one correspondence between the vertices of the original grid and the modified one

◆ setDeviationCalculationMethod()

MRVIEWER_API void MR::SurfaceManipulationWidget::setDeviationCalculationMethod ( DeviationCalculationMethod method)

set method for calculating mesh changes

◆ setEditOnlyCodirectedSurface()

void MR::SurfaceManipulationWidget::setEditOnlyCodirectedSurface ( bool edit)
inline

restricts editable area to vertices whose normals look into the same half-space as normal under cursor

◆ setFixedRegion()

MRVIEWER_API void MR::SurfaceManipulationWidget::setFixedRegion ( const FaceBitSet & region)

lock the mesh region (vertices in this region cannot be moved, added or deleted)

Note
boundary edges can be splitted to improve quality of the patch

◆ setIgnoreOcclusion()

MRVIEWER_API void MR::SurfaceManipulationWidget::setIgnoreOcclusion ( bool ignore)
inline

allow the user to edit parts of object that are hidden in the current view by other objects

◆ setSettings()

MRVIEWER_API void MR::SurfaceManipulationWidget::setSettings ( const Settings & settings)

set widget settings (mesh change settings)

◆ updateDistancesAndRegion_()

void MR::SurfaceManipulationWidget::updateDistancesAndRegion_ ( const Mesh & mesh,
const VertBitSet & start,
VertScalars & distances,
VertBitSet & region,
const VertBitSet * untouchable )
protected

◆ updateRegion_()

void MR::SurfaceManipulationWidget::updateRegion_ ( const Vector2f & mousePos)
protected

◆ updateRegionUVs_()

void MR::SurfaceManipulationWidget::updateRegionUVs_ ( const VertBitSet & region)
protected

◆ updateTexture()

MRVIEWER_API void MR::SurfaceManipulationWidget::updateTexture ( )

update texture used for colorize surface (use after change colorMap in palette)

◆ updateUVmap_()

void MR::SurfaceManipulationWidget::updateUVmap_ ( bool set,
bool wholeMesh = false )
protected

◆ updateUVs()

MRVIEWER_API void MR::SurfaceManipulationWidget::updateUVs ( )

update texture uv coords used for colorize surface (use after change ranges in palette)

◆ updateValueChanges_()

void MR::SurfaceManipulationWidget::updateValueChanges_ ( const VertBitSet & region)
protected

◆ updateValueChangesExactDistance_()

void MR::SurfaceManipulationWidget::updateValueChangesExactDistance_ ( const VertBitSet & region)
protected

◆ updateValueChangesPointToPlane_()

void MR::SurfaceManipulationWidget::updateValueChangesPointToPlane_ ( const VertBitSet & region)
protected

◆ updateValueChangesPointToPoint_()

void MR::SurfaceManipulationWidget::updateValueChangesPointToPoint_ ( const VertBitSet & region)
protected

◆ updateVizualizeSelection_()

void MR::SurfaceManipulationWidget::updateVizualizeSelection_ ( )
protected

Member Data Documentation

◆ activePickedVertices_

VertBitSet MR::SurfaceManipulationWidget::activePickedVertices_
protected

vertices that are considered under mouse in curernt frame (could be many in case of fast mouse mouvement)

◆ appendHistoryAction_

bool MR::SurfaceManipulationWidget::appendHistoryAction_ = false
protected

true if historyAction_ is prepared but not yet appended to HistoryStore, which is done on first mouse move

◆ badRegion_

bool MR::SurfaceManipulationWidget::badRegion_ = false
protected

need to save settings in re-initial

◆ changedRegion_

VertBitSet MR::SurfaceManipulationWidget::changedRegion_
protected

◆ connectionsInitialized_

bool MR::SurfaceManipulationWidget::connectionsInitialized_ = false
protected

◆ deviationCalculationMethod_

DeviationCalculationMethod MR::SurfaceManipulationWidget::deviationCalculationMethod_ = DeviationCalculationMethod::ExactDistance
protected

◆ editingDistanceMap_

VertScalars MR::SurfaceManipulationWidget::editingDistanceMap_
protected

◆ editOnlyCodirectedSurface_

bool MR::SurfaceManipulationWidget::editOnlyCodirectedSurface_ = true
protected

◆ enableDeviationTexture_

bool MR::SurfaceManipulationWidget::enableDeviationTexture_ = false
protected

◆ firstInit_

bool MR::SurfaceManipulationWidget::firstInit_ = true
protected

◆ generalEditingRegion_

VertBitSet MR::SurfaceManipulationWidget::generalEditingRegion_
protected

united region of tool application since the last mouse down

◆ historyAction_

std::shared_ptr<SmartChangeMeshPointsAction> MR::SurfaceManipulationWidget::historyAction_
protected

◆ ignoreOcclusion_

bool MR::SurfaceManipulationWidget::ignoreOcclusion_ = false
protected

allow the user to edit parts of object that are hidden in the current view by other objects

◆ laplacian_

std::unique_ptr<Laplacian> MR::SurfaceManipulationWidget::laplacian_
protected

◆ lastStableObjMesh_

std::shared_ptr<ObjectMesh> MR::SurfaceManipulationWidget::lastStableObjMesh_
protected

◆ lastStableValueChanges_

VertScalars MR::SurfaceManipulationWidget::lastStableValueChanges_
protected

◆ meshChangedConnection_

boost::signals2::scoped_connection MR::SurfaceManipulationWidget::meshChangedConnection_
protected

◆ minRadius_

float MR::SurfaceManipulationWidget::minRadius_ = 1.f
protected

◆ mousePos_

Vector2f MR::SurfaceManipulationWidget::mousePos_
protected

mouse position of last updateRegion_

◆ mousePressed_

bool MR::SurfaceManipulationWidget::mousePressed_ = false
protected

in selected region less than 3 points

◆ obj_

std::shared_ptr<ObjectMesh> MR::SurfaceManipulationWidget::obj_
protected

◆ originalMesh_

std::shared_ptr<Mesh> MR::SurfaceManipulationWidget::originalMesh_
protected

original input mesh

◆ ownMeshChangedSignal_

bool MR::SurfaceManipulationWidget::ownMeshChangedSignal_ = false
protected

◆ palette_

std::shared_ptr<Palette> MR::SurfaceManipulationWidget::palette_
protected

◆ pointsShift_

VertScalars MR::SurfaceManipulationWidget::pointsShift_
protected

◆ sameValidVerticesAsInOriginMesh_

bool MR::SurfaceManipulationWidget::sameValidVerticesAsInOriginMesh_ = true
protected

◆ settings_

Settings MR::SurfaceManipulationWidget::settings_
protected

◆ singleEditingRegion_

VertBitSet MR::SurfaceManipulationWidget::singleEditingRegion_
protected

current (under the cursor) region of tool application

◆ storedDown_

Vector2i MR::SurfaceManipulationWidget::storedDown_
protected

initial position of fixed vertex

◆ timePoint_

std::chrono::time_point<std::chrono::high_resolution_clock> MR::SurfaceManipulationWidget::timePoint_
protected

◆ touchVertId_

VertId MR::SurfaceManipulationWidget::touchVertId_
protected

◆ touchVertIniPos_

Vector3f MR::SurfaceManipulationWidget::touchVertIniPos_
protected

we fix this vertex in Laplacian and move it manually

◆ unchangeableVerts_

VertBitSet MR::SurfaceManipulationWidget::unchangeableVerts_
protected

◆ unknownSign_

VertBitSet MR::SurfaceManipulationWidget::unknownSign_
protected

cached data to avoid reallocating memory

◆ valueChanges_

VertScalars MR::SurfaceManipulationWidget::valueChanges_
protected

◆ visualizationDistanceMap_

VertScalars MR::SurfaceManipulationWidget::visualizationDistanceMap_
protected

◆ visualizationRegion_

VertBitSet MR::SurfaceManipulationWidget::visualizationRegion_
protected

vertices of triangles partially or fully highlighted with red


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