1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
* @class vtkDistancePolyDataFilter
*
*
* Computes the signed distance from one vtkPolyData to another. The
* signed distance to the second input is computed at every point in
* the first input using vtkImplicitPolyDataDistance. Optionally, the signed
* distance to the first input at every point in the second input can
* be computed. This may be enabled by calling
* ComputeSecondDistanceOn().
*
* If the signed distance is not desired, the unsigned distance can be
* computed by calling SignedDistanceOff(). The signed distance field
* may be negated by calling NegateDistanceOn();
*
* Directions can be computed in conjunction with distances by calling
* ComputeDirectionsOn().
*
* This code was contributed in the VTK Journal paper:
* "Boolean Operations on Surfaces in VTK Without External Libraries"
* by Cory Quammen, Chris Weigle C., Russ Taylor
* http://hdl.handle.net/10380/3262
* http://www.midasjournal.org/browse/publication/797
*/
#ifndef vtkDistancePolyDataFilter_h
#define vtkDistancePolyDataFilter_h
#include "vtkFiltersGeneralModule.h" // For export macro
#include "vtkPolyDataAlgorithm.h"
VTK_ABI_NAMESPACE_BEGIN
class VTKFILTERSGENERAL_EXPORT vtkDistancePolyDataFilter : public vtkPolyDataAlgorithm
{
public:
static vtkDistancePolyDataFilter* New();
vtkTypeMacro(vtkDistancePolyDataFilter, vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
///@{
/**
* Enable/disable computation of the signed distance between
* the first poly data and the second poly data. Defaults to on.
*/
vtkSetMacro(SignedDistance, vtkTypeBool);
vtkGetMacro(SignedDistance, vtkTypeBool);
vtkBooleanMacro(SignedDistance, vtkTypeBool);
///@}
///@{
/**
* Enable/disable negation of the distance values. Defaults to
* off. Has no effect if SignedDistance is off.
*/
vtkSetMacro(NegateDistance, vtkTypeBool);
vtkGetMacro(NegateDistance, vtkTypeBool);
vtkBooleanMacro(NegateDistance, vtkTypeBool);
///@}
///@{
/**
* Enable/disable computation of a second output poly data with the
* distance from the first poly data at each point. Defaults to on.
*/
vtkSetMacro(ComputeSecondDistance, vtkTypeBool);
vtkGetMacro(ComputeSecondDistance, vtkTypeBool);
vtkBooleanMacro(ComputeSecondDistance, vtkTypeBool);
///@}
/**
* Get the second output, which is a copy of the second input with an
* additional distance scalar field.
* Note this will return a valid data object only after this->Update() is
* called.
*/
vtkPolyData* GetSecondDistanceOutput();
///@{
/**
* Enable/disable computation of cell-center distance to the
* second poly data. Defaults to on for backwards compatibility.
*
* If the first poly data consists of just vertex cells,
* computing point and cell-center distances is redundant.
*/
vtkSetMacro(ComputeCellCenterDistance, vtkTypeBool);
vtkGetMacro(ComputeCellCenterDistance, vtkTypeBool);
vtkBooleanMacro(ComputeCellCenterDistance, vtkTypeBool);
///@}
///@{
/**
* Enable/disable computation of unit directions for the distances.
* Defaults to off for backwards compatibility.
*/
vtkSetMacro(ComputeDirection, vtkTypeBool);
vtkGetMacro(ComputeDirection, vtkTypeBool);
vtkBooleanMacro(ComputeDirection, vtkTypeBool);
///@}
protected:
vtkDistancePolyDataFilter();
~vtkDistancePolyDataFilter() override;
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
void GetPolyDataDistance(vtkPolyData*, vtkPolyData*);
private:
vtkDistancePolyDataFilter(const vtkDistancePolyDataFilter&) = delete;
void operator=(const vtkDistancePolyDataFilter&) = delete;
vtkTypeBool SignedDistance;
vtkTypeBool NegateDistance;
vtkTypeBool ComputeSecondDistance;
vtkTypeBool ComputeCellCenterDistance;
vtkTypeBool ComputeDirection;
};
VTK_ABI_NAMESPACE_END
#endif
|