Merge branch 'master' into feature/bug_documentation_spell_20221113

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

Synchronize with master
This commit is contained in:
albert-github 2022-11-16 13:58:05 +01:00
commit 01a7852f70
10 changed files with 132 additions and 46 deletions

1
.github/install.sh vendored
View File

@ -1,5 +1,4 @@
#!/bin/bash
sudo add-apt-repository ppa:mikhailnov/pulseeffects -y
sudo apt-get update
sudo apt-get install -y libmpfr-dev \
libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \

View File

@ -320,8 +320,21 @@ public:
void refine(const Split_predicate& split_predicate) {
// If the tree has already been refined, reset it
if (!m_root.is_leaf())
if (!m_root.is_leaf()){
std::queue<Node> nodes;
for (std::size_t i = 0; i < Degree::value; ++ i)
nodes.push (m_root[i]);
while (!nodes.empty())
{
Node node = nodes.front();
nodes.pop();
if (!node.is_leaf())
for (std::size_t i = 0; i < Degree::value; ++ i)
nodes.push (node[i]);
node.free();
}
m_root.unsplit();
}
// Reset the side length map, too
m_side_per_depth.resize(1);

View File

@ -1068,15 +1068,15 @@ public:
if (!used_to_clip_a_surface && !used_to_classify_patches && (!is_tm1_closed || !is_tm2_closed))
{
//make sure there is no ambiguity in tm1
if( (patch_status_was_not_already_set[0] && previous_bitvalue[0]!=is_patch_inside_tm2[patch_id_p1] ) ||
(patch_status_was_not_already_set[1] && previous_bitvalue[1]!=is_patch_inside_tm2[patch_id_p2] ) )
if( (!patch_status_was_not_already_set[0] && previous_bitvalue[0]!=is_patch_inside_tm2.test(patch_id_p1) ) ||
(!patch_status_was_not_already_set[1] && previous_bitvalue[1]!=is_patch_inside_tm2.test(patch_id_p2) ) )
{
impossible_operation.set();
return true;
}
//make sure there is no ambiguity in tm2
if( (patch_status_was_not_already_set[2] && previous_bitvalue[2]!=is_patch_inside_tm2[patch_id_q1] ) ||
(patch_status_was_not_already_set[3] && previous_bitvalue[3]!=is_patch_inside_tm2[patch_id_q2] ) )
if( (!patch_status_was_not_already_set[2] && previous_bitvalue[2]!=is_patch_inside_tm1.test(patch_id_q1) ) ||
(!patch_status_was_not_already_set[3] && previous_bitvalue[3]!=is_patch_inside_tm1.test(patch_id_q2) ) )
{
impossible_operation.set();
return true;
@ -1091,6 +1091,15 @@ public:
patch_status_not_set_tm2.reset(patch_id_q1);
patch_status_not_set_tm2.reset(patch_id_q2);
// restore initial state, needed when checking in `inconsistent_classification()`
if (!is_tm1_closed || !is_tm2_closed)
{
is_patch_inside_tm2.reset(patch_id_p1);
is_patch_inside_tm2.reset(patch_id_p2);
is_patch_inside_tm1.reset(patch_id_q1);
is_patch_inside_tm1.reset(patch_id_q2);
}
#ifdef CGAL_COREFINEMENT_POLYHEDRA_DEBUG
#warning: Factorize the orientation predicates.
#endif //CGAL_COREFINEMENT_POLYHEDRA_DEBUG

View File

@ -0,0 +1,16 @@
OFF
8 4 0
0 0 1
1 0 1
1 1 1
0 1 1
0 0 0
1 0 0
1 1 0
0 1 0
3 0 1 2
3 2 3 0
3 6 5 4
3 4 7 6

View File

@ -0,0 +1,24 @@
OFF
8 12 0
0.75 0.75 -1
0.25 0.75 -1
0.25 0.25 -1
0.75 0.25 -1
0.75 0.25 1
0.75 0.75 1
0.25 0.75 1
0.25 0.25 1
3 4 5 6
3 0 3 2
3 1 2 7
3 0 1 6
3 3 0 5
3 2 3 4
3 6 7 4
3 2 1 0
3 7 6 1
3 6 5 0
3 5 4 3
3 4 7 2

View File

@ -1,2 +1,3 @@
${CGAL_DATA_DIR}/meshes/elephant.off ${CGAL_DATA_DIR}/meshes/sphere.off ALL 1 1 1 1
${CGAL_DATA_DIR}/meshes/open_cube.off data-coref/incompatible_with_open_cube.off ALL 0 0 0 0
data-coref/floating_squares.off data-coref/hexa.off ALL 1 1 1 1

View File

@ -60,12 +60,10 @@
#include <vtkAppendFilter.h>
#include <vtkSphereSource.h>
#include <vtkVersion.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkType.h>
#include <vtkCommand.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <CGAL/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>

View File

@ -65,7 +65,9 @@
#include <vtkImageReader.h>
#include <vtkImageGaussianSmooth.h>
#include <vtkDemandDrivenPipeline.h>
#include <vtkNrrdReader.h>
#endif
#include <CGAL/Three/Three.h>
// Covariant return types don't work for scalar types and we cannot
@ -978,7 +980,8 @@ private Q_SLOTS:
QString Io_image_plugin::nameFilters() const {
return QString("Inrimage files (*.inr *.inr.gz) ;; "
"Analyze files (*.hdr *.img *img.gz) ;; "
"Stanford Exploration Project files (*.H *.HH)");
"Stanford Exploration Project files (*.H *.HH) ;; "
"NRRD image files (*.nrrd)");
}
@ -1011,7 +1014,33 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene)
ok = true;
QApplication::restoreOverrideCursor();
Image* image = new Image;
if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" &&
//read a nrrd file
if (fileinfo.suffix() == "nrrd")
{
#ifdef CGAL_USE_VTK
vtkNew<vtkNrrdReader> reader;
reader->SetFileName(fileinfo.filePath().toUtf8());
reader->Update();
auto vtk_image = reader->GetOutput();
vtk_image->Print(std::cerr);
*image = CGAL::IO::read_vtk_image_data(vtk_image); // copy the image data
#else
CGAL::Three::Three::warning("You need VTK to read a NRRD file");
delete image;
return QList<Scene_item*>();
#endif
}
//read a sep file
else if (fileinfo.suffix() == "H" || fileinfo.suffix() == "HH")
{
CGAL::SEP_to_ImageIO<float> reader(fileinfo.filePath().toUtf8().data());
*image = *reader.cgal_image();
is_gray = true;
}
else if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" &&
!image->read(fileinfo.filePath().toUtf8()))
{
QMessageBox qmb(QMessageBox::NoIcon,
@ -1100,13 +1129,7 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene)
return QList<Scene_item*>();
}
}
//read a sep file
else if(fileinfo.suffix() == "H" || fileinfo.suffix() == "HH")
{
CGAL::SEP_to_ImageIO<float> reader(fileinfo.filePath().toUtf8().data());
*image = *reader.cgal_image();
is_gray = true;
}
// Get display precision
QDialog dialog;
ui.setupUi(&dialog);

View File

@ -374,27 +374,6 @@ boost::optional<QString> Mesh_3_plugin::get_items_or_return_error_string() const
auto& image_item = image_mesh_items->image_item;
item = image_item;
features_protection_available = true;
bool fit_wrdtp = true;
std::size_t img_wdim = image_item->image()->image()->wdim;
WORD_KIND img_wordKind = image_item->image()->image()->wordKind;
// check if the word type fits the hardcoded values in the plugin
if (image_item->isGray()) {
if (img_wordKind != WK_FLOAT)
fit_wrdtp = false;
else if (img_wdim != 4)
fit_wrdtp = false;
} else {
if (img_wordKind != WK_FIXED)
fit_wrdtp = false;
else if (img_wdim != 1)
fit_wrdtp = false;
}
if (!fit_wrdtp) {
return tr(
"Selected object can't be meshed because the image's word type is "
"not supported by this plugin.");
}
}
# endif

View File

@ -289,10 +289,22 @@ public:
if(m_vcolors == 3)
{
unsigned char r, g, b;
element.assign(r, "red");
element.assign(g, "green");
element.assign(b, "blue");
unsigned char r=0, g=0, b=0;
float rf=0, gf=0, bf=0;
if(element.has_property("red",r))
{
element.assign(r, "red");
element.assign(g, "green");
element.assign(b, "blue");
}else if(element.has_property("red", rf))
{
element.assign(rf, "red");
element.assign(gf, "green");
element.assign(bf, "blue");
r = static_cast<unsigned char>(std::floor(rf*255));
g = static_cast<unsigned char>(std::floor(gf*255));
b = static_cast<unsigned char>(std::floor(bf*255));
}
m_vcolor_map[vi] = CGAL::IO::Color(r, g, b);
}
}
@ -331,10 +343,22 @@ public:
if(m_fcolors == 3)
{
unsigned char r, g, b;
element.assign(r, "red");
element.assign(g, "green");
element.assign(b, "blue");
unsigned char r=0, g=0, b=0;
float rf=0, gf=0, bf=0;
if(element.has_property("red",r))
{
element.assign(r, "red");
element.assign(g, "green");
element.assign(b, "blue");
} else if(element.has_property("red", rf))
{
element.assign(rf, "red");
element.assign(gf, "green");
element.assign(bf, "blue");
r = static_cast<unsigned char>(std::floor(rf*255));
g = static_cast<unsigned char>(std::floor(gf*255));
b = static_cast<unsigned char>(std::floor(bf*255));
}
m_fcolor_map[fi] = CGAL::IO::Color(r, g, b);
}
}