Fade2.5D Documentation pages v1.97
Delaunay Features
GEOM_FADE25D::CutAndFill Class Reference

CutAndFill computes the volume(s) between two overlapping surfaces. More...

#include <CutAndFill.h>

Public Member Functions

 CutAndFill (Zone2 *pZoneBefore, Zone2 *pZoneAfter, double ignoreThreshold=1e-3)
 Constructor. More...
 
CAF_ComponentgetComponent (size_t ith) const
 Get component ith. More...
 
bool getDiffZone (Zone2 *&pDiffZone, std::map< Point2 *, std::pair< double, double > > &mVtx2BeforeAfter)
 Get the difference zone. More...
 
size_t getNumberOfComponents () const
 Get the number of components. More...
 
bool go ()
 Start the computation. More...
 
void show (Visualizer2 *pVis) const
 Draw a postscript visualization. More...
 
void subscribe (MsgType msgType, MsgBase *pMsg)
 Register a progress bar object. More...
 
void unsubscribe (MsgType msgType, MsgBase *pMsg)
 Unregister a progress bar object. More...
 

Detailed Description

Overlapping input surfaces for Cut-And-Fill: RED=before, GREEN=after. The surfaces do not need to match exactly, the overlapping area is used

Given two overlapping surfaces with different elevations, CutAndFill partitions the surfaces into connected components and computes the volume that must be removed or added to turn one surface into the other.

See also
http://www.geom.at/cut-and-fill/

Constructor & Destructor Documentation

◆ CutAndFill()

GEOM_FADE25D::CutAndFill::CutAndFill ( Zone2 pZoneBefore,
Zone2 pZoneAfter,
double  ignoreThreshold = 1e-3 
)
Parameters
pZoneBeforerepresents the surface before the earthworks
pZoneAfteris the surface afterwards
ignoreThreshold(default: 1e-3) can be used to ignore insignificant height differences

Member Function Documentation

◆ getComponent()

CAF_Component* GEOM_FADE25D::CutAndFill::getComponent ( size_t  ith) const
Returns
the ith CAF_Component.

◆ getDiffZone()

bool GEOM_FADE25D::CutAndFill::getDiffZone ( Zone2 *&  pDiffZone,
std::map< Point2 *, std::pair< double, double > > &  mVtx2BeforeAfter 
)

This method gives access to the internal data structures, namely to a Zone2 object whose vertices have z-values that correspond to the height differences between the two input meshes (SurfaceBefore minus SurfaceAfter). And a map is returned that contains for each vertex the height in the first and in the second input mesh.

Returns
true in case of success, false otherwise.
Note
This method may set pDiffZone=NULL and return false when the two input surfaces do not share a common area. In this case the previous call to CutAndFill::go() has already returned false.

◆ getNumberOfComponents()

size_t GEOM_FADE25D::CutAndFill::getNumberOfComponents ( ) const
Returns
the number of components.

A CAF_Component object represents a connected part of the surface such that

  • the first surface is below the second one (Type CT_FILL)
  • the first surface is above the second one (Type CT_CUT)
  • the first surface corresponds to the second one (Type CT_NULL)

◆ go()

bool GEOM_FADE25D::CutAndFill::go ( )
Returns
true in case of success, false otherwise.
Note
When an input zone is empty or when the two input zones do not overlap then there is no common area on which the algorithm could operate. In this case the present method returns false.

◆ show()

void GEOM_FADE25D::CutAndFill::show ( Visualizer2 pVis) const

For a quick overview a postscript visualization can be created.

Cut&Fill-Result: YELLOW area: CUT, CYAN area: FILL

◆ subscribe()

void GEOM_FADE25D::CutAndFill::subscribe ( MsgType  msgType,
MsgBase pMsg 
)

A user defined message receiver object (for example your own progress-bar class) can be registered to get progress updates. This step is optional.

Parameters
msgTypeis the message type. For progress information the type is always MSG_PROGRESS
pMsgis a user defined progress bar which derives from Fade's MsgBase.

◆ unsubscribe()

void GEOM_FADE25D::CutAndFill::unsubscribe ( MsgType  msgType,
MsgBase pMsg 
)
Parameters
msgTypeis the message type. For progress information the type is always MSG_PROGRESS
pMsgis a user defined class which derives from Fade's MsgBase

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