Skip to content

Commit

Permalink
Merge branch 'master' into gsoc2023-aos_sphere_demo-denizdiktas
Browse files Browse the repository at this point in the history
  • Loading branch information
efifogel committed May 24, 2023
2 parents c1c1a51 + 898e452 commit c74d7a3
Show file tree
Hide file tree
Showing 167 changed files with 18,177 additions and 24,294 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
sudo apt-get update && sudo apt-get install -y graphviz ssh bibtex2html
sudo pip install lxml
sudo pip install pyquery
wget --no-verbose -O doxygen_exe https://cgal.geometryfactory.com/~cgaltest/doxygen_1_8_13_patched/doxygen
wget --no-verbose -O doxygen_exe https://cgal.geometryfactory.com/~cgaltest/doxygen_1_9_6_patched/doxygen
sudo mv doxygen_exe /usr/bin/doxygen
sudo chmod +x /usr/bin/doxygen
git config --global user.email "[email protected]"
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
script: |
const error = process.env.ERRORMSG
const job_url = `${context.serverUrl}/CGAL/cgal/actions/runs/${context.runId}`
const msg = "There was an error while building the doc: \n"+error + "\n" + job_url
const msg = "There was an error while building the doc: \n```\n"+error + "\n```\n" + job_url
github.rest.issues.createComment({
owner: "CGAL",
repo: "cgal",
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -1212,3 +1212,4 @@ gmon.*
Polygonal_surface_reconstruction/examples/build*
Polygonal_surface_reconstruction/test/build*
Solver_interface/examples/build*
/Mesh_3/examples/Mesh_3/indicator_0.inr.gz
4 changes: 2 additions & 2 deletions AABB_tree/demo/AABB_tree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include_directories(BEFORE ./ ./include)
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)

# Find Qt5 itself
find_package(Qt5 QUIET COMPONENTS Script OpenGL Gui Svg)
find_package(Qt5 QUIET COMPONENTS Widgets OpenGL)

if(CGAL_Qt5_FOUND AND Qt5_FOUND)

Expand Down Expand Up @@ -53,7 +53,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND)
#${CGAL_Qt5_MOC_FILES}
)
# Link with Qt libraries
target_link_libraries(AABB_demo PRIVATE Qt5::OpenGL Qt5::Gui
target_link_libraries(AABB_demo PRIVATE Qt5::Widgets Qt5::OpenGL
CGAL::CGAL CGAL::CGAL_Qt5)

add_to_cached_list(CGAL_EXECUTABLE_TARGETS AABB_demo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ typedef unspecified_type Is_numerical_sensitive;
This type specifies the return type of the predicates provided
by this traits. The type must be convertible to `bool` and
typically the type indeed maps to `bool`. However, there are also
cases such as interval arithmetic, in which it is `Uncertain<bool>`
cases such as interval arithmetic, in which it is `CGAL::Uncertain<bool>`
or some similar type.
*/
Expand Down Expand Up @@ -300,4 +300,3 @@ typedef unspecified_type Root_of;
/// @}

}; /* end AlgebraicStructureTraits */

4 changes: 2 additions & 2 deletions Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif()

find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)

find_package(Qt5 QUIET COMPONENTS Script OpenGL Svg)
find_package(Qt5 QUIET COMPONENTS Widgets OpenGL)

if(CGAL_Qt5_FOUND AND Qt5_FOUND)

Expand All @@ -40,7 +40,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND)
add_to_cached_list(CGAL_EXECUTABLE_TARGETS Alpha_shape_3)

target_link_libraries(Alpha_shape_3 PRIVATE CGAL::CGAL CGAL::CGAL_Qt5
Qt5::OpenGL Qt5::Gui)
Qt5::Widgets Qt5::OpenGL)

include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
cgal_add_compilation_test(Alpha_shape_3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(POLICY CMP0071)
endif()

find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Core Qt5)
find_package(Qt5 QUIET COMPONENTS Gui Widgets)
find_package(Qt5 QUIET COMPONENTS Widgets)

if (CGAL_Qt5_FOUND AND Qt5_FOUND)
include(${CGAL_USE_FILE})
Expand Down Expand Up @@ -110,7 +110,7 @@ if (CGAL_Qt5_FOUND AND Qt5_FOUND)
${CGAL_Qt5_RESOURCE_FILES}
${CGAL_Qt5_MOC_FILES})

target_link_libraries(arrangement_2 PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(arrangement_2 PRIVATE Qt5::Widgets)
target_link_libraries(arrangement_2 PRIVATE CGAL::CGAL CGAL::CGAL_Qt5)
if(CGAL_Core_FOUND)
target_link_libraries(arrangement_2 PRIVATE CGAL::CGAL_Core)
Expand Down
197 changes: 162 additions & 35 deletions Boolean_set_operations_2/include/CGAL/draw_polygon_set_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,71 +17,198 @@
#ifndef CGAL_DRAW_POLYGON_SET_2_H
#define CGAL_DRAW_POLYGON_SET_2_H

#include <CGAL/draw_polygon_with_holes_2.h>
#include <CGAL/Qt/Basic_viewer_qt.h>

#ifdef DOXYGEN_RUNNING
namespace CGAL {

/*!
\ingroup PkgDrawPolygonSet2
opens a new window and draws `aps`, an instance of the `CGAL::Polygon_set_2` class. A call to this function is blocking, that is the program continues as soon as the user closes the window. This function requires `CGAL_Qt5`, and is only available if the macro `CGAL_USE_BASIC_VIEWER` is defined.
Linking with the cmake target `CGAL::CGAL_Basic_viewer` will link with `CGAL_Qt5` and add the definition `CGAL_USE_BASIC_VIEWER`.
\tparam PS an instance of the `CGAL::Polygon_set_2` class.
\param aps the polygon set to draw.
*/
* \ingroup PkgDrawPolygonSet2
*
* opens a new window and draws `aps`, an instance of the `CGAL::Polygon_set_2`
* class. A call to this function is blocking, that is the program continues as
* soon as the user closes the window. This function requires `CGAL_Qt5`, and is
* only available if the macro `CGAL_USE_BASIC_VIEWER` is defined. Linking with
* the cmake target `CGAL::CGAL_Basic_viewer` will link with `CGAL_Qt5` and add
* the definition `CGAL_USE_BASIC_VIEWER`.
* \tparam PS an instance of the `CGAL::Polygon_set_2` class.
* \param aps the polygon set to draw.
*/
template<class PS>
void draw(const PS& aps);

} /* namespace CGAL */
#endif

#ifdef CGAL_USE_BASIC_VIEWER

#include <CGAL/Qt/init_ogl_context.h>
#include <CGAL/Polygon_set_2.h>

namespace CGAL
{
namespace CGAL {

template<class PS2>
class SimplePolygonSet2ViewerQt :
public SimplePolygonWithHoles2ViewerQt<typename PS2::Polygon_with_holes_2>
{
typedef SimplePolygonWithHoles2ViewerQt<typename PS2::Polygon_with_holes_2> Base;
template <typename PolygonSet_2>
class Polygon_set_2_basic_viewer_qt : public Basic_viewer_qt {
using Base = Basic_viewer_qt;
using Ps = PolygonSet_2;
using Pwh = typename Ps::Polygon_with_holes_2;
using Pgn = typename Ps::Polygon_2;
using Pnt = typename Pgn::Point_2;

public:
SimplePolygonSet2ViewerQt(QWidget* parent, const PS2& aps2,
const char* title="Basic Polygon_set_2 Viewer") :
Base(parent, title)
Polygon_set_2_basic_viewer_qt(QWidget* parent, const Ps& ps,
const char* title = "Basic Polygon_set_2 Viewer",
bool draw_unbounded = false,
bool draw_vertices = false) :
Base(parent, title, draw_vertices),
m_ps(ps),
m_draw_unbounded(draw_unbounded)
{
std::vector<typename PS2::Polygon_with_holes_2> polygons;
aps2.polygons_with_holes(std::back_inserter(polygons));
if (ps.is_empty()) return;

// mimic the computation of Camera::pixelGLRatio()
auto bbox = bounding_box();
CGAL::qglviewer::Vec minv(bbox.xmin(), bbox.ymin(), 0);
CGAL::qglviewer::Vec maxv(bbox.xmax(), bbox.ymax(), 0);
auto diameter = (maxv - minv).norm();
m_pixel_ratio = diameter / m_height;
}

/*! Intercept the resizing of the window.
*/
virtual void resizeGL(int width, int height) {
CGAL::QGLViewer::resizeGL(width, height);
m_width = width;
m_height = height;
CGAL::qglviewer::Vec p;
auto ratio = camera()->pixelGLRatio(p);
if (ratio != m_pixel_ratio) {
m_pixel_ratio = ratio;
add_elements();
}
}

/*! Compute the elements of a polygon set.
*/
virtual void add_elements() {
clear();

std::vector<Pwh> pwhs;
m_ps.polygons_with_holes(std::back_inserter(pwhs));
for (const auto& pwh : pwhs) add_elements(pwh);
}

/*! Obtain the pixel ratio.
*/
double pixel_ratio() const { return m_pixel_ratio; }

/*! Compute the bounding box.
*/
CGAL::Bbox_2 bounding_box() {
Bbox_2 bbox;
std::vector<Pwh> pwhs;
m_ps.polygons_with_holes(std::back_inserter(pwhs));
for (const auto& pwh : pwhs) {
if (! pwh.is_unbounded()) {
bbox += pwh.outer_boundary().bbox();
continue;
}
for (auto it = pwh.holes_begin(); it != pwh.holes_end(); ++it)
bbox += it->bbox();
}
return bbox;
}

protected:
/*! Compute the elements of a polygon with holes.
*/
void add_elements(const Pwh& pwh) {
if (! m_draw_unbounded && pwh.outer_boundary().is_empty()) return;

CGAL::IO::Color c(75,160,255);
face_begin(c);

const Pnt* point_in_face;
if (pwh.outer_boundary().is_empty()) {
Pgn pgn;
pgn.push_back(Pnt(-m_width, -m_height));
pgn.push_back(Pnt(m_width, -m_height));
pgn.push_back(Pnt(m_width, m_height));
pgn.push_back(Pnt(-m_width, m_height));
compute_loop(pgn, false);
point_in_face = &(pgn.vertex(pgn.size()-1));
}
else {
const auto& outer_boundary = pwh.outer_boundary();
compute_loop(outer_boundary, false);
point_in_face = &(outer_boundary.vertex(outer_boundary.size()-1));
}

for (typename PS2::Polygon_with_holes_2& P: polygons) {
Base::compute_elements(P);
for (auto it = pwh.holes_begin(); it != pwh.holes_end(); ++it) {
compute_loop(*it, true);
add_point_in_face(*point_in_face);
}

face_end();
}

void compute_loop(const Pgn& p, bool hole) {
if (hole) add_point_in_face(p.vertex(p.size()-1));

auto prev = p.vertices_begin();
auto it = prev;
add_point(*it);
add_point_in_face(*it);
for (++it; it != p.vertices_end(); ++it) {
add_point(*it); // add vertex
add_segment(*prev, *it); // add segment with previous point
add_point_in_face(*it); // add point in face
prev = it;
}

// Add the last segment between the last point and the first one
add_segment(*prev, *(p.vertices_begin()));
}

private:
//! The window width in pixels.
int m_width = CGAL_BASIC_VIEWER_INIT_SIZE_X;

//! The window height in pixels.
int m_height = CGAL_BASIC_VIEWER_INIT_SIZE_Y;

//! The ratio between pixel and opengl units (in world coordinate system).
double m_pixel_ratio = 1;

//! The polygon set to draw.
const Ps& m_ps;

//! Indicates whether to draw unbounded polygons with holes.
bool m_draw_unbounded = false;
};

// Specialization of draw function.
template<class T, class C>
void draw(const CGAL::Polygon_set_2<T, C>& aps2,
const char* title="Polygon_set_2 Basic Viewer")
template<class T, class C, class D>
void draw(const CGAL::Polygon_set_2<T, C, D>& ps,
const char* title = "Polygon_set_2 Basic Viewer",
bool draw_vertices = false,
bool draw_unbounded = false)
{
#if defined(CGAL_TEST_SUITE)
bool cgal_test_suite=true;
bool cgal_test_suite = true;
#else
bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE");
bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE");
#endif

if (!cgal_test_suite)
{
if (! cgal_test_suite) {
using Ps = CGAL::Polygon_set_2<T, C, D>;
using Viewer = Polygon_set_2_basic_viewer_qt<Ps>;
CGAL::Qt::init_ogl_context(4,3);
int argc=1;
const char* argv[2]={"t2_viewer", nullptr};
QApplication app(argc,const_cast<char**>(argv));
SimplePolygonSet2ViewerQt<CGAL::Polygon_set_2<T, C> >
mainwindow(app.activeWindow(), aps2, title);
int argc = 1;
const char* argv[2] = {"t2_viewer", nullptr};
QApplication app(argc, const_cast<char**>(argv));
Viewer mainwindow(app.activeWindow(), ps, title, draw_unbounded, draw_vertices);
mainwindow.add_elements();
mainwindow.show();
app.exec();
}
Expand Down
4 changes: 4 additions & 0 deletions CGAL_ImageIO/include/CGAL/Image_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ class CGAL_IMAGEIO_EXPORT Image_3
float ty() const { return image_ptr->ty; }
float tz() const { return image_ptr->tz; }

float& tx(){ return image_ptr->tx; }
float& ty(){ return image_ptr->ty; }
float& tz(){ return image_ptr->tz; }

float value(const std::size_t i,
const std::size_t j,
const std::size_t k) const
Expand Down
4 changes: 2 additions & 2 deletions CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ void IpeletMesh2::protected_run(int fn)
mesher.refine_mesh();
}
else
CGAL::refine_Delaunay_mesh_2(cdt,list_of_seeds.begin(), list_of_seeds.end(),
Criteria(0.125, alpha));
CGAL::refine_Delaunay_mesh_2(cdt,
CGAL::parameters::criteria(Criteria(0.125, alpha)).seeds(list_of_seeds));


for (CDT::Finite_edges_iterator it=cdt.finite_edges_begin(); it!=cdt.finite_edges_end();++it)
Expand Down
4 changes: 2 additions & 2 deletions Circular_kernel_3/demo/Circular_kernel_3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()

find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)

find_package(Qt5 QUIET COMPONENTS Script OpenGL)
find_package(Qt5 QUIET COMPONENTS Widgets OpenGL)

if(CGAL_Qt5_FOUND AND Qt5_FOUND)

Expand All @@ -23,7 +23,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND)
add_to_cached_list(CGAL_EXECUTABLE_TARGETS Circular_kernel_3)

target_link_libraries(Circular_kernel_3 PRIVATE CGAL::CGAL CGAL::CGAL_Qt5
Qt5::OpenGL Qt5::Gui)
Qt5::Widgets Qt5::OpenGL)

include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
cgal_add_compilation_test(Circular_kernel_3)
Expand Down
Loading

0 comments on commit c74d7a3

Please sign in to comment.