Skip to content

Commit

Permalink
expose vtk method to capi
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Mar 12, 2024
1 parent 932e3f4 commit d12b8fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/capi/sfcgal_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "SFCGAL/io/ewkt.h"
#include "SFCGAL/io/wkb.h"
#include "SFCGAL/io/wkt.h"
#include "SFCGAL/io/vtk.h"

#if !_MSC_VER
#include "SFCGAL/algorithm/alphaShapes.h"
Expand Down Expand Up @@ -280,6 +281,13 @@ sfcgal_geometry_as_wkb(const sfcgal_geometry_t *pgeom, char **buffer,
strncpy(*buffer, wkb.c_str(), *len);)
}

extern "C" void
sfcgal_geometry_as_vtk(const sfcgal_geometry_t *pgeom, char *filename)
{
SFCGAL_GEOMETRY_CONVERT_CATCH_TO_ERROR_NO_RET(
io::vtk(*reinterpret_cast<const SFCGAL::Geometry *>(pgeom), filename);)
}

/**
* Point
*/
Expand Down
7 changes: 7 additions & 0 deletions src/capi/sfcgal_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ sfcgal_geometry_as_text_decim(const sfcgal_geometry_t *, int numDecimals,
SFCGAL_API void
sfcgal_geometry_as_wkb(const sfcgal_geometry_t *, char **buffer, size_t *len);

/**
* Creates a VTK file of the given geometry
* @ingroup capi
*/
SFCGAL_API void
sfcgal_geometry_as_vtk(const sfcgal_geometry_t *, char *filename);

/**
* Creates an empty point
* @ingroup capi
Expand Down

0 comments on commit d12b8fc

Please sign in to comment.