Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
VTK-CGAL
VESPA
Commits
e84c4a5f
Commit
e84c4a5f
authored
Sep 08, 2022
by
Charles Gueunet
Browse files
Add first version of AlphaWrapping
UNTESTED
parent
8d2f9efe
Pipeline
#297181
failed with stages
in 1 minute and 48 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
vespa/PolygonMeshProcessing/CMakeLists.txt
View file @
e84c4a5f
set
(
vtkcgalpmp_files
vtkCGALPolyDataAlgorithm
vtkCGALAlphaWrapping
vtkCGALBooleanOperation
vtkCGALIsotropicRemesher
vtkCGALMeshDeformation
...
...
vespa/PolygonMeshProcessing/vtkCGALAlphaWrapping.cxx
0 → 100644
View file @
e84c4a5f
#include
"vtkCGALAlphaWrapping.h"
// VTK related includes
#include
"vtkDataSet.h"
#include
"vtkInformationVector.h"
#include
"vtkObjectFactory.h"
// CGAL related includes
#include
<CGAL/alpha_wrap_3.h>
vtkStandardNewMacro
(
vtkCGALAlphaWrapping
);
//------------------------------------------------------------------------------
void
vtkCGALAlphaWrapping
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
{
os
<<
indent
<<
"Alpha :"
<<
this
->
Alpha
<<
std
::
endl
;
os
<<
indent
<<
"Offset :"
<<
this
->
Offset
<<
std
::
endl
;
this
->
Superclass
::
PrintSelf
(
os
,
indent
);
}
//------------------------------------------------------------------------------
int
vtkCGALAlphaWrapping
::
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
inputVector
,
vtkInformationVector
*
outputVector
)
{
// Get the input and output data objects.
vtkPolyData
*
input
=
vtkPolyData
::
GetData
(
inputVector
[
0
]);
vtkPolyData
*
output
=
vtkPolyData
::
GetData
(
outputVector
);
// input parameters
auto
length
=
input
->
GetLength
();
if
(
this
->
Alpha
<=
0
)
{
vtkErrorMacro
(
"Please, specify a positive Alpha: "
<<
this
->
Alpha
);
return
0
;
}
auto
alpha
=
length
/
this
->
Alpha
;
if
(
this
->
Offset
<=
0
)
{
vtkErrorMacro
(
"Please, specify a positive Offset: "
<<
this
->
Offset
);
return
0
;
}
auto
offset
=
length
/
this
->
Offset
;
// Create the surface mesh for CGAL
// --------------------------------
std
::
unique_ptr
<
CGAL_Mesh
>
cgalInput
=
this
->
toCGAL
(
input
);
std
::
unique_ptr
<
CGAL_Mesh
>
cgalOutput
=
std
::
make_unique
<
CGAL_Mesh
>
();
// CGAL Processing
// ---------------
try
{
CGAL
::
alpha_wrap_3
(
cgalInput
->
surface
,
this
->
Alpha
,
this
->
Offset
,
cgalOutput
->
surface
);
}
catch
(
std
::
exception
&
e
)
{
vtkErrorMacro
(
"CGAL Exception: "
<<
e
.
what
());
return
0
;
}
// VTK Output
// ----------
output
->
ShallowCopy
(
this
->
toVTK
(
cgalOutput
.
get
()));
this
->
interpolateAttributes
(
input
,
output
);
return
1
;
}
vespa/PolygonMeshProcessing/vtkCGALAlphaWrapping.h
0 → 100644
View file @
e84c4a5f
/**
* @class vtkCGALAlphaWrapping
* @brief remesh using the CGAL isotropic remeshing
*
* vtkCGALAlphaWrapping is a filter allowing to reconstruct
* a 2-manifold from an arbitrary polygon soup
*/
#ifndef vtkCGALAlphaWrapping_h
#define vtkCGALAlphaWrapping_h
#include
"vtkCGALPolyDataAlgorithm.h"
#include
"vtkCGALPMPModule.h"
// For export macro
class
VTKCGALPMP_EXPORT
vtkCGALAlphaWrapping
:
public
vtkCGALPolyDataAlgorithm
{
public:
static
vtkCGALAlphaWrapping
*
New
();
vtkTypeMacro
(
vtkCGALAlphaWrapping
,
vtkCGALPolyDataAlgorithm
);
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
override
;
//@{
/**
* Get / Set the alpha property, a small alpha
* lead to a finer reconstruction (but more computation).
* The value is relative to the diagonal lenght of the input
**/
vtkGetMacro
(
Alpha
,
double
);
vtkSetMacro
(
Alpha
,
double
);
//@}
//@{
/**
* Get / Set the offset property, drive a dilatation
* on the resulting mesh. The goal is to fix degenerancies
* and keep a 2-manifold output.
* The value is relative to the diagonal lenght of the input
**/
vtkGetMacro
(
Offset
,
double
);
vtkSetMacro
(
Offset
,
double
);
//@}
protected:
vtkCGALAlphaWrapping
()
=
default
;
~
vtkCGALAlphaWrapping
()
override
=
default
;
int
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
)
override
;
// Fields
double
Alpha
=
5
;
double
Offset
=
3
;
private:
vtkCGALAlphaWrapping
(
const
vtkCGALAlphaWrapping
&
)
=
delete
;
void
operator
=
(
const
vtkCGALAlphaWrapping
&
)
=
delete
;
};
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment