Warning / compilation fixes for 5.6.x (#8798)

## Summary of Changes

Fixes warnings/errors. Quite a few are just cherry picking fixes that
were done in master.

## Release Management

* Affected package(s): Various
* Issue(s) solved (if any): -
* Feature/Small Feature (if any): -
* License and copyright ownership: no change
This commit is contained in:
Sebastien Loriot 2025-03-31 10:18:14 +02:00 committed by GitHub
commit bcaeb64f54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 187 additions and 148 deletions

View File

@ -463,60 +463,79 @@ int _readAnalyzeHeader( _image* im, const char* name,
for ( i=0; i<im->nuser; i++ ) im->user[i] = nullptr;
i = 0 ;
im->user[i] = (char *) ImageIO_alloc((strlen("Data lost in the Analyze -> ImageIO conversion:") + 1));
sprintf( im->user[i++], "Data lost in the Analyze -> ImageIO conversion:" );
size_t buffer_size;
buffer_size = strlen("Data lost in the Analyze -> ImageIO conversion:") + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, "Data lost in the Analyze -> ImageIO conversion:" );
im->user[i] = (char *) ImageIO_alloc((strlen(" descrip: ") + 1 + strlen(analyzeHeader->hist.descrip) ));
sprintf( im->user[i++], " descrip: %s", analyzeHeader->hist.descrip );
buffer_size = snprintf(nullptr, 0, " descrip: %s", analyzeHeader->hist.descrip) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " descrip: %s", analyzeHeader->hist.descrip );
im->user[i] = (char *) ImageIO_alloc((strlen(" aux_file: ") + 1 + strlen(analyzeHeader->hist.descrip) ));
sprintf( im->user[i++], " aux_file: %s", analyzeHeader->hist.descrip );
buffer_size = snprintf(nullptr, 0, " aux_file: %s", analyzeHeader->hist.descrip ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " aux_file: %s", analyzeHeader->hist.descrip );
im->user[i] = (char *) ImageIO_alloc((strlen(" orient: ") + 1+ 2));
sprintf( im->user[i++], " orient: %d", analyzeHeader->hist.orient );
buffer_size = snprintf(nullptr, 0, " orient: %d", analyzeHeader->hist.orient ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " orient: %d", analyzeHeader->hist.orient );
im->user[i] = (char *) ImageIO_alloc((strlen(" originator: ") + 1 + strlen(analyzeHeader->hist.originator) ));
sprintf( im->user[i++], " originator: %s", analyzeHeader->hist.originator );
buffer_size = snprintf(nullptr, 0, " originator: %s", analyzeHeader->hist.originator ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " originator: %s", analyzeHeader->hist.originator );
im->user[i] = (char *) ImageIO_alloc((strlen(" generated: ") + 1 + strlen(analyzeHeader->hist.generated) ));
sprintf( im->user[i++], " generated: %s", analyzeHeader->hist.generated );
buffer_size = snprintf(nullptr, 0, " generated: %s", analyzeHeader->hist.generated ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " generated: %s", analyzeHeader->hist.generated );
im->user[i] = (char *) ImageIO_alloc((strlen(" scannum: ") + 1 + strlen(analyzeHeader->hist.scannum) ));
sprintf( im->user[i++], " scannum: %s", analyzeHeader->hist.scannum );
buffer_size = snprintf(nullptr, 0, " scannum: %s", analyzeHeader->hist.scannum ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " scannum: %s", analyzeHeader->hist.scannum );
im->user[i] = (char *) ImageIO_alloc((strlen(" patient_id: ") + 1 + strlen(analyzeHeader->hist.patient_id) ));
sprintf( im->user[i++], " patient_id: %s", analyzeHeader->hist.patient_id );
buffer_size = snprintf(nullptr, 0, " patient_id: %s", analyzeHeader->hist.patient_id ) +1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " patient_id: %s", analyzeHeader->hist.patient_id );
im->user[i] = (char *) ImageIO_alloc((strlen(" exp_date: ") + 1 + strlen(analyzeHeader->hist.exp_date) ));
sprintf( im->user[i++], " exp_date: %s", analyzeHeader->hist.exp_date );
buffer_size = snprintf(nullptr, 0, " exp_date: %s", analyzeHeader->hist.exp_date ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " exp_date: %s", analyzeHeader->hist.exp_date );
im->user[i] = (char *) ImageIO_alloc((strlen(" exp_time: ") + 1 + strlen(analyzeHeader->hist.exp_time) ));
sprintf( im->user[i++], " exp_time: %s", analyzeHeader->hist.exp_time );
buffer_size = snprintf(nullptr, 0, " exp_time: %s", analyzeHeader->hist.exp_time ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " exp_time: %s", analyzeHeader->hist.exp_time );
buffer_size = snprintf(nullptr, 0, " views: %d", analyzeHeader->hist.views ) + 1;
/* A 32 bit int doesn't print on more than 11 chars */
im->user[i] = (char *) ImageIO_alloc((strlen(" views: ") + 11 + 1));
sprintf( im->user[i++], " views: %d", analyzeHeader->hist.views );
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " views: %d", analyzeHeader->hist.views );
im->user[i] = (char *) ImageIO_alloc((strlen(" vols_added: ") + 11 + 1));
sprintf( im->user[i++], " vols_added: %d", analyzeHeader->hist.vols_added );
buffer_size = snprintf(nullptr, 0, " vols_added: %d", analyzeHeader->hist.vols_added ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " vols_added: %d", analyzeHeader->hist.vols_added );
im->user[i] = (char *) ImageIO_alloc((strlen(" start_field: ") + 11 + 1));
sprintf( im->user[i++], " start_field: %d", analyzeHeader->hist.start_field );
buffer_size = snprintf(nullptr, 0, " start_field: %d", analyzeHeader->hist.start_field ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " start_field: %d", analyzeHeader->hist.start_field );
im->user[i] = (char *) ImageIO_alloc((strlen(" field_skip: ") + 11 + 1));
sprintf( im->user[i++], " field_skip: %d", analyzeHeader->hist.field_skip );
buffer_size = snprintf(nullptr, 0, " field_skip: %d", analyzeHeader->hist.field_skip ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " field_skip: %d", analyzeHeader->hist.field_skip );
im->user[i] = (char *) ImageIO_alloc((strlen(" omax: ") + 11 + 1));
sprintf( im->user[i++], " omax: %d", analyzeHeader->hist.omax );
buffer_size = snprintf(nullptr, 0, " omax: %d", analyzeHeader->hist.omax ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " omax: %d", analyzeHeader->hist.omax );
im->user[i] = (char *) ImageIO_alloc((strlen(" omin: ") + 11 + 1));
sprintf( im->user[i++], " omin: %d", analyzeHeader->hist.omin );
buffer_size = snprintf(nullptr, 0, " omin: %d", analyzeHeader->hist.omin ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " omin: %d", analyzeHeader->hist.omin );
im->user[i] = (char *) ImageIO_alloc((strlen(" smax: ") + 11 + 1));
sprintf( im->user[i++], " smax: %d", analyzeHeader->hist.smax );
buffer_size = snprintf(nullptr, 0, " smax: %d", analyzeHeader->hist.smax ) + 1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " smax: %d", analyzeHeader->hist.smax );
im->user[i] = (char *) ImageIO_alloc((strlen(" smin: ") + 11 + 1));
sprintf( im->user[i++], " smin: %d", analyzeHeader->hist.smin );
buffer_size = snprintf(nullptr, 0, " smin: %d", analyzeHeader->hist.smin ) +1;
im->user[i] = (char *) ImageIO_alloc(buffer_size);
snprintf( im->user[i++], buffer_size, " smin: %d", analyzeHeader->hist.smin );
/* header is read. close header file and open data file. */

View File

@ -130,10 +130,10 @@ int writeGis( char *name, _image* im) {
do {
memset( str, 0, _LGTH_STRING_ );
for ( j=0; j<n && i<size; j++, i++ ) {
sprintf( str+strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), " " );
}
sprintf( str+strlen(str), "\n" );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "\n" );
done = ImageIO_write( im, str, strlen( str ) );
res = (done == strlen( str )) ? int(done) : -1;
if ( res <= 0 ) {
@ -150,10 +150,10 @@ int writeGis( char *name, _image* im) {
do {
memset( str, 0, _LGTH_STRING_ );
for ( j=0; j<n && i<size; j++, i++ ) {
sprintf( str+strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), " " );
}
sprintf( str+strlen(str), "\n" );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "\n" );
done = ImageIO_write( im, str, strlen( str ) );
res = (done == strlen( str )) ? int(done) : -1;
if ( res <= 0 ) {
@ -178,10 +178,10 @@ int writeGis( char *name, _image* im) {
do {
memset( str, 0, _LGTH_STRING_ );
for ( j=0; j<n && i<size; j++, i++ ) {
sprintf( str+strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), " " );
}
sprintf( str+strlen(str), "\n" );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "\n" );
done = ImageIO_write( im, str, strlen( str ) );
res = (done == strlen( str )) ? int(done) : -1;
if ( res <= 0 ) {
@ -198,10 +198,10 @@ int writeGis( char *name, _image* im) {
do {
memset( str, 0, _LGTH_STRING_ );
for ( j=0; j<n && i<size; j++, i++ ) {
sprintf( str+strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) snprintf( str+strlen(str),_LGTH_STRING_ - strlen(str), " " );
}
sprintf( str+strlen(str), "\n" );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "\n" );
done = ImageIO_write( im, str, strlen( str ) );
res = (done == strlen( str )) ? int(done) : -1;
if ( res <= 0 ) {

View File

@ -77,22 +77,22 @@ int _writeInrimageHeader(const _image *im, ENDIANNESS end) {
switch(im->wordKind) {
case WK_FLOAT:
sprintf(type, "float");
snprintf(type, 30, "float");
scale[0] = '\0';
break;
case WK_FIXED:
switch(im->sign) {
case SGN_SIGNED:
sprintf(type, "signed fixed");
snprintf(type, 30, "signed fixed");
break;
case SGN_UNSIGNED:
sprintf(type, "unsigned fixed");
snprintf(type, 30, "unsigned fixed");
break;
default:
return -1;
}
sprintf(scale, "SCALE=2**0\n");
snprintf(scale, 20, "SCALE=2**0\n");
break;
default:
@ -101,17 +101,17 @@ int _writeInrimageHeader(const _image *im, ENDIANNESS end) {
switch(end) {
case END_LITTLE:
sprintf(endianness, "decm");
snprintf(endianness, 5, "decm");
break;
case END_BIG:
sprintf(endianness, "sun");
snprintf(endianness, 5, "sun");
break;
default:
/* fix architecture endianness */
if( _getEndianness() == END_LITTLE)
sprintf(endianness, "decm");
snprintf(endianness, 5, "decm");
else
sprintf(endianness, "sun");
snprintf(endianness, 5, "sun");
break;
}

View File

@ -357,7 +357,7 @@ int writeMincFile( const _image* im, const char *filename,
strcat(newname, filename + i + 1);
}
else
sprintf(newname, "#TMP#%s", filename);
snprintf(newname,strlen(filename) + 10, "#TMP#%s", filename);
}
}

View File

@ -524,14 +524,14 @@ int writePgmImage(char *name,_image *im )
}
if ( im->dataMode == DM_ASCII )
sprintf( string, "%s\n", PGM_ASCII_MAGIC );
snprintf( string, 256, "%s\n", PGM_ASCII_MAGIC );
else
sprintf( string, "%s\n", PGM_MAGIC );
snprintf( string, 256, "%s\n", PGM_MAGIC );
ImageIO_write( im, string, strlen( string ) );
sprintf( string, "# CREATOR: pnm.c $Revision$ $Date$\n" );
snprintf( string, 256, "# CREATOR: pnm.c $Revision$ $Date$\n" );
ImageIO_write( im, string, strlen( string ) );
sprintf( string, "%zu %zu\n", im->xdim, im->ydim );
snprintf( string, 256, "%zu %zu\n", im->xdim, im->ydim );
ImageIO_write( im, string, strlen( string ) );
max = 0;
switch ( im->wdim ) {
@ -552,7 +552,7 @@ int writePgmImage(char *name,_image *im )
}
/* max == 0 causes problems for xv */
if ( max == 0 ) max = 1;
sprintf( string, "%d\n", max );
snprintf( string, 256, "%d\n", max );
ImageIO_write( im, string, strlen( string ) );
if ( im->dataMode == DM_ASCII ) {
@ -574,10 +574,10 @@ int writePgmImage(char *name,_image *im )
do {
memset( str, 0, _LGTH_STRING_ );
for ( j=0; j<n && i<size; j++, i++ ) {
sprintf( str+strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), " " );
}
sprintf( str+strlen(str), "\n" );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "\n" );
if ( ImageIO_write( im, str, strlen( str ) ) <= 0 ) {
fprintf(stderr, "writePgmImage: error when writing data in \'%s\'\n", name );
return( -3 );
@ -591,10 +591,10 @@ int writePgmImage(char *name,_image *im )
do {
memset( str, 0, _LGTH_STRING_ );
for ( j=0; j<n && i<size; j++, i++ ) {
sprintf( str+strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) sprintf( str+strlen(str), " " );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "%d", theBuf[i] );
if ( j<n && i<size ) snprintf( str+strlen(str), 2, " " );
}
sprintf( str+strlen(str), "\n" );
snprintf( str+strlen(str), _LGTH_STRING_ - strlen(str), "\n" );
if ( ImageIO_write( im, str, strlen( str ) ) <= 0 ) {
fprintf(stderr, "writePgmImage: error when writing data in \'%s\'\n", name );
return( -3 );
@ -629,6 +629,3 @@ int writePgmImage(char *name,_image *im )
im->openMode = OM_CLOSE;
return 1;
}

View File

@ -163,7 +163,7 @@ namespace CGAL {
/// test if adart->beta(ai)->beta(aj) exists and is not marked for amark
bool is_unmarked2(Dart_descriptor adart, unsigned int ai, unsigned int aj,
typename Map::size_type amark) const
size_type amark) const
{ return
!mmap->is_marked(mmap->beta(adart, ai, aj), amark);
}
@ -209,6 +209,8 @@ namespace CGAL {
/// true iff this iterator is basic
typedef Tag_true Basic_iterator;
typedef typename Map::size_type size_type;
public:
/// Main constructor.
CMap_dart_iterator(Map& amap, Dart_descriptor adart):
@ -263,7 +265,7 @@ namespace CGAL {
protected:
/// test if adart->beta(ai) exists and is not marked for amark
bool is_unmarked(Dart_descriptor adart, unsigned int ai, unsigned amark) const
bool is_unmarked(Dart_descriptor adart, unsigned int ai, size_type amark) const
{ return !mmap->is_marked(mmap->beta(adart,ai), amark); }
/// test if adart->beta(ai)->beta(aj) exists
@ -272,7 +274,7 @@ namespace CGAL {
/// test if adart->beta(ai)->beta(aj) exists and is not marked for amark
bool is_unmarked2(Dart_descriptor adart, unsigned int ai, unsigned int aj,
unsigned amark) const
size_type amark) const
{ return !mmap->is_marked(mmap->beta(adart, ai, aj), amark); }
protected:

View File

@ -5,6 +5,11 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Hyperbolic_triangulation_2_Examples)
find_package(CGAL REQUIRED COMPONENTS Core)
find_package(LEDA QUIET)
create_single_source_cgal_program("ht2_example.cpp")
create_single_source_cgal_program("ht2_example_color.cpp")
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("ht2_example.cpp")
create_single_source_cgal_program("ht2_example_color.cpp")
else()
message("NOTICE: Examples require CGAL_Core (or LEDA), and will not be compiled.")
endif()

View File

@ -5,11 +5,16 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Hyperbolic_triangulation_2_Tests)
find_package(CGAL REQUIRED COMPONENTS Core)
find_package(LEDA QUIET)
create_single_source_cgal_program("ht2_test_clear.cpp")
create_single_source_cgal_program("ht2_test_locate.cpp")
create_single_source_cgal_program("ht2_test_remove.cpp")
create_single_source_cgal_program("ht2_test_swap.cpp")
create_single_source_cgal_program("ht2_test_copy.cpp")
create_single_source_cgal_program("ht2_test_hyperbolic_circulator.cpp")
create_single_source_cgal_program("ht2_test_insert_degenerate.cpp")
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("ht2_test_clear.cpp")
create_single_source_cgal_program("ht2_test_locate.cpp")
create_single_source_cgal_program("ht2_test_remove.cpp")
create_single_source_cgal_program("ht2_test_swap.cpp")
create_single_source_cgal_program("ht2_test_copy.cpp")
create_single_source_cgal_program("ht2_test_hyperbolic_circulator.cpp")
create_single_source_cgal_program("ht2_test_insert_degenerate.cpp")
else()
message("NOTICE: Tests require CGAL_Core (or LEDA), and will not be compiled.")
endif()

View File

@ -909,7 +909,7 @@ public:
std::cout << "four offsets: " << std::endl;
#endif
boost::array<int, 4> offsets;
std::array<int, 4> offsets;
for(int i=0; i<4; ++i)
{
#ifdef CGAL_PERIODIC_SET_POINT_VERBOSE

View File

@ -712,9 +712,7 @@ private:
bool
point_out_prism_return_local_id(const Point_3 &point, const ePoint_3 &epoint, const std::vector<unsigned int> &prismindex, const unsigned int jump, int &id) const
{
Vector_3 bmin, bmax;
Orientation ori;
Orientation ori = ON_ORIENTED_BOUNDARY; // to avoid maybe uninitialized warning
for (unsigned int i = 0; i < prismindex.size(); i++){
if (prismindex[i] == jump){

View File

@ -334,7 +334,7 @@ struct Tester
// Test vertex iterators
//-------------------------------------------------------
std::cout << "Test vertex iterators\n";
const Vertex_handle& vertex_to_modify = c3t3.vertices_in_complex_begin();
Vertex_handle vertex_to_modify = c3t3.vertices_in_complex_begin();
c3t3.remove_from_complex(vertex_to_modify);
c3t3.add_to_complex(vertex_to_modify,corner_index_bis);

View File

@ -45,7 +45,7 @@ struct Node_1
void set_time_stamp(const std::size_t& ts) {
time_stamp_ = ts;
}
std::size_t time_stamp_;
std::size_t time_stamp_ = std::size_t(-2);
};
class Node_2

View File

@ -5,18 +5,21 @@ namespace CGAL {
*
* \brief constructs the straight skeleton-based extrusion of a polygon with holes.
*
* Given a polygon with holes and a set of weights, the skeleton extrusion is a volume constructed
* from the weighted straight skeleton by associating a height to the vertices of the skeleton,
* which corresponds to the time at the vertex. The input polygon is placed at `z = 0`.
*
* This function allows cropping the extruded skeleton at a maximum height, using the optional
* `maximum_height()` named parameter.
* Given a polygon with holes and a set of weights (or angles) associated to its edges,
* the skeleton extrusion is a volume constructed from the weighted straight skeleton
* by associating a height to the vertices of the skeleton, which corresponds to the time
* at the vertex. The input polygon is placed at `z = 0`.
*
* The result is a closed, 2-manifold surface triangle mesh. Note that this mesh can have non-local
* self-intersections if a maximal height is provided due to possible (geometric) non-manifold occurences.
*
* @tparam PolygonWithHoles must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2<InK>`)
or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2<InK>`).
* It is possible to crop the extruded skeleton at a maximum height using the optional
* `maximum_height()` named parameter. A maximum height must be specified if the weights (or angles)
* associated to the edges of the input polygon correspond an outward extrusion, i.e. if no weight
* is greater than zero (or no angle is smaller than `90` degrees).
*
* @tparam Polygon must be a model of `SequenceContainer` with value type `InK::Point_2` (e.g. `Polygon_2<InK>`)
or a model of `GeneralPolygonWithHoles_2` (e.g. `Polygon_with_holes_2<InK>`).
* @tparam PolygonMesh a model of `MutableFaceGraph`
* @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
*
@ -42,7 +45,7 @@ namespace CGAL {
* \cgalParamType{a model of `Range` whose value type is a model of `Range` whose value type is `FT`}
* \cgalParamDefault{an empty range (uniform weights are used)}
* \cgalParamExtra{Angles are measured in degrees and should be strictly within `0` and `180` degrees
* and should be eitger all acute (inward extrusion) or all obtuse (outward extrusion).}
* and should be either all acute (inward extrusion) or all obtuse (outward extrusion).}
* \cgalParamExtra{This parameter is ignored if the `weights` parameter is provided.}
* \cgalParamExtra{The conversion to weights involves trigonometry and will be inexact,
* even when using a number type with exact square roots.}

View File

@ -141,7 +141,7 @@ template<class OutPolygon, class FT, class Skeleton, class K>
std::vector< boost::shared_ptr<OutPolygon> >
create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Tag_false )
{
static_assert(!(std::is_same<OutPolygon, CGAL::Default>::value));
static_assert(!(std::is_same<OutPolygon, CGAL::Default>::value), "");
typedef boost::shared_ptr<OutPolygon> OutPolygonPtr ;
typedef std::vector<OutPolygonPtr> OutPolygonPtrVector ;
@ -167,7 +167,7 @@ template<class OutPolygon, class FT, class Skeleton, class K>
std::vector< boost::shared_ptr<OutPolygon> >
create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k*/, Tag_true )
{
static_assert(!(std::is_same<OutPolygon, CGAL::Default>::value));
static_assert(!(std::is_same<OutPolygon, CGAL::Default>::value), "");
typedef boost::shared_ptr<OutPolygon> OutPolygonPtr ;
typedef std::vector<OutPolygonPtr> OutPolygonPtrVector ;

View File

@ -127,7 +127,7 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset,
typedef typename Kernel_traits<Point_2>::Kernel IK;
typedef typename IK::FT IFT;
static_assert((std::is_same<typename std::iterator_traits<WeightIterator>::value_type, IFT>::value));
static_assert((std::is_same<typename std::iterator_traits<WeightIterator>::value_type, IFT>::value), "Vertices and weights should have the same FT");
boost::shared_ptr<Straight_skeleton_2<K> > rSkeleton;

View File

@ -148,7 +148,7 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset,
using IK = typename Kernel_traits<Point_2>::Kernel;
using IFT = typename IK::FT;
static_assert((std::is_same<typename std::iterator_traits<WeightIterator>::value_type, IFT>::value));
static_assert((std::is_same<typename std::iterator_traits<WeightIterator>::value_type, IFT>::value), "Vertices and weights should have the same FT");
boost::shared_ptr<Straight_skeleton_2<K> > skeleton;

View File

@ -5,25 +5,36 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Straight_skeleton_2_Tests)
find_package(CGAL REQUIRED COMPONENTS Qt5 Core)
find_package(LEDA QUIET)
include_directories(BEFORE "include")
# create a target per cppfile
file(
GLOB cppfiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}")
endforeach()
create_single_source_cgal_program("issue4533.cpp")
create_single_source_cgal_program("issue4684.cpp")
create_single_source_cgal_program("test_sls.cpp")
create_single_source_cgal_program("test_sls_previous_issues.cpp")
create_single_source_cgal_program("test_sls_traits.cpp")
create_single_source_cgal_program("test_straight_skeleton_copy.cpp")
if(CGAL_Qt5_FOUND)
target_link_libraries(issue4684 PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(issue7149 PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(issue7284 PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_previous_issues PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_offset PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_weighted_offset PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_weighted_polygons PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_weighted_polygons_with_holes PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(issue4684 PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_previous_issues PRIVATE CGAL::CGAL_Basic_viewer)
endif()
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("issue7149.cpp")
create_single_source_cgal_program("issue7284.cpp")
create_single_source_cgal_program("test_sls_offset.cpp")
create_single_source_cgal_program("test_sls_weighted_offset.cpp")
create_single_source_cgal_program("test_sls_simple.cpp")
create_single_source_cgal_program("test_sls_weighted_polygons.cpp")
create_single_source_cgal_program("test_sls_weighted_polygons_with_holes.cpp")
if(CGAL_Qt5_FOUND)
target_link_libraries(issue7149 PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(issue7284 PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_offset PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_weighted_offset PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_weighted_polygons PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(test_sls_weighted_polygons_with_holes PRIVATE CGAL::CGAL_Basic_viewer)
endif()
endif()

View File

@ -37,16 +37,18 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqr
namespace CGAL {
template<typename K>
class Test_polygon_2 : public CGAL::Polygon_2<K> {
struct Test_polygon_2 : public CGAL::Polygon_2<K> {
typedef CGAL::Polygon_2<K> Base;
Test_polygon_2() { }
Test_polygon_2(const Base&);
public:
using Base::Base;
};
template<typename K>
class Test_polygon_with_holes_2 : public CGAL::Polygon_with_holes_2<K> {
struct Test_polygon_with_holes_2 : public CGAL::Polygon_with_holes_2<K> {
typedef CGAL::Polygon_with_holes_2<K> Base;
Test_polygon_with_holes_2() { }
Test_polygon_with_holes_2(const Base&);
public:
using Base::Base;

View File

@ -28,16 +28,18 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt EPECK_w_sqr
namespace CGAL {
template<typename K>
class Test_polygon_2 : public CGAL::Polygon_2<K> {
struct Test_polygon_2 : public CGAL::Polygon_2<K> {
typedef CGAL::Polygon_2<K> Base;
Test_polygon_2() { }
Test_polygon_2(const Base&);
public:
using Base::Base;
};
template<typename K>
class Test_polygon_with_holes_2 : public CGAL::Polygon_with_holes_2<K> {
struct Test_polygon_with_holes_2 : public CGAL::Polygon_with_holes_2<K> {
typedef CGAL::Polygon_with_holes_2<K> Base;
Test_polygon_with_holes_2() { }
Test_polygon_with_holes_2(const Base&);
public:
using Base::Base;

View File

@ -86,8 +86,8 @@ inline constexpr FT default_extrusion_height()
}
// @todo Maybe this postprocessing is not really necessary? Do users really care if the point
// is not perfectly above the input contour edge (it generally cannot be anyway if the kernel is not exact except for some
// specific cases)?
// is not perfectly above the input contour edge (it generally cannot be anyway if the kernel
// is not exact except for some specific cases)?
#define CGAL_SLS_SNAP_TO_VERTICAL_SLABS
#ifdef CGAL_SLS_SNAP_TO_VERTICAL_SLABS
@ -205,17 +205,19 @@ public:
}
// can't modify the position yet because we need arrange_polygons() to still work properly
//
// @fixme on paper one could create a polygon thin-enough w.r.t. the max weight value
// such thatthere is a skeleton vertex that wants to be snapped to two different sides...
void on_offset_point(const Point_2& op,
SS_Halfedge_const_handle hook) const
{
CGAL_assertion(hook->is_bisector());
#ifdef CGAL_SLS_SNAP_TO_VERTICAL_SLABS
// @fixme on paper one could create a polygon thin-enough w.r.t. the max weight value such that
// there is a skeleton vertex that wants to be snapped to two different sides...
CGAL_assertion(m_snapped_positions.count(op) == 0);
CGAL_precondition(hook->is_bisector());
HDS_Halfedge_const_handle canonical_hook = (hook < hook->opposite()) ? hook : hook->opposite();
m_offset_points[canonical_hook] = op;
#ifdef CGAL_SLS_SNAP_TO_VERTICAL_SLABS
CGAL_precondition(m_snapped_positions.count(op) == 0);
SS_Halfedge_const_handle contour_h1 = hook->defining_contour_edge();
CGAL_assertion(contour_h1->opposite()->is_border());
@ -225,9 +227,6 @@ public:
const bool is_h1_vertical = (contour_h1->weight() == m_vertical_weight);
const bool is_h2_vertical = (contour_h2->weight() == m_vertical_weight);
// this can happen when the offset is passing through vertices
m_offset_points[canonical_hook] = op;
// if both are vertical, it's the common vertex (which has to exist)
if(is_h1_vertical && is_h2_vertical)
{
@ -691,7 +690,7 @@ public:
#ifdef CGAL_SLS_SNAP_TO_VERTICAL_SLABS
Visitor visitor(*ss_ptr, offset_points, vertical_weight, snapped_positions);
#else
Visitor visitor(*ss_ptr, vertical_weight, offset_points);
Visitor visitor(*ss_ptr, offset_points);
#endif
Offset_builder ob(*ss_ptr, Offset_builder_traits(), visitor);
Offset_polygons raw_output;

View File

@ -5,18 +5,14 @@ cmake_minimum_required(VERSION 3.1...3.23)
project(Straight_skeleton_extrusion_2_Tests)
find_package(CGAL REQUIRED COMPONENTS Qt5 Core)
find_package(LEDA QUIET)
include_directories(BEFORE "include")
# create a target per cppfile
file(
GLOB cppfiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}")
endforeach()
if (CGAL_Core_FOUND OR LEDA_FOUND)
create_single_source_cgal_program("test_sls_extrude.cpp")
if(CGAL_Qt5_FOUND)
target_link_libraries(test_sls_extrude PUBLIC CGAL::CGAL_Basic_viewer)
if(CGAL_Qt5_FOUND)
target_link_libraries(test_sls_extrude PUBLIC CGAL::CGAL_Basic_viewer)
endif()
endif()

View File

@ -123,7 +123,7 @@ int main(int argc, char** argv)
// reassemble the mesh
Triangle_mesh final_mesh;
std::size_t nv=0, nf=0, ne=0;
Triangle_mesh::size_type nv = 0, nf = 0, ne = 0;
for (int i=0; i< number_of_parts; ++i)
{
meshes[i].collect_garbage();

View File

@ -738,9 +738,9 @@ public:
++it){
if(! is_subconstraint(*it, *succ)){ // this checks whether other constraints pass
Face_handle fh;
int i;
bool b = Triangulation::is_edge(*it, *succ, fh, i);
CGAL_assume(b);
int i = -1;
Triangulation::is_edge(*it, *succ, fh, i);
CGAL_assertion(i != -1);
Triangulation::remove_constrained_edge(fh,i, out); // this does also flipping if necessary.
}
}