mirror of https://github.com/CGAL/cgal
Merge branch 'master' into Property_map-Point_kernel_converter_map-GF
This commit is contained in:
commit
cb14375778
|
|
@ -53,7 +53,7 @@ env:
|
|||
compiler: clang-3.6
|
||||
install:
|
||||
- echo "$PWD"
|
||||
- if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$PACKAGE" != CHECK ]; then DO_IGNORE=FALSE; for ARG in $(echo "$PACKAGE");do . $PWD/.travis/test_package.sh "$PWD" "$ARG"; echo "DO_IGNORE is $DO_IGNORE"; if [ "$DO_IGNORE" = "TRUE" ]; then travis_terminate 0; fi; done;fi
|
||||
- if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$PACKAGE" != CHECK ]; then DO_IGNORE=FALSE; for ARG in $(echo "$PACKAGE");do . $PWD/.travis/test_package.sh "$PWD" "$ARG"; echo "DO_IGNORE is $DO_IGNORE"; if [ "$DO_IGNORE" = "FALSE" ]; then break; fi; done; if [ "$DO_IGNORE" = "TRUE" ]; then travis_terminate 0; fi;fi
|
||||
- bash .travis/install.sh
|
||||
- export CXX=clang++-3.6 CC=clang-3.6;
|
||||
before_script:
|
||||
|
|
@ -68,7 +68,7 @@ before_script:
|
|||
- cd ..
|
||||
script:
|
||||
- cd ./.travis
|
||||
- bash -x -e ./build_package.sh $PACKAGE
|
||||
- bash ./build_package.sh $PACKAGE
|
||||
notifications:
|
||||
email:
|
||||
on_success: change # default: always
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
[ -n "$CGAL_DEBUG_TRAVIS" ] && set -x
|
||||
|
||||
CXX_FLAGS="-DCGAL_NDEBUG"
|
||||
|
||||
|
|
@ -53,6 +54,10 @@ ROOT="$PWD/.."
|
|||
NEED_3D=0
|
||||
for ARG in $(echo "$@")
|
||||
do
|
||||
#skip package maintenance
|
||||
if [ "$ARG" = "Maintenance" ]; then
|
||||
continue
|
||||
fi
|
||||
cd $ROOT
|
||||
#install openmesh only if necessary
|
||||
if [ "$ARG" = "CHECK" ] || [ "$ARG" = BGL ] || [ "$ARG" = Convex_hull_3 ] ||\
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
[ -n "$CGAL_DEBUG_TRAVIS" ] && set -x
|
||||
DONE=0
|
||||
while [ $DONE = 0 ]
|
||||
do
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ env:
|
|||
compiler: clang-3.6
|
||||
install:
|
||||
- echo "$PWD"
|
||||
- if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$PACKAGE" != CHECK ]; then DO_IGNORE=FALSE; for ARG in $(echo "$PACKAGE");do . $PWD/.travis/test_package.sh "$PWD" "$ARG"; echo "DO_IGNORE is $DO_IGNORE"; if [ "$DO_IGNORE" = "TRUE" ]; then travis_terminate 0; fi; done;fi
|
||||
- if [ -n "$TRAVIS_PULL_REQUEST" ] && [ "$PACKAGE" != CHECK ]; then DO_IGNORE=FALSE; for ARG in $(echo "$PACKAGE");do . $PWD/.travis/test_package.sh "$PWD" "$ARG"; echo "DO_IGNORE is $DO_IGNORE"; if [ "$DO_IGNORE" = "FALSE" ]; then break; fi; done; if [ "$DO_IGNORE" = "TRUE" ]; then travis_terminate 0; fi;fi
|
||||
- bash .travis/install.sh
|
||||
- export CXX=clang++-3.6 CC=clang-3.6;
|
||||
before_script:
|
||||
|
|
@ -25,7 +25,7 @@ before_script:
|
|||
- cd ..
|
||||
script:
|
||||
- cd ./.travis
|
||||
- bash -x -e ./build_package.sh $PACKAGE
|
||||
- bash ./build_package.sh $PACKAGE
|
||||
notifications:
|
||||
email:
|
||||
on_success: change # default: always
|
||||
|
|
|
|||
|
|
@ -27,14 +27,8 @@ find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg)
|
|||
|
||||
include( ${CGAL_USE_FILE} )
|
||||
|
||||
# Find QGLViewer
|
||||
if(Qt5_FOUND)
|
||||
find_package(QGLViewer)
|
||||
endif(Qt5_FOUND)
|
||||
|
||||
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||
|
||||
include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
|
||||
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
qt5_wrap_ui( UI_FILES MainWindow.ui )
|
||||
|
||||
|
|
@ -55,20 +49,22 @@ if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
|||
"${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp" )
|
||||
|
||||
add_executable ( AABB_demo AABB_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
|
||||
add_executable ( AABB_demo AABB_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES}
|
||||
#${CGAL_Qt5_MOC_FILES}
|
||||
)
|
||||
# Link with Qt libraries
|
||||
target_link_libraries( AABB_demo PRIVATE
|
||||
Qt5::OpenGL Qt5::Gui
|
||||
Qt5::OpenGL Qt5::Gui Qt5::Xml
|
||||
CGAL::CGAL
|
||||
CGAL::CGAL_Qt5
|
||||
${QGLVIEWER_LIBRARIES})
|
||||
)
|
||||
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS AABB_demo )
|
||||
|
||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||
cgal_add_compilation_test(AABB_demo)
|
||||
|
||||
else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||
else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
set(AABB_MISSING_DEPS "")
|
||||
|
||||
|
|
@ -84,10 +80,6 @@ else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
|||
set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}")
|
||||
endif()
|
||||
|
||||
if(NOT QGLVIEWER_FOUND)
|
||||
set(AABB_MISSING_DEPS "QGLViewer, ${AABB_MISSING_DEPS}")
|
||||
endif()
|
||||
|
||||
message(STATUS "NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled.")
|
||||
|
||||
endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||
endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ void MainWindow::updateViewerBBox()
|
|||
const double xmax = bbox.xmax();
|
||||
const double ymax = bbox.ymax();
|
||||
const double zmax = bbox.zmax();
|
||||
qglviewer::Vec
|
||||
CGAL::qglviewer::Vec
|
||||
vec_min(xmin, ymin, zmin),
|
||||
vec_max(xmax, ymax, zmax);
|
||||
m_pViewer->setSceneBoundingBox(vec_min,vec_max);
|
||||
|
|
@ -411,27 +411,18 @@ void MainWindow::on_actionRefine_loop_triggered()
|
|||
|
||||
void MainWindow::on_actionSave_snapshot_triggered()
|
||||
{
|
||||
// save snapshot to file
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
QString filename = QFileDialog::getSaveFileName(this,tr("Save snapshot to file..."),"snapshot00.png","*.png");
|
||||
m_pViewer->saveSnapshot(filename);
|
||||
QApplication::restoreOverrideCursor();
|
||||
return;
|
||||
}
|
||||
void MainWindow::on_actionCopy_snapshot_triggered()
|
||||
{
|
||||
// copy snapshot to clipboard
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
QClipboard *qb = QApplication::clipboard();
|
||||
m_pViewer->makeCurrent();
|
||||
m_pViewer->raise();
|
||||
#if QGLVIEWER_VERSION >= 0x020700
|
||||
QImage snapshot = m_pViewer->grabFramebuffer();
|
||||
#else
|
||||
QImage snapshot = m_pViewer->grabFrameBuffer(true);
|
||||
|
||||
#endif
|
||||
qb->setImage(snapshot);
|
||||
QApplication::restoreOverrideCursor();
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class Refiner
|
|||
typedef typename Polyhedron::Edge_iterator Edge_iterator;
|
||||
typedef std::priority_queue<Edge,
|
||||
std::vector<Edge>,
|
||||
less<Edge> > PQueue;
|
||||
::less<Edge> > PQueue;
|
||||
// data
|
||||
PQueue m_queue;
|
||||
Polyhedron* m_pMesh;
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ void Scene::compute_texture(int i, int j,Color_ramp pos_ramp ,Color_ramp neg_ram
|
|||
|
||||
}
|
||||
|
||||
void Scene::attrib_buffers(QGLViewer* viewer)
|
||||
void Scene::attrib_buffers(CGAL::QGLViewer* viewer)
|
||||
{
|
||||
QMatrix4x4 mvpMatrix;
|
||||
double mat[16];
|
||||
|
|
@ -589,7 +589,7 @@ void Scene::update_bbox()
|
|||
<< " facets)" << std::endl;
|
||||
}
|
||||
|
||||
void Scene::draw(QGLViewer* viewer)
|
||||
void Scene::draw(CGAL::QGLViewer* viewer)
|
||||
{
|
||||
if(!gl_init)
|
||||
initGL();
|
||||
|
|
@ -766,8 +766,8 @@ Plane Scene::random_plane(const CGAL::Bbox_3& bbox)
|
|||
|
||||
Plane Scene::frame_plane() const
|
||||
{
|
||||
const qglviewer::Vec& pos = m_frame->position();
|
||||
const qglviewer::Vec& n = m_frame->inverseTransformOf(qglviewer::Vec(0.f, 0.f, 1.f));
|
||||
const CGAL::qglviewer::Vec& pos = m_frame->position();
|
||||
const CGAL::qglviewer::Vec& n = m_frame->inverseTransformOf(CGAL::qglviewer::Vec(0.f, 0.f, 1.f));
|
||||
|
||||
return Plane(n[0], n[1], n[2], - n * pos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,8 @@
|
|||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QMap>
|
||||
#include <QGLViewer/manipulatedFrame.h>
|
||||
#include <QGLViewer/qglviewer.h>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <CGAL/Qt/manipulatedFrame.h>
|
||||
#include <CGAL/Qt/qglviewer.h>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
|
@ -71,7 +70,7 @@ private:
|
|||
typedef CGAL::AABB_traits<Kernel, Edge_Primitive> Edge_Traits;
|
||||
typedef CGAL::AABB_tree<Edge_Traits> Edge_tree;
|
||||
|
||||
typedef qglviewer::ManipulatedFrame ManipulatedFrame;
|
||||
typedef CGAL::qglviewer::ManipulatedFrame ManipulatedFrame;
|
||||
|
||||
enum Cut_planes_types {
|
||||
NONE, UNSIGNED_FACETS, SIGNED_FACETS, UNSIGNED_EDGES, CUT_SEGMENTS
|
||||
|
|
@ -79,7 +78,7 @@ private:
|
|||
|
||||
public:
|
||||
QGLContext* context;
|
||||
void draw(QGLViewer*);
|
||||
void draw(CGAL::QGLViewer*);
|
||||
void update_bbox();
|
||||
Bbox bbox() { return m_bbox; }
|
||||
ManipulatedFrame* manipulatedFrame() const { return m_frame; }
|
||||
|
|
@ -171,7 +170,7 @@ private:
|
|||
QOpenGLShaderProgram rendering_program;
|
||||
void initialize_buffers();
|
||||
void compute_elements(int mode);
|
||||
void attrib_buffers(QGLViewer*);
|
||||
void attrib_buffers(CGAL::QGLViewer*);
|
||||
void compile_shaders();
|
||||
void compute_texture(int, int, Color_ramp, Color_ramp);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <CGAL/Qt/CreateOpenGLContext.h>
|
||||
|
||||
Viewer::Viewer(QWidget* parent)
|
||||
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent),
|
||||
: CGAL::QGLViewer(parent),
|
||||
m_pScene(NULL),
|
||||
m_custom_mouse(false)
|
||||
{
|
||||
|
|
@ -18,7 +18,7 @@ void Viewer::setScene(Scene* pScene)
|
|||
|
||||
void Viewer::draw()
|
||||
{
|
||||
QGLViewer::draw();
|
||||
CGAL::QGLViewer::draw();
|
||||
if(m_pScene != NULL)
|
||||
{
|
||||
m_pScene->draw(this);
|
||||
|
|
@ -28,7 +28,7 @@ void Viewer::draw()
|
|||
|
||||
void Viewer::initializeGL()
|
||||
{
|
||||
QGLViewer::initializeGL();
|
||||
CGAL::QGLViewer::initializeGL();
|
||||
setBackgroundColor(::Qt::white);
|
||||
//m_pScene->initGL(this);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ void Viewer::mousePressEvent(QMouseEvent* e)
|
|||
m_custom_mouse = true;
|
||||
}
|
||||
|
||||
QGLViewer::mousePressEvent(e);
|
||||
CGAL::QGLViewer::mousePressEvent(e);
|
||||
}
|
||||
|
||||
void Viewer::mouseReleaseEvent(QMouseEvent* e)
|
||||
|
|
@ -59,6 +59,6 @@ void Viewer::mouseReleaseEvent(QMouseEvent* e)
|
|||
m_custom_mouse = false;
|
||||
}
|
||||
|
||||
QGLViewer::mouseReleaseEvent(e);
|
||||
CGAL::QGLViewer::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
#ifndef VIEWER_H
|
||||
#define VIEWER_H
|
||||
#include <QMap>
|
||||
#include <QGLViewer/qglviewer.h>
|
||||
#include <CGAL/Qt/qglviewer.h>
|
||||
|
||||
|
||||
// forward declarations
|
||||
class QWidget;
|
||||
class Scene;
|
||||
class Viewer : public QGLViewer{
|
||||
class Viewer : public CGAL::QGLViewer{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Viewer(QWidget * parent);
|
||||
|
||||
// overload several QGLViewer virtual functions
|
||||
// overload several CGAL::QGLViewer virtual functions
|
||||
void draw();
|
||||
void initializeGL();
|
||||
void setScene(Scene* pScene);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ typedef unspecified_type Construct_sphere_3;
|
|||
|
||||
/*!
|
||||
A functor object to compute the point on a geometric primitive which is closest from a query. Provides the operator:
|
||||
`Point_3 operator()(const Type_2& type_2, const Point_3& p);` where `Type_2` is any type among `Segment_3` and `Triangle_3`. The operator returns the point on `type_2` which is closest to `p`.
|
||||
`Point_3 operator()(const Type_2& type_2, const Point_3& p);` where `Type_2` can be any of the following types : `Segment_3`, `Ray_3`, or `Triangle_3`.
|
||||
The operator returns the point on `type_2` which is closest to `p`.
|
||||
*/
|
||||
typedef unspecified_type Construct_projected_point_3;
|
||||
|
||||
|
|
|
|||
|
|
@ -291,7 +291,8 @@ public:
|
|||
*/
|
||||
class Sort_primitives
|
||||
{
|
||||
const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& m_traits;
|
||||
typedef AABB_traits<GeomTraits,AABBPrimitive,BboxMap> Traits;
|
||||
const Traits& m_traits;
|
||||
public:
|
||||
Sort_primitives(const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& traits)
|
||||
: m_traits(traits) {}
|
||||
|
|
@ -302,16 +303,16 @@ public:
|
|||
const typename AT::Bounding_box& bbox) const
|
||||
{
|
||||
PrimitiveIterator middle = first + (beyond - first)/2;
|
||||
switch(longest_axis(bbox))
|
||||
switch(Traits::longest_axis(bbox))
|
||||
{
|
||||
case AT::CGAL_AXIS_X: // sort along x
|
||||
std::nth_element(first, middle, beyond, boost::bind(less_x,_1,_2,m_traits));
|
||||
std::nth_element(first, middle, beyond, boost::bind(Traits::less_x,_1,_2,m_traits));
|
||||
break;
|
||||
case AT::CGAL_AXIS_Y: // sort along y
|
||||
std::nth_element(first, middle, beyond, boost::bind(less_y,_1,_2,m_traits));
|
||||
std::nth_element(first, middle, beyond, boost::bind(Traits::less_y,_1,_2,m_traits));
|
||||
break;
|
||||
case AT::CGAL_AXIS_Z: // sort along z
|
||||
std::nth_element(first, middle, beyond, boost::bind(less_z,_1,_2,m_traits));
|
||||
std::nth_element(first, middle, beyond, boost::bind(Traits::less_z,_1,_2,m_traits));
|
||||
break;
|
||||
default:
|
||||
CGAL_error();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <CGAL/AABB_face_graph_triangle_primitive.h>
|
||||
#include <CGAL/AABB_halfedge_graph_segment_primitive.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
#include <CGAL/AABB_traits.h>
|
||||
|
||||
#include <CGAL/AABB_face_graph_triangle_primitive.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
#include "AABB_test_util.h"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/AABB_face_graph_triangle_primitive.h>
|
||||
#include <CGAL/Timer.h>
|
||||
|
|
|
|||
|
|
@ -201,7 +201,9 @@ public:
|
|||
|
||||
|
||||
}; // class Algebraic_real_traits
|
||||
|
||||
|
||||
struct Construct_algebraic_real_1;
|
||||
|
||||
// Functors of Algebraic_kernel_d_1
|
||||
struct Solve_1 {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace internal {
|
|||
//
|
||||
template < class Input_traits, class Kernel_approx, class Kernel_exact,
|
||||
class Weighted_tag >
|
||||
class Is_traits_point_convertible
|
||||
class Is_traits_point_convertible_2
|
||||
{
|
||||
typedef typename Kernel_traits<typename Input_traits::Point_2>::Kernel Kernel_input;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ public:
|
|||
};
|
||||
|
||||
template < class Input_traits, class Kernel_approx, class Kernel_exact >
|
||||
class Is_traits_point_convertible<Input_traits, Kernel_approx, Kernel_exact,
|
||||
class Is_traits_point_convertible_2<Input_traits, Kernel_approx, Kernel_exact,
|
||||
::CGAL::Tag_true /* Weighted_tag */>
|
||||
{
|
||||
typedef typename Kernel_traits<typename Input_traits::Point_2>::Kernel Kernel_input;
|
||||
|
|
@ -157,7 +157,7 @@ class Lazy_alpha_nt_2
|
|||
Approx_point to_approx(const Input_point& wp) const
|
||||
{
|
||||
// The traits class' Point_2 must be convertible using the Cartesian converter
|
||||
CGAL_static_assertion((Is_traits_point_convertible<
|
||||
CGAL_static_assertion((Is_traits_point_convertible_2<
|
||||
Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value));
|
||||
|
||||
To_approx converter;
|
||||
|
|
@ -167,7 +167,7 @@ class Lazy_alpha_nt_2
|
|||
Exact_point to_exact(const Input_point& wp) const
|
||||
{
|
||||
// The traits class' Point_2 must be convertible using the Cartesian converter
|
||||
CGAL_static_assertion((Is_traits_point_convertible<
|
||||
CGAL_static_assertion((Is_traits_point_convertible_2<
|
||||
Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value));
|
||||
|
||||
To_exact converter;
|
||||
|
|
|
|||
|
|
@ -21,15 +21,11 @@ include(${CGAL_USE_FILE})
|
|||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||
|
||||
find_package(QGLViewer)
|
||||
|
||||
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND )
|
||||
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
|
||||
|
||||
add_definitions(-DQT_NO_KEYWORDS)
|
||||
|
||||
# include(${QT_USE_FILE})
|
||||
|
||||
include_directories (${QGLVIEWER_INCLUDE_DIR})
|
||||
include_directories (BEFORE ../../include ./ )
|
||||
|
||||
# ui file, created wih Qt Designer
|
||||
|
|
@ -43,14 +39,13 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND )
|
|||
|
||||
target_link_libraries( Alpha_shape_3 PRIVATE
|
||||
CGAL::CGAL CGAL::CGAL_Qt5
|
||||
Qt5::OpenGL Qt5::Gui
|
||||
${QGLVIEWER_LIBRARIES} )
|
||||
Qt5::OpenGL Qt5::Gui )
|
||||
|
||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||
cgal_add_compilation_test(Alpha_shape_3)
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, and Qt5, and will not be compiled.")
|
||||
message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include "Viewer.h"
|
||||
#include <vector>
|
||||
#include <CGAL/bounding_box.h>
|
||||
#include <QGLViewer/vec.h>
|
||||
#include <CGAL/Qt/vec.h>
|
||||
#include "CGAL/Qt/CreateOpenGLContext.h"
|
||||
|
||||
Viewer::Viewer(QWidget* parent)
|
||||
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent)
|
||||
: CGAL::QGLViewer(parent)
|
||||
{
|
||||
are_buffers_initialized = false;
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ void Viewer::initialize_buffers()
|
|||
}
|
||||
|
||||
|
||||
void Viewer::attrib_buffers(QGLViewer* viewer)
|
||||
void Viewer::attrib_buffers(CGAL::QGLViewer* viewer)
|
||||
{
|
||||
QMatrix4x4 mvpMatrix;
|
||||
QMatrix4x4 mvMatrix;
|
||||
|
|
@ -261,7 +261,7 @@ void Viewer::attrib_buffers(QGLViewer* viewer)
|
|||
|
||||
void Viewer::initializeGL()
|
||||
{
|
||||
QGLViewer::initializeGL();
|
||||
CGAL::QGLViewer::initializeGL();
|
||||
compile_shaders();
|
||||
}
|
||||
|
||||
|
|
@ -272,8 +272,8 @@ Viewer::sceneChanged()
|
|||
|
||||
Iso_cuboid_3 bb = CGAL::bounding_box(scene->points.begin(), scene->points.end());
|
||||
|
||||
this->camera()->setSceneBoundingBox(qglviewer::Vec(bb.xmin(), bb.ymin(), bb.zmin()),
|
||||
qglviewer::Vec(bb.xmax(),
|
||||
this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(bb.xmin(), bb.ymin(), bb.zmin()),
|
||||
CGAL::qglviewer::Vec(bb.xmax(),
|
||||
bb.ymax(),
|
||||
bb.zmax()));
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
#include "typedefs.h"
|
||||
#include <QMap>
|
||||
#include <QGLViewer/qglviewer.h>
|
||||
#include <CGAL/Qt/qglviewer.h>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
|
||||
class Viewer : public QGLViewer, protected QOpenGLFunctions_2_1{
|
||||
class Viewer : public CGAL::QGLViewer{
|
||||
Q_OBJECT
|
||||
|
||||
CGAL::Timer timer;
|
||||
|
|
@ -61,7 +61,7 @@ private:
|
|||
QOpenGLShaderProgram rendering_program_points;
|
||||
void initialize_buffers();
|
||||
void compute_elements();
|
||||
void attrib_buffers(QGLViewer*);
|
||||
void attrib_buffers(CGAL::QGLViewer*);
|
||||
void compile_shaders();
|
||||
public Q_SLOTS:
|
||||
void initializeGL();
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace internal{
|
|||
//
|
||||
template < class Input_traits, class Kernel_approx, class Kernel_exact,
|
||||
class Weighted_tag >
|
||||
class Is_traits_point_convertible
|
||||
class Is_traits_point_convertible_3
|
||||
{
|
||||
typedef typename Kernel_traits<typename Input_traits::Point_3>::Kernel Kernel_input;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ public:
|
|||
};
|
||||
|
||||
template < class Input_traits, class Kernel_approx, class Kernel_exact >
|
||||
class Is_traits_point_convertible<Input_traits, Kernel_approx, Kernel_exact,
|
||||
class Is_traits_point_convertible_3<Input_traits, Kernel_approx, Kernel_exact,
|
||||
::CGAL::Tag_true /* Weighted_tag */>
|
||||
{
|
||||
typedef typename Kernel_traits<typename Input_traits::Point_3>::Kernel Kernel_input;
|
||||
|
|
@ -148,7 +148,7 @@ class Lazy_alpha_nt_3{
|
|||
Approx_point to_approx(const Input_point& wp) const
|
||||
{
|
||||
// The traits class' Point_3 must be convertible using the Cartesian converter
|
||||
CGAL_static_assertion((Is_traits_point_convertible<
|
||||
CGAL_static_assertion((Is_traits_point_convertible_3<
|
||||
Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value));
|
||||
|
||||
To_approx converter;
|
||||
|
|
@ -158,7 +158,7 @@ class Lazy_alpha_nt_3{
|
|||
Exact_point to_exact(const Input_point& wp) const
|
||||
{
|
||||
// The traits class' Point_3 must be convertible using the Cartesian converter
|
||||
CGAL_static_assertion((Is_traits_point_convertible<
|
||||
CGAL_static_assertion((Is_traits_point_convertible_3<
|
||||
Input_traits, Kernel_approx, Kernel_exact, Weighted_tag>::value));
|
||||
|
||||
To_exact converter;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
* The header file for the Arr_circle_segment_traits_2<Kenrel> class.
|
||||
*/
|
||||
|
||||
#include <CGAL/atomic.h>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
#include <CGAL/Arr_geometry_traits/Circle_segment_2.h>
|
||||
|
|
@ -84,7 +85,11 @@ public:
|
|||
/*! Get the next curve index. */
|
||||
static unsigned int get_index ()
|
||||
{
|
||||
static unsigned int index = 0;
|
||||
#ifdef CGAL_NO_ATOMIC
|
||||
static unsigned int index;
|
||||
#else
|
||||
static CGAL::cpp11::atomic<unsigned int> index;
|
||||
#endif
|
||||
return (++index);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
* The conic traits-class for the arrangement package.
|
||||
*/
|
||||
|
||||
#include <CGAL/atomic.h>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
#include <CGAL/Arr_geometry_traits/Conic_arc_2.h>
|
||||
|
|
@ -114,7 +115,11 @@ public:
|
|||
/*! Get the next conic index. */
|
||||
static unsigned int get_index ()
|
||||
{
|
||||
static unsigned int index = 0;
|
||||
#ifdef CGAL_NO_ATOMIC
|
||||
static unsigned int index;
|
||||
#else
|
||||
static CGAL::cpp11::atomic<unsigned int> index;
|
||||
#endif
|
||||
return (++index);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@
|
|||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
|
||||
// updated by: Michal Balas <balasmic@post.tau.ac.il>
|
||||
// Author(s): Oren Nechushtan <theoren@math.tau.ac.il>
|
||||
// Michal Balas <balasmic@post.tau.ac.il>
|
||||
// Efi Fogel <efifogel@gmail.com>
|
||||
|
||||
#ifndef CGAL_TD_ACTIVE_FICTITIOUS_VERTEX_H
|
||||
#define CGAL_TD_ACTIVE_FICTITIOUS_VERTEX_H
|
||||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Defintion of the Td_active_fictitious_vertex<Td_traits> class.
|
||||
*/
|
||||
|
|
@ -33,7 +33,6 @@
|
|||
#include <boost/variant.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
||||
#ifdef CGAL_TD_DEBUG
|
||||
#define CGAL_TD_INLINE
|
||||
#else
|
||||
|
|
@ -46,63 +45,61 @@ namespace CGAL {
|
|||
* Implementation of a pseudo-trapezoid as two halfedges(top,bottom)
|
||||
* and two curve-ends(left,right).
|
||||
* Trapezoids are represented as two curve-ends called right and left and
|
||||
* two halfedges called top and bottom. The curve-ends (points) lie on the
|
||||
* right and left boundaries of the trapezoid respectively and the halfedges
|
||||
* two halfedges called top and bottom. The curve-ends (points) lie on the
|
||||
* right and left boundaries of the trapezoid respectively and the halfedges
|
||||
* bound the trapezoid from above and below.
|
||||
* There exist degenerate trapezoids called infinite trapezoid; this happens
|
||||
* There exist degenerate trapezoids called infinite trapezoid; this happens
|
||||
* when one of the four sides is on the parameter space boundary.
|
||||
* Trapezoids are created as active and become inactive when Remove() member
|
||||
* function called.
|
||||
* Each trapezoid has at most four neighbouring trapezoids.
|
||||
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
|
||||
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
|
||||
* edge-end (end point).
|
||||
*/
|
||||
template <class Td_traits_>
|
||||
class Td_active_fictitious_vertex : public Handle
|
||||
{
|
||||
template <typename Td_traits_>
|
||||
class Td_active_fictitious_vertex : public Handle {
|
||||
public:
|
||||
|
||||
|
||||
//type of traits class
|
||||
typedef Td_traits_ Traits;
|
||||
|
||||
typedef Td_traits_ Traits;
|
||||
|
||||
//type of point (Point_2)
|
||||
typedef typename Traits::Point Point;
|
||||
typedef typename Traits::Point Point;
|
||||
|
||||
//type of X_monotone_curve_2
|
||||
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
//type of Curve_end
|
||||
typedef typename Traits::Curve_end Curve_end;
|
||||
|
||||
typedef typename Traits::Curve_end Curve_end;
|
||||
|
||||
//type of Halfedge_const_handle (trapezoid edge)
|
||||
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
|
||||
|
||||
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
|
||||
|
||||
//type of Vertex_const_handle (trapezoid vertex)
|
||||
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
|
||||
|
||||
//type of Halfedge_around_vertex_const_circulator
|
||||
typedef typename Traits::Halfedge_around_vertex_const_circulator
|
||||
typedef typename Traits::Halfedge_around_vertex_const_circulator
|
||||
Halfedge_around_vertex_const_circulator;
|
||||
|
||||
//type of Td_active_fictitious_vertex (Self)
|
||||
typedef typename Traits::Td_active_fictitious_vertex Self;
|
||||
|
||||
typedef typename Traits::Td_map_item Td_map_item;
|
||||
typedef typename Traits::Td_active_fictitious_vertex Self;
|
||||
|
||||
typedef typename Traits::Td_map_item Td_map_item;
|
||||
|
||||
//type of Trapezoidal decomposition
|
||||
typedef Trapezoidal_decomposition_2<Traits> TD;
|
||||
|
||||
typedef Trapezoidal_decomposition_2<Traits> TD;
|
||||
|
||||
//type of In face iterator
|
||||
typedef typename TD::In_face_iterator In_face_iterator;
|
||||
typedef typename TD::In_face_iterator In_face_iterator;
|
||||
|
||||
//type of Trapezoidal map search structure
|
||||
typedef typename TD::Dag_node Dag_node;
|
||||
|
||||
typedef typename TD::Dag_node Dag_node;
|
||||
|
||||
//friend class declarations:
|
||||
|
||||
friend class Trapezoidal_decomposition_2<Traits>;
|
||||
|
||||
|
||||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
|
|
@ -113,199 +110,146 @@ public:
|
|||
#else
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*! \class
|
||||
* Inner class Data derived from Rep class
|
||||
*/
|
||||
class Data : public Rep
|
||||
{
|
||||
* Inner class Data derived from Rep class
|
||||
*/
|
||||
class Data : public Rep {
|
||||
friend class Td_active_fictitious_vertex<Td_traits_>;
|
||||
|
||||
public:
|
||||
//c'tors
|
||||
Data (Vertex_const_handle _v,
|
||||
Halfedge_const_handle _cw_he,
|
||||
Dag_node* _p_node)
|
||||
: v(_v),cw_he(_cw_he),p_node(_p_node)
|
||||
{ }
|
||||
|
||||
~Data() { }
|
||||
Data(Vertex_const_handle _v, Halfedge_const_handle _cw_he,
|
||||
Dag_node* _p_node) :
|
||||
v(_v), cw_he(_cw_he), p_node(_p_node)
|
||||
{}
|
||||
|
||||
~Data() {}
|
||||
|
||||
protected:
|
||||
Vertex_const_handle v;
|
||||
Vertex_const_handle v;
|
||||
Halfedge_const_handle cw_he; //holds the first edge going cw starting at 12 o'clock
|
||||
Dag_node* p_node;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Data* ptr() const { return (Data*)(PTR); }
|
||||
|
||||
|
||||
private:
|
||||
Data* ptr() const { return (Data*)(PTR); }
|
||||
|
||||
Curve_end vtx_to_ce(Vertex_const_handle v) const
|
||||
{
|
||||
//the circulator is of incoming halfedges
|
||||
Halfedge_around_vertex_const_circulator he = v->incident_halfedges();
|
||||
Halfedge_around_vertex_const_circulator he = v->incident_halfedges();
|
||||
//if the vertex is associated with a point on the bounded coords,
|
||||
// we can take any incident halfedge. o/w if the vertex lies at infinity,
|
||||
// it has 2 fictitious incident halfedges
|
||||
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
|
||||
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
|
||||
|
||||
return Curve_end(he->curve(),
|
||||
(he->direction() == ARR_RIGHT_TO_LEFT)?
|
||||
ARR_MIN_END : ARR_MAX_END);
|
||||
return Curve_end(he->curve(), ((he->direction() == ARR_RIGHT_TO_LEFT) ?
|
||||
ARR_MIN_END : ARR_MAX_END));
|
||||
}
|
||||
|
||||
|
||||
#ifndef CGAL_TD_DEBUG
|
||||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
protected:
|
||||
protected:
|
||||
#else
|
||||
public: // workaround
|
||||
public: // workaround
|
||||
#endif
|
||||
#else //CGAL_TD_DEBUG
|
||||
public:
|
||||
public:
|
||||
#endif //CGAL_TD_DEBUG
|
||||
|
||||
|
||||
/*! Set the DAG node. */
|
||||
inline void set_dag_node(Dag_node* p)
|
||||
{
|
||||
ptr()->p_node = p;
|
||||
}
|
||||
|
||||
inline void set_dag_node(Dag_node* p) { ptr()->p_node = p; }
|
||||
|
||||
/*! Set the vertex handle (Vertex_const_handle). */
|
||||
inline void set_vertex(Vertex_const_handle v)
|
||||
inline void set_vertex(Vertex_const_handle v) { ptr()->v = v; }
|
||||
|
||||
/*! Set the first he going clockwise starting at 12 o'clock.
|
||||
*/
|
||||
inline void set_cw_he(Halfedge_const_handle he)
|
||||
{
|
||||
ptr()->v = v;
|
||||
}
|
||||
|
||||
/*! Set the first he going clockwise starting at 12 o'clock (Halfedge_const_handle). */
|
||||
inline void set_cw_he(Halfedge_const_handle he)
|
||||
{
|
||||
if (cw_he() != Traits::empty_he_handle() &&
|
||||
cw_he()->direction() != he->direction())
|
||||
{
|
||||
ptr()->cw_he = he->twin();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr()->cw_he = he;
|
||||
}
|
||||
ptr()->cw_he = ((cw_he() != Traits::empty_he_handle()) &&
|
||||
(cw_he()->direction() != he->direction())) ?
|
||||
he->twin() : he;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/*! Reset the first he going clockwise starting at 12 o'clock.
|
||||
*/
|
||||
inline void reset_cw_he() { ptr()->cw_he = Traits::empty_he_handle(); }
|
||||
|
||||
public:
|
||||
/// \name Constructors.
|
||||
//@{
|
||||
|
||||
Td_active_fictitious_vertex ()
|
||||
Td_active_fictitious_vertex()
|
||||
{
|
||||
PTR = new Data
|
||||
(Traits::empty_vtx_handle(), Traits::empty_he_handle(), NULL);
|
||||
PTR = new Data(Traits::empty_vtx_handle(), Traits::empty_he_handle(), NULL);
|
||||
}
|
||||
|
||||
|
||||
/*! Constructor given Vertex & Halfedge handles. */
|
||||
Td_active_fictitious_vertex (Vertex_const_handle v,
|
||||
Halfedge_const_handle cw_he,
|
||||
Dag_node* node = 0)
|
||||
|
||||
|
||||
{
|
||||
PTR = new Data(v, cw_he, node);
|
||||
}
|
||||
|
||||
|
||||
Td_active_fictitious_vertex(Vertex_const_handle v,
|
||||
Halfedge_const_handle cw_he,
|
||||
Dag_node* node = 0)
|
||||
{ PTR = new Data(v, cw_he, node); }
|
||||
|
||||
|
||||
/*! Copy constructor. */
|
||||
Td_active_fictitious_vertex (const Self& tr) : Handle(tr)
|
||||
{
|
||||
}
|
||||
|
||||
Td_active_fictitious_vertex (const Self& tr) : Handle(tr) {}
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/// \name Operator overloading.
|
||||
//@{
|
||||
|
||||
/*! Assignment operator.
|
||||
* operator= should not copy m_dag_node (or otherwise update
|
||||
/*! Assignment operator.
|
||||
* operator= should not copy m_dag_node (or otherwise update
|
||||
* Dag_node::replace)
|
||||
*/
|
||||
inline Self& operator= (const Self& t2)
|
||||
inline Self& operator=(const Self& t2)
|
||||
{
|
||||
Handle::operator=(t2);
|
||||
return *this;
|
||||
Handle::operator=(t2);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*! Operator==. */
|
||||
inline bool operator== (const Self& t2) const
|
||||
{
|
||||
return (ptr() == t2.ptr());
|
||||
}
|
||||
inline bool operator==(const Self& t2) const { return (ptr() == t2.ptr()); }
|
||||
|
||||
/*! Operator!=. */
|
||||
inline bool operator!= (const Self& t2) const
|
||||
{
|
||||
return !(operator==(t2));
|
||||
}
|
||||
inline bool operator!=(const Self& t2) const { return !(operator==(t2)); }
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/// \name Access methods.
|
||||
//@{
|
||||
|
||||
inline Self& self()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const Self& self() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
inline Self& self() { return *this; }
|
||||
|
||||
inline const Self& self() const { return *this; }
|
||||
|
||||
/*! Access the trapezoid id (PTR). */
|
||||
inline unsigned long id() const
|
||||
{
|
||||
return (unsigned long) PTR;
|
||||
}
|
||||
inline unsigned long id() const { return (unsigned long) PTR; }
|
||||
|
||||
/*! Access trapezoid left.
|
||||
* filters out the infinite case which returns predefined dummy values
|
||||
*/
|
||||
inline Vertex_const_handle vertex() const
|
||||
{
|
||||
return ptr()->v;
|
||||
}
|
||||
/*! Access trapezoid left.
|
||||
* filters out the infinite case which returns predefined dummy values
|
||||
*/
|
||||
inline Vertex_const_handle vertex() const { return ptr()->v; }
|
||||
|
||||
Curve_end curve_end() const
|
||||
{
|
||||
return vtx_to_ce(vertex());
|
||||
}
|
||||
Curve_end curve_end() const { return vtx_to_ce(vertex()); }
|
||||
|
||||
/*! Access the first he starting at 12 o'clock clockwise.
|
||||
*/
|
||||
inline Halfedge_const_handle cw_he() const { return ptr()->cw_he; }
|
||||
|
||||
/*! Access the first he starting at 12 o'clock clockwise.
|
||||
*/
|
||||
inline Halfedge_const_handle cw_he () const
|
||||
{
|
||||
return ptr()->cw_he;
|
||||
}
|
||||
|
||||
|
||||
/*! Access DAG node. */
|
||||
Dag_node* dag_node() const {return ptr()->p_node; } //m_dag_node;}
|
||||
|
||||
|
||||
Dag_node* dag_node() const { return ptr()->p_node; } //m_dag_node;}
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@
|
|||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
|
||||
// updated by: Michal Balas <balasmic@post.tau.ac.il>
|
||||
// Author(s): Oren Nechushtan <theoren@math.tau.ac.il>
|
||||
// Michal Balas <balasmic@post.tau.ac.il>
|
||||
// Efi Fogel <efifogel@gmail.com>
|
||||
|
||||
#ifndef CGAL_TD_ACTIVE_VERTEX_H
|
||||
#define CGAL_TD_ACTIVE_VERTEX_H
|
||||
|
||||
#include <CGAL/license/Arrangement_on_surface_2.h>
|
||||
|
||||
|
||||
/*! \file
|
||||
* Defintion of the Td_active_vertex<Td_traits> class.
|
||||
*/
|
||||
|
|
@ -46,63 +46,62 @@ namespace CGAL {
|
|||
* Implementation of a pseudo-trapezoid as two halfedges(top,bottom)
|
||||
* and two curve-ends(left,right).
|
||||
* Trapezoids are represented as two curve-ends called right and left and
|
||||
* two halfedges called top and bottom. The curve-ends (points) lie on the
|
||||
* right and left boundaries of the trapezoid respectively and the halfedges
|
||||
* two halfedges called top and bottom. The curve-ends (points) lie on the
|
||||
* right and left boundaries of the trapezoid respectively and the halfedges
|
||||
* bound the trapezoid from above and below.
|
||||
* There exist degenerate trapezoids called infinite trapezoid; this happens
|
||||
* There exist degenerate trapezoids called infinite trapezoid; this happens
|
||||
* when one of the four sides is on the parameter space boundary.
|
||||
* Trapezoids are created as active and become inactive when Remove() member
|
||||
* function called.
|
||||
* Each trapezoid has at most four neighbouring trapezoids.
|
||||
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
|
||||
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
|
||||
* edge-end (end point).
|
||||
*/
|
||||
template <class Td_traits_>
|
||||
class Td_active_vertex : public Handle
|
||||
{
|
||||
public:
|
||||
|
||||
template <typename Td_traits_>
|
||||
class Td_active_vertex : public Handle {
|
||||
public:
|
||||
|
||||
//type of traits class
|
||||
typedef Td_traits_ Traits;
|
||||
|
||||
typedef Td_traits_ Traits;
|
||||
|
||||
//type of point (Point_2)
|
||||
typedef typename Traits::Point Point;
|
||||
typedef typename Traits::Point Point;
|
||||
|
||||
//type of X_monotone_curve_2
|
||||
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
//type of Curve_end
|
||||
typedef typename Traits::Curve_end Curve_end;
|
||||
typedef typename Traits::Curve_end Curve_end;
|
||||
|
||||
//type of Halfedge_const_handle (trapezoid edge)
|
||||
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
|
||||
|
||||
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
|
||||
|
||||
//type of Vertex_const_handle (trapezoid vertex)
|
||||
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
|
||||
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
|
||||
|
||||
//type of Halfedge_around_vertex_const_circulator
|
||||
typedef typename Traits::Halfedge_around_vertex_const_circulator
|
||||
typedef typename Traits::Halfedge_around_vertex_const_circulator
|
||||
Halfedge_around_vertex_const_circulator;
|
||||
|
||||
//type of Td_active_vertex (Self)
|
||||
typedef typename Traits::Td_active_vertex Self;
|
||||
|
||||
typedef typename Traits::Td_map_item Td_map_item;
|
||||
typedef typename Traits::Td_active_vertex Self;
|
||||
|
||||
typedef typename Traits::Td_map_item Td_map_item;
|
||||
|
||||
//type of Trapezoidal decomposition
|
||||
typedef Trapezoidal_decomposition_2<Traits> TD;
|
||||
|
||||
typedef Trapezoidal_decomposition_2<Traits> TD;
|
||||
|
||||
//type of In face iterator
|
||||
typedef typename TD::In_face_iterator In_face_iterator;
|
||||
typedef typename TD::In_face_iterator In_face_iterator;
|
||||
|
||||
//type of Trapezoidal map search structure
|
||||
typedef typename TD::Dag_node Dag_node;
|
||||
typedef typename TD::Dag_node Dag_node;
|
||||
|
||||
|
||||
//friend class declarations:
|
||||
|
||||
friend class Trapezoidal_decomposition_2<Traits>;
|
||||
|
||||
|
||||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
|
|
@ -113,201 +112,145 @@ class Td_active_vertex : public Handle
|
|||
#else
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*! \class
|
||||
* Inner class Data derived from Rep class
|
||||
*/
|
||||
class Data : public Rep
|
||||
{
|
||||
* Inner class Data derived from Rep class
|
||||
*/
|
||||
class Data : public Rep {
|
||||
friend class Td_active_vertex<Td_traits_>;
|
||||
|
||||
public:
|
||||
//c'tors
|
||||
Data (Vertex_const_handle _v,
|
||||
Halfedge_const_handle _cw_he,
|
||||
Dag_node* _p_node)
|
||||
: v(_v),cw_he(_cw_he),p_node(_p_node)
|
||||
{ }
|
||||
|
||||
~Data() { }
|
||||
Data(Vertex_const_handle _v, Halfedge_const_handle _cw_he,
|
||||
Dag_node* _p_node) :
|
||||
v(_v), cw_he(_cw_he), p_node(_p_node)
|
||||
{}
|
||||
|
||||
~Data() {}
|
||||
|
||||
protected:
|
||||
Vertex_const_handle v;
|
||||
Vertex_const_handle v;
|
||||
Halfedge_const_handle cw_he; //holds the first edge going cw starting at 12 o'clock
|
||||
Dag_node* p_node;
|
||||
Dag_node* p_node;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Data* ptr() const { return (Data*)(PTR); }
|
||||
|
||||
private:
|
||||
Data* ptr() const { return (Data*)(PTR); }
|
||||
|
||||
Curve_end vtx_to_ce(Vertex_const_handle v) const
|
||||
{
|
||||
//the circulator is of incoming halfedges
|
||||
Halfedge_around_vertex_const_circulator he = v->incident_halfedges();
|
||||
Halfedge_around_vertex_const_circulator he = v->incident_halfedges();
|
||||
//if the vertex is associated with a point on the bounded coords,
|
||||
// we can take any incident halfedge. o/w if the vertex lies at infinity,
|
||||
// it has 2 fictitious incident halfedges
|
||||
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
|
||||
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
|
||||
|
||||
return Curve_end(he->curve(),
|
||||
(he->direction() == ARR_RIGHT_TO_LEFT)?
|
||||
ARR_MIN_END : ARR_MAX_END);
|
||||
return Curve_end(he->curve(), ((he->direction() == ARR_RIGHT_TO_LEFT) ?
|
||||
ARR_MIN_END : ARR_MAX_END));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef CGAL_TD_DEBUG
|
||||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
protected:
|
||||
protected:
|
||||
#else
|
||||
public: // workaround
|
||||
public: // workaround
|
||||
#endif
|
||||
#else //CGAL_TD_DEBUG
|
||||
public:
|
||||
public:
|
||||
#endif //CGAL_TD_DEBUG
|
||||
|
||||
|
||||
|
||||
|
||||
/*! Set the DAG node. */
|
||||
inline void set_dag_node(Dag_node* p)
|
||||
{
|
||||
ptr()->p_node = p;
|
||||
}
|
||||
|
||||
inline void set_dag_node(Dag_node* p) { ptr()->p_node = p; }
|
||||
|
||||
/*! Set the vertex handle (Vertex_const_handle). */
|
||||
inline void set_vertex(Vertex_const_handle v)
|
||||
inline void set_vertex(Vertex_const_handle v) { ptr()->v = v; }
|
||||
|
||||
/*! Set the first he going clockwise starting at 12 o'clock.
|
||||
*/
|
||||
inline void set_cw_he(Halfedge_const_handle he)
|
||||
{
|
||||
ptr()->v = v;
|
||||
ptr()->cw_he = ((cw_he() != Traits::empty_he_handle()) &&
|
||||
(cw_he()->direction() != he->direction())) ?
|
||||
he->twin() : he;
|
||||
}
|
||||
|
||||
/*! Set the first he going clockwise starting at 12 o'clock (Halfedge_const_handle). */
|
||||
inline void set_cw_he(Halfedge_const_handle he)
|
||||
{
|
||||
if (cw_he() != Traits::empty_he_handle() &&
|
||||
cw_he()->direction() != he->direction())
|
||||
{
|
||||
ptr()->cw_he = he->twin();
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr()->cw_he = he;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/*! Reset the first he going clockwise starting at 12 o'clock.
|
||||
*/
|
||||
inline void reset_cw_he() { ptr()->cw_he = Traits::empty_he_handle(); }
|
||||
|
||||
public:
|
||||
/// \name Constructors.
|
||||
//@{
|
||||
|
||||
Td_active_vertex ()
|
||||
Td_active_vertex()
|
||||
{
|
||||
PTR = new Data
|
||||
(Traits::empty_vtx_handle(), Traits::empty_he_handle(), NULL);
|
||||
PTR = new Data(Traits::empty_vtx_handle(), Traits::empty_he_handle(), NULL);
|
||||
}
|
||||
|
||||
|
||||
/*! Constructor given Vertex & Halfedge handles. */
|
||||
Td_active_vertex (Vertex_const_handle v,
|
||||
Halfedge_const_handle cw_he,
|
||||
Td_active_vertex(Vertex_const_handle v, Halfedge_const_handle cw_he,
|
||||
Dag_node* node = 0)
|
||||
|
||||
{
|
||||
PTR = new Data (v, cw_he, node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
{ PTR = new Data(v, cw_he, node); }
|
||||
|
||||
|
||||
/*! Copy constructor. */
|
||||
Td_active_vertex(const Self& tr) : Handle(tr)
|
||||
{
|
||||
}
|
||||
|
||||
Td_active_vertex(const Self& tr) : Handle(tr) {}
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/// \name Operator overloading.
|
||||
//@{
|
||||
|
||||
/*! Assignment operator.
|
||||
* operator= should not copy m_dag_node (or otherwise update
|
||||
/*! Assignment operator.
|
||||
* operator= should not copy m_dag_node (or otherwise update
|
||||
* Dag_node::replace)
|
||||
*/
|
||||
inline Self& operator= (const Self& t2)
|
||||
inline Self& operator=(const Self& t2)
|
||||
{
|
||||
Handle::operator=(t2);
|
||||
return *this;
|
||||
Handle::operator=(t2);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*! Operator==. */
|
||||
inline bool operator== (const Self& t2) const
|
||||
{
|
||||
return (ptr() == t2.ptr());
|
||||
}
|
||||
inline bool operator==(const Self& t2) const { return (ptr() == t2.ptr()); }
|
||||
|
||||
/*! Operator!=. */
|
||||
inline bool operator!= (const Self& t2) const
|
||||
{
|
||||
return !(operator==(t2));
|
||||
}
|
||||
inline bool operator!=(const Self& t2) const { return !(operator==(t2)); }
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/// \name Access methods.
|
||||
//@{
|
||||
|
||||
inline Self& self()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const Self& self() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
inline Self& self() { return *this; }
|
||||
|
||||
inline const Self& self() const { return *this; }
|
||||
|
||||
/*! Access the trapezoid id (PTR). */
|
||||
inline unsigned long id() const
|
||||
{
|
||||
return (unsigned long) PTR;
|
||||
}
|
||||
inline unsigned long id() const { return (unsigned long) PTR; }
|
||||
|
||||
inline Vertex_const_handle vertex() const
|
||||
{
|
||||
return ptr()->v;
|
||||
}
|
||||
inline Vertex_const_handle vertex() const { return ptr()->v; }
|
||||
|
||||
Curve_end curve_end() const { return vtx_to_ce(vertex()); }
|
||||
|
||||
inline const Point& point() const { return vertex()->point(); }
|
||||
|
||||
/*! Access the first he starting at 12 o'clock clockwise.
|
||||
*/
|
||||
inline Halfedge_const_handle cw_he() const { return ptr()->cw_he; }
|
||||
|
||||
Curve_end curve_end() const
|
||||
{
|
||||
return vtx_to_ce(vertex());
|
||||
}
|
||||
|
||||
inline const Point& point() const
|
||||
{
|
||||
return vertex()->point();
|
||||
}
|
||||
|
||||
/*! Access the first he starting at 12 o'clock clockwise.
|
||||
*/
|
||||
inline Halfedge_const_handle cw_he () const
|
||||
{
|
||||
return ptr()->cw_he;
|
||||
}
|
||||
|
||||
/*! Access DAG node. */
|
||||
Dag_node* dag_node() const {return ptr()->p_node; }
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
Dag_node* dag_node() const { return ptr()->p_node; }
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@
|
|||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
|
||||
// Iddo Hanniel <hanniel@math.tau.ac.il>
|
||||
// Author(s): Oren Nechushtan <theoren@math.tau.ac.il>
|
||||
// Iddo Hanniel <hanniel@math.tau.ac.il>
|
||||
// Efi Fogel <efifogel@gmail.com>
|
||||
|
||||
#ifndef CGAL_TRAPEZOIDAL_DECOMPOSITION_2_H
|
||||
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_H
|
||||
|
|
@ -617,29 +618,36 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class set_cw_he_visitor : public boost::static_visitor<void>
|
||||
{
|
||||
/*! A visitor to set the cw halfedge of a vertex node.
|
||||
*/
|
||||
class set_cw_he_visitor : public boost::static_visitor<void> {
|
||||
public:
|
||||
set_cw_he_visitor (Halfedge_const_handle he) : m_cw_he(he) {}
|
||||
set_cw_he_visitor(Halfedge_const_handle he) : m_cw_he(he) {}
|
||||
|
||||
void operator()(Td_active_vertex& t) const { t.set_cw_he(m_cw_he); }
|
||||
|
||||
void operator()(Td_active_vertex& t) const
|
||||
{
|
||||
t.set_cw_he(m_cw_he);
|
||||
}
|
||||
void operator()(Td_active_fictitious_vertex& t) const
|
||||
{
|
||||
t.set_cw_he(m_cw_he);
|
||||
}
|
||||
{ t.set_cw_he(m_cw_he); }
|
||||
|
||||
template <typename T>
|
||||
void operator()(T& /*t*/) const { CGAL_assertion(false); }
|
||||
|
||||
template < typename T >
|
||||
void operator()(T& /*t*/) const
|
||||
{
|
||||
CGAL_assertion(false);
|
||||
}
|
||||
private:
|
||||
Halfedge_const_handle m_cw_he;
|
||||
};
|
||||
|
||||
/*! A visitor to reset the cw halfedge of a vertex node.
|
||||
*/
|
||||
class reset_cw_he_visitor : public boost::static_visitor<void> {
|
||||
public:
|
||||
void operator()(Td_active_vertex& t) const { t.reset_cw_he(); }
|
||||
|
||||
void operator()(Td_active_fictitious_vertex& t) const { t.reset_cw_he(); }
|
||||
|
||||
template <typename T>
|
||||
void operator()(T& /*t*/) const { CGAL_assertion(false); }
|
||||
};
|
||||
|
||||
class dag_node_visitor : public boost::static_visitor<Dag_node*>
|
||||
{
|
||||
public:
|
||||
|
|
@ -1151,6 +1159,11 @@ protected:
|
|||
Halfedge_const_handle new_he,
|
||||
Td_map_item& vtx_item);
|
||||
|
||||
/*! Update the cw halfedge of an active vertex after a halfedge is removed.
|
||||
*/
|
||||
void update_vtx_cw_he_after_remove(Halfedge_const_handle old_he,
|
||||
Td_map_item& vtx_item);
|
||||
|
||||
////MICHAL: currently not in use since split is implemented as: remove and insert two
|
||||
//void set_trp_params_after_split_halfedge_update(Halfedge_const_handle new_he,
|
||||
// Td_map_item& vtx_item,
|
||||
|
|
@ -1758,22 +1771,20 @@ public:
|
|||
#endif
|
||||
|
||||
Halfedge_container container;
|
||||
|
||||
#ifdef CGAL_TD_DEBUG
|
||||
unsigned long rep = Halfedge_filter(container, &dag_root());
|
||||
#else
|
||||
Halfedge_filter(container, &dag_root());
|
||||
#endif
|
||||
|
||||
clear();
|
||||
|
||||
//// initialize container to point to curves in Td_map_item Tree
|
||||
//if (rep>0)
|
||||
//{
|
||||
//if (rep>0) {
|
||||
// bool o = set_with_guarantees(false);
|
||||
// typename std::vector<Halfedge_const_handle>::iterator
|
||||
// it = container.begin(),
|
||||
// it_end = container.end();
|
||||
// while(it!=it_end)
|
||||
// {
|
||||
// while (it != it_end) {
|
||||
// insert(*it);
|
||||
// ++it;
|
||||
// }
|
||||
|
|
@ -1787,8 +1798,7 @@ public:
|
|||
#ifdef CGAL_TD_DEBUG
|
||||
CGAL_assertion(is_valid());
|
||||
unsigned long sz = number_of_curves();
|
||||
if (sz != rep)
|
||||
{
|
||||
if (sz != rep) {
|
||||
std::cerr << "\nnumber_of_curves()=" << sz;
|
||||
std::cerr << "\nrepresentatives.size()=" << rep;
|
||||
CGAL_assertion(number_of_curves() == rep);
|
||||
|
|
@ -1832,46 +1842,37 @@ public:
|
|||
// return container.size();
|
||||
//}
|
||||
|
||||
/* Return a container for all active curves.
|
||||
*/
|
||||
template <typename Halfedge_container>
|
||||
unsigned long Halfedge_filter(Halfedge_container& container,
|
||||
const Dag_node* ds) const
|
||||
/* Return a container for all active curves */
|
||||
{
|
||||
unsigned long sz = number_of_curves();
|
||||
std::list<Td_map_item> representatives;
|
||||
//X_trapezoid_list representatives;
|
||||
ds->filter(representatives, Td_active_edge_item(*traits));
|
||||
|
||||
#ifndef CGAL_TD_DEBUG
|
||||
|
||||
CGAL_warning(sz==representatives.size());
|
||||
|
||||
CGAL_warning(sz == representatives.size());
|
||||
#else
|
||||
|
||||
unsigned long rep=representatives.size();
|
||||
if (sz != rep)
|
||||
{
|
||||
unsigned long rep = representatives.size();
|
||||
if (sz != rep) {
|
||||
std::cerr << "\nnumber_of_curves()=" << sz;
|
||||
std::cerr << "\nrepresentatives.size()=" << rep;
|
||||
CGAL_assertion(number_of_curves()==representatives.size());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (sz > 0)
|
||||
{
|
||||
typename std::list<Td_map_item>::iterator it = representatives.begin(),
|
||||
it_end = representatives.end();
|
||||
//typename X_trapezoid_list::iterator it = representatives.begin(),
|
||||
// it_end = representatives.end();
|
||||
while(!(it==it_end))
|
||||
if (sz > 0) {
|
||||
for (typename std::list<Td_map_item>::iterator it =
|
||||
representatives.begin(); it != representatives.end(); ++it)
|
||||
{
|
||||
Td_active_edge e (boost::get<Td_active_edge>(*it));
|
||||
Td_active_edge e(boost::get<Td_active_edge>(*it));
|
||||
container.push_back(e.halfedge()); //it represents an active trapezoid
|
||||
++it;
|
||||
}
|
||||
}
|
||||
if(! container.empty()) {
|
||||
if (! container.empty()) {
|
||||
CGAL::cpp98::random_shuffle(container.begin(),container.end());
|
||||
}
|
||||
return sz;
|
||||
|
|
@ -2010,7 +2011,6 @@ public:
|
|||
true, *m_dag_root, *m_dag_root);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//Trapezoidal Decomposition data members
|
||||
|
|
@ -2138,7 +2138,6 @@ private:
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
void print_cv_data(const X_monotone_curve_2& cv,
|
||||
std::ostream& out = std::cout) const
|
||||
{
|
||||
|
|
@ -2206,7 +2205,6 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void print_dag_addresses(const Dag_node& curr) const
|
||||
{
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -163,6 +163,9 @@ public:
|
|||
/// \name Construction functors(based on the subcurve traits).
|
||||
//@{
|
||||
|
||||
#ifndef DOXYGEN_RUNNING
|
||||
class Push_back_2;
|
||||
#endif
|
||||
/*! \class
|
||||
* A functor that divides an arc into x-monotone arcs. That are, arcs that
|
||||
* do not cross the identification arc.
|
||||
|
|
|
|||
|
|
@ -347,6 +347,9 @@ public:
|
|||
return os;
|
||||
}
|
||||
|
||||
class Parameter_space_in_x_2;
|
||||
class Parameter_space_in_y_2;
|
||||
|
||||
/*! A functor that computes intersections between x-monotone curves. */
|
||||
class Intersect_2 {
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ project( Arrangement_on_surface_2_Tests )
|
|||
|
||||
enable_testing()
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.10)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
find_package(CGAL QUIET COMPONENTS Core)
|
||||
|
||||
|
|
@ -33,8 +33,7 @@ if ( CGAL_FOUND )
|
|||
endif()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ read_perform_opts(std::istream& is)
|
|||
rc = false;
|
||||
continue;
|
||||
}
|
||||
if (cmd == 'i') insert(*(this->m_arr), this->m_xcurves[id]);
|
||||
if (cmd == 'i') CGAL::insert(*(this->m_arr), this->m_xcurves[id]);
|
||||
|
||||
if (cmd == 'd') {
|
||||
if (!remove(this->m_xcurves[id])) rc = false;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,15 @@
|
|||
i 0
|
||||
i 1
|
||||
i 2
|
||||
i 3
|
||||
i 4
|
||||
i 5
|
||||
i 6
|
||||
i 7
|
||||
d 7
|
||||
d 6
|
||||
d 5
|
||||
d 4
|
||||
d 3
|
||||
d 2
|
||||
d 1
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
i 0
|
||||
i 1
|
||||
d 1
|
||||
i 1
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
0 0 1 1
|
||||
1 1 2 2
|
||||
2 2 3 3
|
||||
3 3 4 4
|
||||
4 4 5 5
|
||||
5 5 6 6
|
||||
6 6 7 7
|
||||
7 7 8 8
|
||||
|
|
@ -1 +1,3 @@
|
|||
./data/empty.zero ./data/point_location/segments/xcurves/test10.txt ./data/empty.zero ./data/point_location/segments/ops/test10.txt ./data/point_location/segments/queries/test10.txt
|
||||
./data/empty.zero ./data/point_location/segments/xcurves/test11.txt ./data/empty.zero ./data/point_location/segments/ops/test11.txt ./data/point_location/segments/queries/test03.txt
|
||||
./data/empty.zero ./data/point_location/segments/xcurves/test11.txt ./data/empty.zero ./data/point_location/segments/ops/test12.txt ./data/point_location/segments/queries/test03.txt
|
||||
|
|
|
|||
|
|
@ -618,6 +618,9 @@ user might encounter.
|
|||
- `CGAL::is_quad()`
|
||||
- `CGAL::is_quad_mesh()`
|
||||
- `CGAL::is_isolated_quad()`
|
||||
- `CGAL::is_valid_halfedge_graph()`
|
||||
- `CGAL::is_valid_face_graph()`
|
||||
- `CGAL::is_valid_polygon_mesh()`
|
||||
|
||||
- `CGAL::is_tetrahedron()`
|
||||
- `CGAL::is_hexahedron()`
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
|
||||
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
||||
#include <CGAL/boost/graph/iterator.h>
|
||||
#include <fstream>
|
||||
|
|
|
|||
|
|
@ -1178,7 +1178,7 @@ collapse_edge(typename boost::graph_traits<Graph>::edge_descriptor v0v1,
|
|||
lP_Erased = true ;
|
||||
}
|
||||
|
||||
CGAL_expensive_assertion(is_valid(g));
|
||||
CGAL_expensive_assertion(is_valid_polygon_mesh(g));
|
||||
|
||||
return lP_Erased ? q : p ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -691,7 +691,7 @@ template <class Graph>
|
|||
bool
|
||||
is_valid(const Graph_with_descriptor_with_graph<Graph> & w, bool verbose = false)
|
||||
{
|
||||
return is_valid(*w.graph,verbose);
|
||||
return is_valid_polygon_mesh(*w.graph,verbose);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include <CGAL/assertions.h>
|
||||
#include <CGAL/hash_openmesh.h>
|
||||
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4267)
|
||||
|
|
@ -622,12 +621,6 @@ add_face(OPEN_MESH_CLASS& sm)
|
|||
return sm.new_face();
|
||||
}
|
||||
|
||||
template<typename K>
|
||||
bool is_valid(OPEN_MESH_CLASS& sm, bool /* verbose */ = false)
|
||||
{
|
||||
return CGAL::is_valid_polygon_mesh(sm);
|
||||
}
|
||||
|
||||
} // namespace OpenMesh
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <CGAL/boost/graph/internal/Has_member_clear.h>
|
||||
#include <CGAL/function_objects.h>
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include <CGAL/IO/Verbose_ostream.h>
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -355,30 +356,292 @@ bool is_valid_face_descriptor( typename boost::graph_traits<FaceGraph>::face_des
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
template <typename FaceGraph>
|
||||
bool is_valid_polygon_mesh(const FaceGraph& g)
|
||||
/*!
|
||||
\ingroup PkgBGLHelperFct
|
||||
* \brief checks the integrity of `g`.
|
||||
*
|
||||
* `g` is valid if it follows the rules of the `HalfedgeListGraph` concept,
|
||||
* and all of its associations are reciprocal.
|
||||
* For example, `prev(next(h, g), g)` must be `h`,
|
||||
* and `next(prev(h, g), g)` must be `h`.
|
||||
* \param g the `Graph` to test.
|
||||
* \param verb : if `true`, the details of the check will be written in the standard output.
|
||||
*
|
||||
* \tparam `Graph` a model of `HalfedgeListGraph`
|
||||
* \return `true` if `g` is valid, `false` otherwise.
|
||||
*
|
||||
*/
|
||||
template<typename Graph>
|
||||
bool is_valid_halfedge_graph(const Graph& g, bool verb = false)
|
||||
{
|
||||
typedef typename boost::graph_traits<FaceGraph>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
|
||||
BOOST_FOREACH(vertex_descriptor v, vertices(g)){
|
||||
if(! is_valid_vertex_descriptor(v,g)){
|
||||
return false;
|
||||
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<Graph>::vertices_size_type vertex_size_type;
|
||||
typedef typename boost::graph_traits<Graph>::halfedges_size_type halfedges_size_type;
|
||||
Verbose_ostream verr(verb);
|
||||
std::size_t num_v(std::distance(boost::begin(vertices(g)), boost::end(vertices(g)))),
|
||||
num_h(std::distance(boost::begin(halfedges(g)), boost::end(halfedges(g))));
|
||||
bool valid = ( 1 != (num_h& 1));
|
||||
if ( ! valid)
|
||||
verr << "number of halfedges is odd." << std::endl;
|
||||
|
||||
// All halfedges.
|
||||
|
||||
halfedges_size_type n = 0;
|
||||
BOOST_FOREACH(halfedge_descriptor begin, halfedges(g)) {
|
||||
if(!valid)
|
||||
break;
|
||||
verr << "halfedge " << n << std::endl;
|
||||
// Pointer integrity.
|
||||
valid = valid && ( next(begin, g) != boost::graph_traits<Graph>::null_halfedge());
|
||||
valid = valid && ( opposite(begin, g) != boost::graph_traits<Graph>::null_halfedge());
|
||||
if ( ! valid) {
|
||||
verr << " pointer integrity corrupted (ptr==0)."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(halfedge_descriptor h, halfedges(g)){
|
||||
if(! is_valid_halfedge_descriptor(h,g)){
|
||||
return false;
|
||||
//edge integrity
|
||||
valid = valid && ( halfedge(edge(begin, g), g) == begin);
|
||||
// opposite integrity.
|
||||
valid = valid && ( opposite(begin, g) != begin);
|
||||
valid = valid && ( opposite(opposite(begin, g), g) == begin);
|
||||
if ( ! valid) {
|
||||
verr << " opposite pointer integrity corrupted."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
BOOST_FOREACH(face_descriptor f, faces(g)){
|
||||
if(! is_valid_face_descriptor(f,g)){
|
||||
return false;
|
||||
// previous integrity.
|
||||
valid = valid && ( prev(next(begin, g), g) == begin);
|
||||
valid = valid && ( next(prev(begin, g), g) == begin);
|
||||
if ( ! valid) {
|
||||
verr << " previous pointer integrity corrupted."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
// vertex integrity.
|
||||
valid = valid && ( target(begin, g) != boost::graph_traits<Graph>::null_vertex());
|
||||
if ( ! valid) {
|
||||
verr << " vertex pointer integrity corrupted."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
valid = valid && ( target(begin, g) ==
|
||||
target(opposite(next(begin, g), g), g));
|
||||
if ( ! valid) {
|
||||
verr << " vertex pointer integrity2 corrupted."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
++n;
|
||||
}
|
||||
return true;
|
||||
if ( valid && n != num_h)
|
||||
verr << "counting halfedges failed." << std::endl;
|
||||
// All vertices.
|
||||
vertex_size_type v = 0;
|
||||
n = 0;
|
||||
BOOST_FOREACH(vertex_descriptor vbegin, vertices(g)){
|
||||
if(!valid)
|
||||
break;
|
||||
verr << "vertex " << v << std::endl;
|
||||
// Pointer integrity.
|
||||
if ( halfedge(vbegin, g) != boost::graph_traits<Graph>::null_halfedge())
|
||||
valid = valid && (
|
||||
target( halfedge(vbegin, g), g) == vbegin);
|
||||
else
|
||||
valid = false;
|
||||
if ( ! valid) {
|
||||
verr << " halfedge pointer in vertex corrupted."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
// cycle-around-vertex test.
|
||||
halfedge_descriptor h = halfedge(vbegin, g);
|
||||
if ( h != boost::graph_traits<Graph>::null_halfedge()) {
|
||||
halfedge_descriptor ge = h;
|
||||
do {
|
||||
verr << " halfedge " << n << std::endl;
|
||||
++n;
|
||||
h = opposite(next(h, g), g);
|
||||
valid = valid && ( n <= num_h && n!=0);
|
||||
if ( ! valid)
|
||||
verr << " too many halfedges around vertices."
|
||||
<< std::endl;
|
||||
} while ( valid && (h != ge));
|
||||
}
|
||||
++v;
|
||||
}
|
||||
if ( valid && v != num_v)
|
||||
verr << "counting vertices failed." << std::endl;
|
||||
if ( valid && ( n != num_h))
|
||||
verr << "counting halfedges via vertices failed." << std::endl;
|
||||
valid = valid && ( v == num_v);
|
||||
|
||||
|
||||
// All halfedges.
|
||||
n = 0;
|
||||
BOOST_FOREACH(halfedge_descriptor i, halfedges(g)){
|
||||
verr << "halfedge " << n << std::endl;
|
||||
// At least triangular facets and distinct geometry.
|
||||
valid = valid && ( next(i, g) != i);
|
||||
valid = valid && ( target(i, g) != target(opposite(i, g), g));
|
||||
if ( ! valid) {
|
||||
verr << " pointer validity corrupted."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
valid = valid && (n == num_h);
|
||||
if ( n != num_h)
|
||||
verr << "counting halfedges failed." << std::endl;
|
||||
|
||||
verr << "structure is "
|
||||
<< ( valid ? "valid." : "NOT VALID.") << std::endl;
|
||||
return valid;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup PkgBGLHelperFct
|
||||
* \brief checks the integrity of `g`.
|
||||
*
|
||||
* `g` is valid if it is a valid `HalfedgeListGraph`, if it follows the rules
|
||||
* of the `FaceListGraph` concept, and all of its associations are reciprocal.
|
||||
* For example, `face(halfedge(f,g),g)` must be `f`.
|
||||
* calls `is_valid_halfedge_graph()`
|
||||
* \param g the `Graph` to test.
|
||||
* \param verb : if `true`, the details of the check will be written in the standard output.
|
||||
*
|
||||
* \tparam `Graph` a model of `FaceListGraph`
|
||||
* \return `true` if `g` is valid, `false` otherwise.
|
||||
*
|
||||
* \see `is_valid_halfedge_graph()`
|
||||
*/
|
||||
template<typename Graph>
|
||||
bool is_valid_face_graph(const Graph& g, bool verb = false)
|
||||
{
|
||||
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<Graph>::face_descriptor face_descriptor;
|
||||
typedef typename boost::graph_traits<Graph>::faces_size_type faces_size_type;
|
||||
typedef typename boost::graph_traits<Graph>::halfedges_size_type halfedges_size_type;
|
||||
std::size_t num_f(std::distance(boost::begin(faces(g)), boost::end(faces(g)))),
|
||||
num_h(std::distance(boost::begin(halfedges(g)), boost::end(halfedges(g))));
|
||||
|
||||
//is valid halfedge_graph ?
|
||||
bool valid=is_valid_halfedge_graph(g, verb);
|
||||
if ( ! valid) {
|
||||
return false;
|
||||
}
|
||||
Verbose_ostream verr(verb);
|
||||
|
||||
// All faces.
|
||||
faces_size_type f = 0;
|
||||
std::size_t n = 0;
|
||||
halfedges_size_type nb = 0;
|
||||
BOOST_FOREACH(face_descriptor fbegin, faces(g)){
|
||||
if(!valid)
|
||||
break;
|
||||
verr << "face " << f << std::endl;
|
||||
// Pointer integrity.
|
||||
if ( halfedge(fbegin, g) != boost::graph_traits<Graph>::null_halfedge())
|
||||
valid = valid && (
|
||||
face(halfedge(fbegin, g), g) == fbegin);
|
||||
else
|
||||
valid = false;
|
||||
if ( ! valid) {
|
||||
verr << " halfedge pointer in face corrupted." << std::endl;
|
||||
break;
|
||||
}
|
||||
// cycle-around-face test.
|
||||
halfedge_descriptor h = halfedge( fbegin, g);
|
||||
if (h != boost::graph_traits<Graph>::null_halfedge()) {
|
||||
halfedge_descriptor ge = h;
|
||||
do {
|
||||
verr << " halfedge " << n << std::endl;
|
||||
++n;
|
||||
h = next(h, g);
|
||||
valid = valid && ( n <= num_h && n!=0);
|
||||
if ( ! valid)
|
||||
verr << " too many halfedges around faces."
|
||||
<< std::endl;
|
||||
} while ( valid && (h != ge));
|
||||
}
|
||||
++f;
|
||||
}
|
||||
if ( valid && f != num_f)
|
||||
verr << "counting faces failed." << std::endl;
|
||||
|
||||
BOOST_FOREACH(halfedge_descriptor i, halfedges(g)){
|
||||
//counting borders
|
||||
if ( is_border(i, g))
|
||||
++nb;
|
||||
// face integrity.
|
||||
|
||||
valid = valid && ( face(i, g) == face(next(i, g), g));
|
||||
if ( ! valid) {
|
||||
verr << " face pointer integrity2 corrupted."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
verr << "sum border halfedges (2*nb) = " << 2 * nb << std::endl;
|
||||
if ( valid && n + nb != num_h)
|
||||
verr << "counting halfedges via faces failed." << std::endl;
|
||||
valid = valid && ( f == num_f);
|
||||
valid = valid && ( n + nb == num_h);
|
||||
verr << "is_valid(): structure is " << ( valid ? "valid." :
|
||||
"NOT VALID.") << std::endl;
|
||||
return valid;
|
||||
}
|
||||
/*!
|
||||
\ingroup PkgBGLHelperFct
|
||||
* \brief checks the integrity of `g`.
|
||||
*
|
||||
* `g` is valid if it is a valid `FaceListGraph` and it has distinct faces on each side of an edge.
|
||||
* calls `is_valid_face_graph()`.
|
||||
*
|
||||
* \param g the `Mesh` to test.
|
||||
* \param verb : if `true`, the details of the check will be written in the standard output.
|
||||
*
|
||||
* \tparam Mesh a model of `FaceListGraph` and `HalfedgeListGraph`, and follows
|
||||
* the definition of a \ref PMPDef "PolygonMesh"
|
||||
* \return `true` if `g` is valid, `false` otherwise.
|
||||
*
|
||||
* \see `is_valid_face_graph()`
|
||||
* \see `is_valid_halfedge_graph()`
|
||||
*
|
||||
*/
|
||||
template <typename Mesh>
|
||||
bool is_valid_polygon_mesh(const Mesh& g, bool verb = false)
|
||||
{
|
||||
typedef typename boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;
|
||||
Verbose_ostream verr(verb);
|
||||
bool valid=is_valid_face_graph(g, verb);
|
||||
//test for 2-manifoldness
|
||||
// Distinct facets on each side of an halfedge.
|
||||
BOOST_FOREACH(halfedge_descriptor i, halfedges(g)){
|
||||
valid = valid && (face(i, g) != face(opposite(i, g), g));
|
||||
if ( ! valid) {
|
||||
verr << " both incident facets are equal." << std::endl;
|
||||
break;
|
||||
}
|
||||
valid = valid && ( next(next(i, g), g) != i);
|
||||
valid = valid && ( target(i, g) != target(next(i, g), g));
|
||||
valid = valid && ( target(i, g) != target(next(next(i, g), g), g));
|
||||
if ( ! valid) {
|
||||
verr << " incident facet is not at least a triangle."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
if ( ! valid) {
|
||||
verr << " incident facet is not at least a triangle."
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\ingroup PkgBGLHelperFct
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2014 GeometryFactory (France). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
|
|
@ -14,23 +13,16 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Stephane Tayeb
|
||||
//
|
||||
//******************************************************************************
|
||||
// File Description :
|
||||
//******************************************************************************
|
||||
|
||||
#ifndef CGAL_MESH_3_GLOBAL_PARAMETERS_H
|
||||
#define CGAL_MESH_3_GLOBAL_PARAMETERS_H
|
||||
|
||||
#include <CGAL/license/Mesh_3.h>
|
||||
// Author(s) : Andreas Fabri
|
||||
|
||||
#ifndef CGAL_BOOST_PARAMETER_H
|
||||
#define CGAL_BOOST_PARAMETER_H
|
||||
|
||||
#include <CGAL/config.h>
|
||||
#include <CGAL/Mesh_3/config.h>
|
||||
|
||||
|
||||
#ifdef BOOST_PARAMETER_MAX_ARITY
|
||||
# if (BOOST_PARAMETER_MAX_ARITY < 12)
|
||||
|
|
@ -39,14 +31,34 @@
|
|||
#else
|
||||
# define BOOST_PARAMETER_MAX_ARITY 12
|
||||
#endif
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
#if defined(__clang__) || (BOOST_GCC >= 40600)
|
||||
# define CGAL_IGNORE_UNUSED_VARIABLES \
|
||||
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
|
||||
#else
|
||||
# define CGAL_IGNORE_UNUSED_VARIABLES
|
||||
#endif
|
||||
#if __has_warning("-Wunneeded-internal-declaration")
|
||||
# define CGAL_IGNORE_UNUSED_INTERNAL_DECLARATION \
|
||||
_Pragma("clang diagnostic ignored \"-Wunneeded-internal-declaration\"")
|
||||
#else
|
||||
# define CGAL_IGNORE_UNUSED_INTERNAL_DECLARATION
|
||||
#endif
|
||||
|
||||
namespace parameters {
|
||||
#define CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS \
|
||||
CGAL_IGNORE_UNUSED_VARIABLES \
|
||||
CGAL_IGNORE_UNUSED_INTERNAL_DECLARATION
|
||||
|
||||
|
||||
namespace CGAL
|
||||
{
|
||||
namespace parameters
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Base
|
||||
{
|
||||
|
|
@ -56,33 +68,39 @@ private:
|
|||
T t_;
|
||||
};
|
||||
|
||||
#define CGAL_MESH_BOOLEAN_PARAMETER(Class, function_true, function_false) \
|
||||
#define CGAL_BOOLEAN_PARAMETER(Class, function_true, function_false) \
|
||||
struct Class : public Base<bool> { Class(bool b) : Base<bool>(b){} }; \
|
||||
inline Class function_true() { return Class(true); } \
|
||||
inline Class function_false() { return Class(false); }
|
||||
|
||||
#define CGAL_MESH_DOUBLE_PARAMETER(Class, function, precondition) \
|
||||
#define CGAL_DOUBLE_PARAMETER(Class, function, precondition) \
|
||||
struct Class : public Base<double> \
|
||||
{ Class(double d) : Base<double>(d) { precondition(d); } }; \
|
||||
inline Class function(double d) { return Class(d); }
|
||||
|
||||
// see <CGAL/config.h>
|
||||
CGAL_PRAGMA_DIAG_PUSH
|
||||
// see <CGAL/Mesh_3/config.h>
|
||||
CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
|
||||
// see <CGAL/boost/parameter.h>
|
||||
CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS
|
||||
|
||||
BOOST_PARAMETER_NAME( c3t3 )
|
||||
BOOST_PARAMETER_NAME( domain )
|
||||
BOOST_PARAMETER_NAME( criteria )
|
||||
|
||||
BOOST_PARAMETER_NAME( cdt )
|
||||
|
||||
BOOST_PARAMETER_NAME( (seeds_begin, tag) seeds_begin_)
|
||||
BOOST_PARAMETER_NAME( (seeds_end, tag) seeds_end_)
|
||||
BOOST_PARAMETER_NAME( (mark, tag) mark_)
|
||||
|
||||
BOOST_PARAMETER_NAME( (time_limit, tag) time_limit_ )
|
||||
BOOST_PARAMETER_NAME( (convergence, tag) convergence_)
|
||||
BOOST_PARAMETER_NAME( (max_iteration_number, tag) max_iteration_number_ )
|
||||
BOOST_PARAMETER_NAME( (freeze_bound, tag) freeze_bound_)
|
||||
|
||||
BOOST_PARAMETER_NAME( (sliver_bound, tag) sliver_bound_)
|
||||
BOOST_PARAMETER_NAME( (sliver_criterion, tag) sliver_criterion_)
|
||||
BOOST_PARAMETER_NAME( (perturbation_vector, tag) perturbation_vector_)
|
||||
BOOST_PARAMETER_NAME( (freeze_bound, tag) freeze_bound_)
|
||||
BOOST_PARAMETER_NAME( (do_freeze, tag) do_freeze_)
|
||||
BOOST_PARAMETER_NAME( (max_iteration_number, tag) max_iteration_number_ )
|
||||
BOOST_PARAMETER_NAME( (convergence, tag) convergence_)
|
||||
|
||||
BOOST_PARAMETER_NAME( (mesh_topology, tag) mesh_topology_)
|
||||
|
||||
|
|
@ -97,12 +115,8 @@ BOOST_PARAMETER_NAME( (maximal_number_of_vertices, tag ) maximal_number_of_verti
|
|||
BOOST_PARAMETER_NAME( (pointer_to_error_code, tag ) pointer_to_error_code_)
|
||||
|
||||
CGAL_PRAGMA_DIAG_POP
|
||||
} // end namespace parameters
|
||||
} // parameters
|
||||
} // CGAL
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_MESH_3_GLOBAL_PARAMETERS_H
|
||||
#endif // CGAL_BOOST_PARAMETER_H
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/boost/graph/split_graph_into_polylines.h>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
#include <boost/graph/filtered_graph.hpp>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/boost/graph/graph_concepts.h>
|
||||
#include <CGAL/Polyhedron_items_with_id_3.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/properties_Surface_mesh.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/boost/graph/Graph_with_descriptor_with_graph.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/boost/graph/graph_concepts.h>
|
||||
#include <CGAL/Polyhedron_items_with_id_3.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/properties_Surface_mesh.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/Seam_mesh.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/properties_Surface_mesh.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
|
||||
#include <boost/graph/graph_concepts.hpp>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ join_face_test()
|
|||
|
||||
assert(degree(f.w, f.m) == 2);
|
||||
assert(degree(f.v, f.m) == 3);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ remove_face_test_1()
|
|||
|
||||
CGAL::Euler::remove_face(e,f.m);
|
||||
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
|
||||
assert_EQUAL(degree(f.v, f.m) == 3);
|
||||
assert_EQUAL(degree(f.x, f.m) == 2);
|
||||
|
|
@ -99,7 +99,7 @@ remove_face_test_2()
|
|||
assert(found);
|
||||
assert(face(e, f.m) == f.f1);
|
||||
CGAL::Euler::remove_face(e,f.m);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
|
||||
assert(CGAL::internal::exact_num_faces(f.m) == 3);
|
||||
assert(CGAL::internal::exact_num_edges(f.m) == 7);
|
||||
|
|
@ -128,7 +128,7 @@ add_face_to_border_test()
|
|||
|
||||
CGAL::Euler::add_face_to_border(f.h1, f.h2, f.m);
|
||||
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ add_vertex_and_face_to_border_test()
|
|||
}
|
||||
|
||||
halfedge_descriptor res = CGAL::Euler::add_vertex_and_face_to_border(f.h1, f.h2, f.m);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
|
||||
assert(! CGAL::is_border(res,m));
|
||||
assert(CGAL::is_border(opposite(res,m),m));
|
||||
|
|
@ -169,8 +169,6 @@ add_vertex_and_face_to_border_test()
|
|||
}
|
||||
assert(blength == 0);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -193,7 +191,7 @@ join_vertex_interior_test()
|
|||
assert(boost::distance(CGAL::halfedges_around_face(halfedge(f.f1, f.m), f.m)) == 3);
|
||||
assert(boost::distance(CGAL::halfedges_around_face(halfedge(f.f2, f.m), f.m)) == 3);
|
||||
assert(degree(f.x, f.m) == 4);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
@ -218,7 +216,7 @@ join_vertex_exterior_test()
|
|||
assert(boost::distance(CGAL::halfedges_around_face(halfedge(f.f1, f.m), f.m)) == 4);
|
||||
assert(boost::distance(CGAL::halfedges_around_face(halfedge(f.f2, f.m), f.m)) == 3);
|
||||
assert(degree(f.y, f.m) == 3);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -237,7 +235,7 @@ join_vertex_exterior_test()
|
|||
assert(boost::distance(CGAL::halfedges_around_face(halfedge(f.f1, f.m), f.m)) == 4);
|
||||
assert(boost::distance(CGAL::halfedges_around_face(halfedge(f.f2, f.m), f.m)) == 3);
|
||||
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
assert(degree(f.w, f.m) == 3);
|
||||
|
||||
}
|
||||
|
|
@ -261,7 +259,7 @@ split_vertex()
|
|||
|
||||
// split border vertex y
|
||||
CGAL::Euler::split_vertex(h1, h2,f.m);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
assert(CGAL::internal::exact_num_vertices(f.m) == 7);
|
||||
assert(CGAL::internal::exact_num_edges(f.m) == 8);
|
||||
assert(boost::distance(CGAL::halfedges_around_face(h1, f.m)) == 5);
|
||||
|
|
@ -279,13 +277,13 @@ split_join_vertex_inverse()
|
|||
boost::tie(h, found) = halfedge(f.w, f.x, f.m);
|
||||
assert(found);
|
||||
CGAL::Euler::join_vertex(h,f.m);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
boost::tie(h1, found) = halfedge(f.z, f.x, f.m);
|
||||
assert(found);
|
||||
boost::tie(h2, found) = halfedge(f.v, f.x, f.m);
|
||||
assert(found);
|
||||
CGAL::Euler::join_vertex(CGAL::Euler::split_vertex(h1, h2,f.m),f.m);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
|
||||
assert(CGAL::internal::exact_num_vertices(f.m)== 5);
|
||||
assert(CGAL::internal::exact_num_faces(f.m) == 2);
|
||||
|
|
@ -305,7 +303,7 @@ join_loop_test()
|
|||
|
||||
CGAL::Euler::join_loop(f.h1, f.h2, f.m);
|
||||
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
@ -319,7 +317,7 @@ split_loop_test()
|
|||
assert(CGAL::internal::exact_num_vertices(f.m) == 8);
|
||||
assert(CGAL::internal::exact_num_faces(f.m) == 8);
|
||||
assert(CGAL::internal::exact_num_halfedges(f.m) == 24);
|
||||
assert(CGAL::is_valid(f.m));
|
||||
assert(CGAL::is_valid_polygon_mesh(f.m));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ void test_read(const Graph& g)
|
|||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
assert(CGAL::is_valid(fg));
|
||||
assert(CGAL::is_valid_polygon_mesh(fg));
|
||||
}
|
||||
|
||||
template <typename Graph>
|
||||
|
|
@ -357,7 +357,7 @@ void test_mesh(Adapter fga)
|
|||
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
//check that there is the right number of simplices in fga
|
||||
CGAL_assertion(CGAL::is_valid(fga));
|
||||
CGAL_assertion(CGAL::is_valid_polygon_mesh(fga));
|
||||
CGAL_assertion(num_faces(fga) == 2);
|
||||
CGAL_assertion(num_edges(fga) == 5);
|
||||
CGAL_assertion(num_halfedges(fga) == 10);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
|
||||
#include <CGAL/Surface_mesh/IO.h>
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
|
@ -56,7 +55,7 @@ int main()
|
|||
}
|
||||
|
||||
assert(index == 25);
|
||||
assert(is_valid(sm));
|
||||
assert(is_valid_polygon_mesh(sm));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ template <typename Graph>
|
|||
struct Surface_fixture_1 {
|
||||
Surface_fixture_1() {
|
||||
assert(read_a_mesh(m, "data/fixture1.off"));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
|
||||
pm = get(CGAL::vertex_point, const_cast<const Graph&>(m));
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ template <typename Graph>
|
|||
struct Surface_fixture_2 {
|
||||
Surface_fixture_2() {
|
||||
assert(read_a_mesh(m, "data/fixture2.off"));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
|
||||
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
|
||||
pm = get(CGAL::vertex_point, const_cast<const Graph&>(m));
|
||||
|
|
@ -267,7 +267,7 @@ template <typename Graph>
|
|||
struct Surface_fixture_3 {
|
||||
Surface_fixture_3() {
|
||||
assert(read_a_mesh(m, "data/fixture3.off"));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
|
||||
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
|
||||
pm = get(CGAL::vertex_point, const_cast<const Graph&>(m));
|
||||
|
|
@ -313,7 +313,7 @@ template <typename Graph>
|
|||
struct Surface_fixture_4 {
|
||||
Surface_fixture_4() {
|
||||
assert(read_a_mesh(m, "data/fixture4.off"));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
|
||||
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
|
||||
pm = get(CGAL::vertex_point, const_cast<const Graph&>(m));
|
||||
|
|
@ -348,7 +348,7 @@ template <typename Graph>
|
|||
struct Surface_fixture_5 {
|
||||
Surface_fixture_5() {
|
||||
assert(read_a_mesh(m, "data/add_face_to_border.off"));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
|
||||
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
|
||||
pm = get(CGAL::vertex_point, const_cast<const Graph&>(m));
|
||||
|
|
@ -378,7 +378,7 @@ template <typename Graph>
|
|||
struct Surface_fixture_6 {
|
||||
Surface_fixture_6() {
|
||||
assert(read_a_mesh(m, "data/quad.off"));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
|
||||
typename boost::graph_traits<Graph>::halfedge_descriptor h;
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ template <typename Graph>
|
|||
struct Surface_fixture_7 {
|
||||
Surface_fixture_7() {
|
||||
assert(read_a_mesh(m, "data/cube.off"));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
|
||||
h = *(halfedges(m).first);
|
||||
}
|
||||
|
|
@ -410,7 +410,7 @@ template <typename Graph>
|
|||
struct Surface_fixture_8 {
|
||||
Surface_fixture_8() {
|
||||
assert(read_a_mesh(m, "data/fixture5.off"));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
|
||||
typename boost::property_map<Graph, CGAL::vertex_point_t>::const_type
|
||||
pm = get(CGAL::vertex_point, const_cast<const Graph&>(m));
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
|
||||
|
||||
#include <CGAL/Polyhedron_items_with_id_3.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
#include <CGAL/Linear_cell_complex_for_bgl_combinatorial_map_helper.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/boost/graph/iterator.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ void test() {
|
|||
std::cout << "Error reading file: " << fname << std::endl;
|
||||
}
|
||||
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
|
||||
CGAL::clear(m);
|
||||
assert(num_vertices(m) == 0);
|
||||
assert(num_faces(m) == 0);
|
||||
assert(num_edges(m) == 0);
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
|||
|
|
@ -254,9 +254,10 @@ void test_faces(const G& g)
|
|||
template<typename G>
|
||||
void test_read(const G& g)
|
||||
{
|
||||
assert(CGAL::is_valid(g));
|
||||
assert(CGAL::is_valid_polygon_mesh(g));
|
||||
}
|
||||
|
||||
|
||||
template <typename Graph>
|
||||
void
|
||||
test(const std::vector<Graph>& graphs)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
|
|
@ -25,9 +26,85 @@ test(const char *fname, bool triangle, bool quad, bool tetrahedron, bool hexahed
|
|||
assert(CGAL::is_hexahedron(hd, m) == hexahedron);
|
||||
}
|
||||
|
||||
template <typename Mesh>
|
||||
void
|
||||
test_validity(Mesh& mesh)
|
||||
{
|
||||
typedef typename boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<Mesh>::edge_descriptor edge_descriptor;
|
||||
typedef typename boost::graph_traits<Mesh>::face_descriptor face_descriptor;
|
||||
typedef typename boost::property_map<Mesh, CGAL::vertex_point_t>::type VPMap;
|
||||
VPMap vpmap = get(CGAL::vertex_point, mesh);
|
||||
vertex_descriptor vertices[4];
|
||||
edge_descriptor edges[4];
|
||||
vertices[0] = add_vertex(mesh);
|
||||
vertices[1] = add_vertex(mesh);
|
||||
vertices[2] = add_vertex(mesh);
|
||||
vertices[3] = add_vertex(mesh);
|
||||
|
||||
put(vpmap, vertices[0], Point_3(0,0,0));
|
||||
put(vpmap, vertices[1], Point_3(1,0,0));
|
||||
put(vpmap, vertices[2], Point_3(1,1,0));
|
||||
put(vpmap, vertices[3], Point_3(0,1,0));
|
||||
|
||||
edges[0] = add_edge(mesh);
|
||||
edges[1] = add_edge(mesh);
|
||||
edges[2] = add_edge(mesh);
|
||||
edges[3] = add_edge(mesh);
|
||||
|
||||
assert(!CGAL::is_valid_halfedge_graph(mesh));
|
||||
for(int i=0; i<4; ++i)
|
||||
{
|
||||
set_target(halfedge(edges[i], mesh), vertices[i], mesh);
|
||||
set_halfedge(vertices[i], halfedge(edges[i], mesh), mesh);
|
||||
}
|
||||
|
||||
for(int i=0; i<4; ++i)
|
||||
set_target(opposite(halfedge(edges[i], mesh), mesh), vertices[(i+1)%4], mesh);
|
||||
for(int i=0; i<4; ++i)
|
||||
{
|
||||
set_next(halfedge(edges[(i+1)%4], mesh), halfedge(edges[i], mesh), mesh);
|
||||
set_next(opposite(halfedge(edges[i], mesh), mesh),
|
||||
opposite(halfedge(edges[(i+1)%4], mesh), mesh), mesh);
|
||||
}
|
||||
|
||||
assert(CGAL::is_valid_halfedge_graph(mesh));
|
||||
face_descriptor faces[1];
|
||||
faces[0] = add_face(mesh);
|
||||
assert(!CGAL::is_valid_face_graph(mesh));
|
||||
|
||||
for(int i=0; i<4; ++i)
|
||||
{
|
||||
set_face(opposite(halfedge(edges[i], mesh), mesh), faces[0], mesh);
|
||||
}
|
||||
set_halfedge(faces[0], opposite(halfedge(edges[0], mesh), mesh), mesh);
|
||||
assert(CGAL::is_valid_face_graph(mesh));
|
||||
assert(CGAL::is_valid_polygon_mesh(mesh));
|
||||
|
||||
Mesh dummy;
|
||||
vertices[0] = add_vertex(dummy);
|
||||
vertices[1] = add_vertex(dummy);
|
||||
edges[0] = add_edge(dummy);
|
||||
set_target(halfedge(edges[0], dummy), vertices[0], dummy);
|
||||
set_halfedge(vertices[0], halfedge(edges[0], dummy), dummy);
|
||||
set_target(opposite(halfedge(edges[0], dummy), dummy), vertices[1], dummy);
|
||||
set_halfedge(vertices[1], opposite(halfedge(edges[0], dummy), dummy), dummy);
|
||||
set_next(halfedge(edges[0], dummy), opposite(halfedge(edges[0], dummy), dummy), dummy);
|
||||
set_next(opposite(halfedge(edges[0], dummy), dummy), halfedge(edges[0], dummy), dummy);
|
||||
faces[0] = add_face(dummy);
|
||||
set_halfedge(faces[0], opposite(halfedge(edges[0], dummy), dummy), dummy);
|
||||
set_face(halfedge(edges[0], dummy), faces[0], dummy);
|
||||
set_face(opposite(halfedge(edges[0], dummy), dummy), faces[0], dummy);
|
||||
assert(CGAL::is_valid_face_graph(dummy));
|
||||
assert(!CGAL::is_valid_polygon_mesh(dummy));
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef CGAL::Surface_mesh<Point_3> Mesh;
|
||||
Mesh mesh;
|
||||
test_validity(mesh);
|
||||
// triangle quad tetra hexa
|
||||
test<Mesh>("data/triangle.off", true, false, false, false );
|
||||
test<Mesh>("data/quad.off", false, true, false, false );
|
||||
|
|
@ -43,43 +120,42 @@ int main()
|
|||
halfedge_descriptor hd;
|
||||
hd = CGAL::make_triangle(a,b,c,m);
|
||||
assert(CGAL::is_isolated_triangle(hd,m));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
m.clear();
|
||||
hd = CGAL::make_quad(a,b,c,d,m);
|
||||
assert(CGAL::is_isolated_quad(hd,m));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
assert(CGAL::is_quad_mesh(m));
|
||||
m.clear();
|
||||
hd = CGAL::make_tetrahedron(a,b,c,d,m);
|
||||
assert(CGAL::is_tetrahedron(hd,m));
|
||||
assert(CGAL::is_triangle_mesh(m));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
m.clear();
|
||||
hd = CGAL::make_hexahedron(a,b,c,d,aa,bb,cc,dd,m);
|
||||
assert(CGAL::is_hexahedron(hd,m));
|
||||
assert(CGAL::is_quad_mesh(m));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
m.clear();
|
||||
CGAL::make_icosahedron<Mesh, Point_3>(m);
|
||||
assert(num_faces(m) == 20);
|
||||
assert(CGAL::is_triangle_mesh(m));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
m.clear();
|
||||
hd = CGAL::make_pyramid<Mesh, Point_3>(3, m);
|
||||
assert(num_faces(m) == 6);
|
||||
assert(CGAL::is_triangle_mesh(m));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
m.clear();
|
||||
hd = CGAL::make_regular_prism<Mesh, Point_3>(4, m);
|
||||
assert(num_faces(m) == 16);
|
||||
assert(CGAL::is_triangle_mesh(m));
|
||||
assert(CGAL::is_valid(m));
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
m.clear();
|
||||
CGAL::make_grid(3,3,m);
|
||||
assert(num_faces(m) == 9);
|
||||
assert(CGAL::is_quad_mesh(m));
|
||||
assert(CGAL::is_valid(m));
|
||||
|
||||
assert(CGAL::is_valid_polygon_mesh(m));
|
||||
std::cerr << "done" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include <CGAL/CORE/extLong.h>
|
||||
#include <CGAL/atomic.h>
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#ifdef CGAL_HEADER_ONLY
|
||||
|
||||
|
|
@ -54,7 +55,7 @@
|
|||
#else // CGAL_HEADER_ONLY
|
||||
|
||||
#define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE) \
|
||||
CGAL_CORE_EXPORT extern TYPE NAME; \
|
||||
CGAL_EXPORT extern TYPE NAME; \
|
||||
inline TYPE& get_static_##NAME() \
|
||||
{ \
|
||||
return NAME; \
|
||||
|
|
@ -340,4 +341,8 @@ inline void setPositionalFormat(std::ostream& o = std::cout) {
|
|||
#include <CGAL/CORE/CoreDefs_impl.h>
|
||||
#endif // CGAL_HEADER_ONLY
|
||||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#undef CGAL_GLOBAL_STATE_VAR
|
||||
|
||||
#endif // _CORE_COREDEFS_H_
|
||||
|
|
|
|||
|
|
@ -699,3 +699,5 @@ static int GifError(const char *st) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
#undef CGAL_GLOBAL_STATE_VAR
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ VertexIndexMap vertex_id_map;
|
|||
typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap;
|
||||
VertexIdPropertyMap vertex_index_pmap(vertex_id_map);
|
||||
|
||||
void mstIpelet::protected_run(int fn)
|
||||
void mstIpelet::protected_run(int /*fn*/)
|
||||
{
|
||||
std::list<Point_2> pt_list;
|
||||
|
||||
|
|
|
|||
|
|
@ -3181,6 +3181,7 @@ namespace CartesianKernelFunctors {
|
|||
typedef typename K::Line_3 Line_3;
|
||||
typedef typename K::Triangle_3 Triangle_3;
|
||||
typedef typename K::Segment_3 Segment_3;
|
||||
typedef typename K::Ray_3 Ray_3;
|
||||
typedef typename K::FT FT;
|
||||
public:
|
||||
typedef Point_3 result_type;
|
||||
|
|
@ -3215,6 +3216,10 @@ namespace CartesianKernelFunctors {
|
|||
Point_3
|
||||
operator()( const Segment_3& s, const Point_3& p ) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,s,K()); }
|
||||
|
||||
Point_3
|
||||
operator()( const Ray_3& r, const Point_3& p ) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,r,K()); }
|
||||
};
|
||||
|
||||
template <class K>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#define CGAL_NO_DEPRECATION_WARNINGS
|
||||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Algebraic_kernel_for_circles_2_2.h>
|
||||
#include <CGAL/Circular_kernel_2.h>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#define CGAL_NO_DEPRECATION_WARNINGS
|
||||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Exact_circular_kernel_2.h>
|
||||
#include <CGAL/intersections.h>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#define CGAL_NO_DEPRECATION_WARNINGS
|
||||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Algebraic_kernel_for_circles_2_2.h>
|
||||
#include <CGAL/Circular_kernel_2.h>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
// and a STREP (FET Open) Project under Contract No IST-006413
|
||||
// (ACS -- Algorithms for Complex Shapes)
|
||||
|
||||
#define CGAL_NO_DEPRECATION_WARNINGS 1
|
||||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Exact_circular_kernel_2.h>
|
||||
|
|
|
|||
|
|
@ -11,12 +11,9 @@ include(${CGAL_USE_FILE})
|
|||
|
||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
|
||||
|
||||
find_package(QGLViewer)
|
||||
|
||||
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND )
|
||||
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||
|
||||
|
||||
include_directories (${QGLVIEWER_INCLUDE_DIR})
|
||||
include_directories (BEFORE ../../include ./ )
|
||||
|
||||
add_executable (Circular_kernel_3 Circular_kernel_3.cpp Viewer.cpp ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
|
||||
|
|
@ -25,7 +22,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND )
|
|||
|
||||
target_link_libraries( Circular_kernel_3 PRIVATE
|
||||
CGAL::CGAL CGAL::CGAL_Qt5
|
||||
Qt5::OpenGL Qt5::Gui ${QGLVIEWER_LIBRARIES} )
|
||||
Qt5::OpenGL Qt5::Gui)
|
||||
|
||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||
cgal_add_compilation_test(Circular_kernel_3)
|
||||
|
|
@ -35,6 +32,6 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND )
|
|||
|
||||
else()
|
||||
|
||||
message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, and Qt5, and will not be compiled.")
|
||||
message(STATUS "NOTICE: This demo requires CGAL, and Qt5, and will not be compiled.")
|
||||
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
|
||||
Viewer::Viewer(QWidget* parent )
|
||||
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent)
|
||||
: CGAL::QGLViewer(parent)
|
||||
{
|
||||
extension_is_found = false;
|
||||
}
|
||||
|
|
@ -316,8 +316,8 @@ void Viewer::compute_elements()
|
|||
|
||||
|
||||
|
||||
P = rings*M_PI/180.0;
|
||||
T = t*M_PI/180.0;
|
||||
P = rings*CGAL_PI/180.0;
|
||||
T = t*CGAL_PI/180.0;
|
||||
x[1] = sin(P) * cos(T) ;
|
||||
y[1] = sin(P) * sin(T) ;
|
||||
z[1] = cos(P);
|
||||
|
|
@ -331,8 +331,8 @@ void Viewer::compute_elements()
|
|||
normals.push_back(z[1]);
|
||||
|
||||
//
|
||||
P = rings*M_PI/180.0;
|
||||
T = (t+sectors)*M_PI/180.0;
|
||||
P = rings*CGAL_PI/180.0;
|
||||
T = (t+sectors)*CGAL_PI/180.0;
|
||||
x[2] = sin(P) * cos(T) ;
|
||||
y[2] = sin(P) * sin(T) ;
|
||||
z[2] = cos(P);
|
||||
|
|
@ -351,8 +351,8 @@ void Viewer::compute_elements()
|
|||
for(int t=0; t<360; t+=sectors)
|
||||
{
|
||||
//A
|
||||
P = p*M_PI/180.0;
|
||||
T = t*M_PI/180.0;
|
||||
P = p*CGAL_PI/180.0;
|
||||
T = t*CGAL_PI/180.0;
|
||||
x[0] = sin(P) * cos(T) ;
|
||||
y[0] = sin(P) * sin(T) ;
|
||||
z[0] = cos(P);
|
||||
|
|
@ -367,8 +367,8 @@ void Viewer::compute_elements()
|
|||
normals.push_back(z[0]);
|
||||
|
||||
//B
|
||||
P = (p+rings)*M_PI/180.0;
|
||||
T = t*M_PI/180.0;
|
||||
P = (p+rings)*CGAL_PI/180.0;
|
||||
T = t*CGAL_PI/180.0;
|
||||
x[1] = sin(P) * cos(T) ;
|
||||
y[1] = sin(P) * sin(T) ;
|
||||
z[1] = cos(P);
|
||||
|
|
@ -382,8 +382,8 @@ void Viewer::compute_elements()
|
|||
normals.push_back(z[1]);
|
||||
|
||||
//C
|
||||
P = p*M_PI/180.0;
|
||||
T = (t+sectors)*M_PI/180.0;
|
||||
P = p*CGAL_PI/180.0;
|
||||
T = (t+sectors)*CGAL_PI/180.0;
|
||||
x[2] = sin(P) * cos(T) ;
|
||||
y[2] = sin(P) * sin(T) ;
|
||||
z[2] = cos(P);
|
||||
|
|
@ -396,8 +396,8 @@ void Viewer::compute_elements()
|
|||
normals.push_back(y[2]);
|
||||
normals.push_back(z[2]);
|
||||
//D
|
||||
P = (p+rings)*M_PI/180.0;
|
||||
T = (t+sectors)*M_PI/180.0;
|
||||
P = (p+rings)*CGAL_PI/180.0;
|
||||
T = (t+sectors)*CGAL_PI/180.0;
|
||||
x[3] = sin(P) * cos(T) ;
|
||||
y[3] = sin(P) * sin(T) ;
|
||||
z[3] = cos(P);
|
||||
|
|
@ -446,8 +446,8 @@ void Viewer::compute_elements()
|
|||
normals.push_back(-1);
|
||||
|
||||
|
||||
P = (180-rings)*M_PI/180.0;
|
||||
T = t*M_PI/180.0;
|
||||
P = (180-rings)*CGAL_PI/180.0;
|
||||
T = t*CGAL_PI/180.0;
|
||||
x[1] = sin(P) * cos(T) ;
|
||||
y[1] = sin(P) * sin(T) ;
|
||||
z[1] = cos(P);
|
||||
|
|
@ -461,8 +461,8 @@ void Viewer::compute_elements()
|
|||
normals.push_back(z[1]);
|
||||
|
||||
|
||||
P = (180-rings)*M_PI/180.0;
|
||||
T = (t+sectors)*M_PI/180.0;
|
||||
P = (180-rings)*CGAL_PI/180.0;
|
||||
T = (t+sectors)*CGAL_PI/180.0;
|
||||
x[2] = sin(P) * cos(T) ;
|
||||
y[2] = sin(P) * sin(T) ;
|
||||
z[2] = cos(P);
|
||||
|
|
@ -501,8 +501,8 @@ void Viewer::compute_elements()
|
|||
|
||||
|
||||
|
||||
P = rings*M_PI/180.0;
|
||||
T = t*M_PI/180.0;
|
||||
P = rings*CGAL_PI/180.0;
|
||||
T = t*CGAL_PI/180.0;
|
||||
x[1] = sin(P) * cos(T) ;
|
||||
y[1] = sin(P) * sin(T) ;
|
||||
z[1] = cos(P);
|
||||
|
|
@ -516,8 +516,8 @@ void Viewer::compute_elements()
|
|||
normals_inter.push_back(z[1]);
|
||||
|
||||
//
|
||||
P = rings*M_PI/180.0;
|
||||
T = (t+sectors)*M_PI/180.0;
|
||||
P = rings*CGAL_PI/180.0;
|
||||
T = (t+sectors)*CGAL_PI/180.0;
|
||||
x[2] = sin(P) * cos(T) ;
|
||||
y[2] = sin(P) * sin(T) ;
|
||||
z[2] = cos(P);
|
||||
|
|
@ -536,8 +536,8 @@ void Viewer::compute_elements()
|
|||
for(int t=0; t<360; t+=sectors)
|
||||
{
|
||||
//A
|
||||
P = p*M_PI/180.0;
|
||||
T = t*M_PI/180.0;
|
||||
P = p*CGAL_PI/180.0;
|
||||
T = t*CGAL_PI/180.0;
|
||||
x[0] = sin(P) * cos(T) ;
|
||||
y[0] = sin(P) * sin(T) ;
|
||||
z[0] = cos(P);
|
||||
|
|
@ -552,8 +552,8 @@ void Viewer::compute_elements()
|
|||
normals_inter.push_back(z[0]);
|
||||
|
||||
//B
|
||||
P = (p+rings)*M_PI/180.0;
|
||||
T = t*M_PI/180.0;
|
||||
P = (p+rings)*CGAL_PI/180.0;
|
||||
T = t*CGAL_PI/180.0;
|
||||
x[1] = sin(P) * cos(T) ;
|
||||
y[1] = sin(P) * sin(T) ;
|
||||
z[1] = cos(P);
|
||||
|
|
@ -567,8 +567,8 @@ void Viewer::compute_elements()
|
|||
normals_inter.push_back(z[1]);
|
||||
|
||||
//C
|
||||
P = p*M_PI/180.0;
|
||||
T = (t+sectors)*M_PI/180.0;
|
||||
P = p*CGAL_PI/180.0;
|
||||
T = (t+sectors)*CGAL_PI/180.0;
|
||||
x[2] = sin(P) * cos(T) ;
|
||||
y[2] = sin(P) * sin(T) ;
|
||||
z[2] = cos(P);
|
||||
|
|
@ -581,8 +581,8 @@ void Viewer::compute_elements()
|
|||
normals_inter.push_back(y[2]);
|
||||
normals_inter.push_back(z[2]);
|
||||
//D
|
||||
P = (p+rings)*M_PI/180.0;
|
||||
T = (t+sectors)*M_PI/180.0;
|
||||
P = (p+rings)*CGAL_PI/180.0;
|
||||
T = (t+sectors)*CGAL_PI/180.0;
|
||||
x[3] = sin(P) * cos(T) ;
|
||||
y[3] = sin(P) * sin(T) ;
|
||||
z[3] = cos(P);
|
||||
|
|
@ -631,8 +631,8 @@ void Viewer::compute_elements()
|
|||
normals_inter.push_back(-1);
|
||||
|
||||
|
||||
P = (180-rings)*M_PI/180.0;
|
||||
T = t*M_PI/180.0;
|
||||
P = (180-rings)*CGAL_PI/180.0;
|
||||
T = t*CGAL_PI/180.0;
|
||||
x[1] = sin(P) * cos(T) ;
|
||||
y[1] = sin(P) * sin(T) ;
|
||||
z[1] = cos(P);
|
||||
|
|
@ -646,8 +646,8 @@ void Viewer::compute_elements()
|
|||
normals_inter.push_back(z[1]);
|
||||
|
||||
|
||||
P = (180-rings)*M_PI/180.0;
|
||||
T = (t+sectors)*M_PI/180.0;
|
||||
P = (180-rings)*CGAL_PI/180.0;
|
||||
T = (t+sectors)*CGAL_PI/180.0;
|
||||
x[2] = sin(P) * cos(T) ;
|
||||
y[2] = sin(P) * sin(T) ;
|
||||
z[2] = cos(P);
|
||||
|
|
@ -722,7 +722,7 @@ void Viewer::compute_elements()
|
|||
}
|
||||
}
|
||||
|
||||
void Viewer::attrib_buffers(QGLViewer* viewer)
|
||||
void Viewer::attrib_buffers(CGAL::QGLViewer* viewer)
|
||||
{
|
||||
QMatrix4x4 mvpMatrix;
|
||||
QMatrix4x4 mvMatrix;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <QMap>
|
||||
#include <QGLViewer/qglviewer.h>
|
||||
#include <CGAL/Qt/qglviewer.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC;
|
||||
|
||||
class Viewer : public QGLViewer, QOpenGLFunctions_2_1
|
||||
class Viewer : public CGAL::QGLViewer
|
||||
{
|
||||
public:
|
||||
Viewer(QWidget* parent = 0);
|
||||
|
|
@ -52,7 +52,7 @@ private:
|
|||
|
||||
void initialize_buffers();
|
||||
void compute_elements();
|
||||
void attrib_buffers(QGLViewer*);
|
||||
void attrib_buffers(CGAL::QGLViewer*);
|
||||
void compile_shaders();
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ private:
|
|||
launch_feature_computation (new Feature_adder_verticality<VectorMap> (this, normal_map, 0));
|
||||
}
|
||||
|
||||
void generate_normal_based_features(const CGAL::Default_property_map<Iterator, typename GeomTraits::Vector_3>&)
|
||||
void generate_normal_based_features(const CGAL::Constant_property_map<Iterator, typename GeomTraits::Vector_3>&)
|
||||
{
|
||||
generate_multiscale_feature_variant_0<Verticality> ();
|
||||
}
|
||||
|
|
@ -544,7 +544,7 @@ private:
|
|||
2, 25.f * float(i), 12.5f));
|
||||
}
|
||||
|
||||
void generate_color_based_features(const CGAL::Default_property_map<Iterator, RGB_Color>&)
|
||||
void generate_color_based_features(const CGAL::Constant_property_map<Iterator, RGB_Color>&)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -581,7 +581,7 @@ private:
|
|||
launch_feature_computation (new Feature_adder_echo<EchoMap> (this, echo_map, i));
|
||||
}
|
||||
|
||||
void generate_echo_based_features(const CGAL::Default_property_map<Iterator, std::size_t>&)
|
||||
void generate_echo_based_features(const CGAL::Constant_property_map<Iterator, std::size_t>&)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -615,10 +615,10 @@ private:
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
Default_property_map<Iterator, T>
|
||||
Constant_property_map<Iterator, T>
|
||||
get_parameter (const Default&)
|
||||
{
|
||||
return Default_property_map<Iterator, T>();
|
||||
return Constant_property_map<Iterator, T>();
|
||||
}
|
||||
|
||||
template<typename VectorMap, typename ColorMap, typename EchoMap>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#include <cstdlib>
|
||||
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#define CGAL_NO_DEPRECATION_WARNINGS 1
|
||||
#define CGAL_CMAP_DART_DEPRECATED 1
|
||||
|
||||
#include <CGAL/Combinatorial_map.h>
|
||||
|
|
@ -88,12 +87,3 @@ int main()
|
|||
std::cout<<" Success."<<std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#else // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
int main()
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <CGAL/point_generators_3.h>
|
||||
|
||||
#include <vector>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#define CGAL_NO_DEPRECATION_WARNINGS
|
||||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Homogeneous.h>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#define CGAL_NO_DEPRECATION_WARNINGS
|
||||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Homogeneous_d.h>
|
||||
|
|
|
|||
|
|
@ -41,11 +41,6 @@ make
|
|||
where the second line creates a `CMakeLists.txt` file (check
|
||||
its options in Section \ref seccreate_cgal_CMakeLists for various details).
|
||||
|
||||
Note that, until CGAL 4.6, \ref seccreate_cgal_CMakeLists only recognized
|
||||
source files ending in `.cpp` or `.C`; if the above fails on the `cmake` command
|
||||
or produces an empty `Makefile`, check whether your source files go by such a name.
|
||||
Recent versions find all source files ending in
|
||||
`.cc`, `.cp`, `.cxx`, `.cpp`, `.CPP`, `.c++`, or `.C`.
|
||||
|
||||
In a less ideal world, you probably have to install CMake, a makefile
|
||||
generator, and third party libraries. That is what this manual is about.
|
||||
|
|
@ -105,7 +100,7 @@ It is a self extracting executable that installs the \cgal source, and that allo
|
|||
to select and download some precompiled third party libraries. However, you will need to compile
|
||||
the library using your favorite compiler.
|
||||
|
||||
A <a href="https://www.cgal.org/windows_installation.html">tutorial</a> is provided on how to proceed with Microsoft Visual Studio 2010.
|
||||
A <a href="https://www.cgal.org/windows_installation.html">tutorial</a> is provided on how to proceed with Microsoft Visual Studio.
|
||||
|
||||
|
||||
|
||||
|
|
@ -157,17 +152,18 @@ installation manual. The \cgal manual must be downloaded separately from
|
|||
\section seccompilers Supported Compilers
|
||||
|
||||
In order to build the \cgal libraries, you need a \cpp compiler.
|
||||
\cgal \cgalReleaseNumber is supported for the following compilers/operating systems:
|
||||
\cgal \cgalReleaseNumber is supported, that is continuously tested, for the following compilers/operating systems:
|
||||
|
||||
|
||||
| Compiler | Operating System |
|
||||
| :------- | :--------------- |
|
||||
|\sc{Gnu} `g++` 4.1 or later\cgalFootnote{<A HREF="http://gcc.gnu.org/">`http://gcc.gnu.org/`</A>} | Linux / MacOS X |
|
||||
| | \sc{MS} Windows 95/98/2000/XP/NT4 |
|
||||
| \sc{Intel} `C++` 15.0\cgalFootnote{<A HREF="http://software.intel.com/en-us/intel-compilers/">`http://software.intel.com/en-us/intel-compilers/`</A>} | Linux |
|
||||
|\sc{MS} Visual `C++` 10.0, 11.0, 12.0, 14.0 (\sc{Visual Studio} 2010, 2012, 2013, and 2015)\cgalFootnote{<A HREF="http://msdn.microsoft.com/en-us/vstudio/">`http://msdn.microsoft.com/en-us/vstudio/`</A>} | \sc{MS} Windows 95/98/2000/XP/NT4/Vista/7/8 |
|
||||
| `Clang` \cgalFootnote{<A HREF="http://clang.llvm.org/">`http://clang.llvm.org/`</A>} compiler version 3.5 and 3.6.2 | Linux / MacOS X |
|
||||
| Apple `Clang` compiler version 6.0 and 4.2 | MacOS X |
|
||||
| | \sc{MS} Windows |
|
||||
|\sc{MS} Visual `C++` 12.0, 14.0, 15.0 (\sc{Visual Studio} 2013, 2015, and 2017)\cgalFootnote{<A HREF="http://msdn.microsoft.com/en-us/vstudio/">`http://msdn.microsoft.com/en-us/vstudio/`</A>} | \sc{MS} Windows |
|
||||
| `Clang` \cgalFootnote{<A HREF="http://clang.llvm.org/">`http://clang.llvm.org/`</A>} compiler version 6.0.0 | Linux |
|
||||
| Apple `Clang` compiler version 7.0.2 | MacOS X |
|
||||
|
||||
It may work for older versions of the above listed compilers.
|
||||
|
||||
|
||||
\section secconfigwithcmake Configuring CGAL with CMake
|
||||
|
|
@ -247,11 +243,11 @@ generators are added with each release.
|
|||
Since the choice of the generator determines the type of build files to generate, in some cases
|
||||
you choose a particular generator as a mean to choose a specific compiler (because they use different
|
||||
build files). For example, the following generates solution files for
|
||||
use in Visual \cpp 11.0 on a 64bit machine:
|
||||
use in Visual \cpp 15.0 on a 64bit machine:
|
||||
|
||||
<PRE>
|
||||
cd CGAL-\cgalReleaseNumber
|
||||
cmake -G"Visual Studio 11 Win64" .
|
||||
cmake -G"Visual Studio 15 2017 Win64" .
|
||||
</PRE>
|
||||
|
||||
In other cases, however, the generator doesn't directly identify a
|
||||
|
|
@ -381,8 +377,8 @@ libCGAL_Core, libCGAL_ImageIO, and libCGAL_Qt5).
|
|||
\cgal heavily uses the \stl, and in particular adopted
|
||||
many of its design ideas. You can find online
|
||||
documentation for the \stl at various web sites, for instance,
|
||||
<A HREF="http://www.sgi.com/tech/stl/">`http://www.sgi.com/tech/stl/`</A>, <A HREF="http://www.cplusplus.com/reference/">`http://www.cplusplus.com/reference/`</A>,
|
||||
or <A HREF="http://msdn.microsoft.com/en-us/library/1fe2x6kt(VS.100).aspx">`http://msdn.microsoft.com/en-us/library/1fe2x6kt(VS.100).aspx`</A>.
|
||||
<A HREF="http://www.cplusplus.com/reference/">`http://www.cplusplus.com/reference/`</A>,
|
||||
or <A HREF="https://msdn.microsoft.com/en-us/library/1fe2x6kt(v=vs.140).aspx">`https://msdn.microsoft.com/en-us/library/1fe2x6kt(v=vs.140).aspx`</A>.
|
||||
|
||||
The \stl comes with the compiler, so there is nothing to install.
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ body {color: black; background-color: #C0C0D0; font-family: sans-serif;}
|
|||
</style>
|
||||
</head><body>
|
||||
<h1 id="maintitle">Doxygen Manual Results</h1>'''
|
||||
page_footer='''<table class="test-results">
|
||||
page_footer='''<table border="1" cellspacing="2" cellpadding="5" class="test-results">
|
||||
<tr><td/><th colspan="3">Doxygen 1.8.4</th><th colspan="3">Doxygen 1.8.13(official)</th><th colspan="3">Doxygen master</th></tr>
|
||||
<tr>
|
||||
<th>Package Name</th>
|
||||
<th>Logs </th>
|
||||
|
|
@ -101,7 +102,7 @@ body {color: black; background-color: #C0C0D0; font-family: sans-serif;}
|
|||
suffix = ''
|
||||
if args.doxygen_version2:
|
||||
suffix = args.doxygen_version2
|
||||
link2="\n<br><a href=\"output2/Manual/index.html\">Documentation built</a> with <a href=\"https://github.com/CGAL/doxygen\">our fork of Doxygen {_suffix}</a>\n".format(_suffix=suffix)
|
||||
link2="\n<br><a href=\"output2/Manual/index.html\">Documentation built</a> with <a href=\"https://github.com/CGAL/doxygen\">our fork of Doxygen {_suffix} (used for the official CGAL documentation)</a>\n".format(_suffix=suffix)
|
||||
suffix = ''
|
||||
if args.master_describe:
|
||||
suffix=args.master_describe
|
||||
|
|
|
|||
|
|
@ -24,9 +24,7 @@
|
|||
#include <CGAL/Generalized_map_operations.h>
|
||||
#include <CGAL/Random.h>
|
||||
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include <CGAL/Triangulation_data_structure_2.h>
|
||||
#include <CGAL/Triangulation_vertex_base_2.h>
|
||||
|
||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
#include <CGAL/point_generators_3.h>
|
||||
|
||||
|
|
@ -50,11 +49,11 @@ typedef CGAL::Mesh_polyhedron_3<K>::type Polyhedron;
|
|||
// Domain
|
||||
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
|
||||
typedef Mesh_domain::Corner_index Corner_index;
|
||||
typedef Mesh_domain::Curve_segment_index Curve_segment_index;
|
||||
typedef Mesh_domain::Curve_index Curve_index;
|
||||
|
||||
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
|
||||
typedef CGAL::Mesh_complex_3_in_triangulation_3<
|
||||
Tr, Corner_index, Curve_segment_index> C3t3;
|
||||
Tr, Corner_index, Curve_index> C3t3;
|
||||
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
|
||||
typedef C3t3::Point Point;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ if(POLICY CMP0071)
|
|||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC TRUE)
|
||||
set(CMAKE_AUTOUIC TRUE)
|
||||
set(CMAKE_AUTORCC TRUE)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
|
||||
|
||||
find_package(CGAL COMPONENTS Qt5)
|
||||
|
|
@ -32,9 +30,12 @@ add_definitions(-DQT_NO_KEYWORDS)
|
|||
# The "constrained Delaunay" demo: Constrained_Delaunay_triangulation_2
|
||||
#--------------------------------
|
||||
|
||||
qt5_add_resources ( CD_RES_FILE Constrained_Delaunay_triangulation_2.qrc)
|
||||
qt5_wrap_ui( CD_UI_FILES Constrained_Delaunay_triangulation_2.ui)
|
||||
# The executable itself.
|
||||
add_executable( Constrained_Delaunay_triangulation_2
|
||||
Constrained_Delaunay_triangulation_2.cpp)
|
||||
Constrained_Delaunay_triangulation_2.cpp ${CD_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES}
|
||||
${CD_RES_FILE})
|
||||
target_link_libraries( Constrained_Delaunay_triangulation_2
|
||||
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
|
||||
target_include_directories( Constrained_Delaunay_triangulation_2
|
||||
|
|
@ -45,10 +46,11 @@ add_to_cached_list(CGAL_EXECUTABLE_TARGETS Constrained_Delaunay_triangulation_2)
|
|||
#--------------------------------
|
||||
# The "Delaunay" demo: Delaunay_triangulation_2
|
||||
#--------------------------------
|
||||
|
||||
qt5_wrap_ui( D_UI_FILES Delaunay_triangulation_2.ui)
|
||||
qt5_add_resources ( D_RES_FILE Delaunay_triangulation_2.qrc)
|
||||
# The executable itself.
|
||||
add_executable ( Delaunay_triangulation_2
|
||||
Delaunay_triangulation_2.cpp)
|
||||
Delaunay_triangulation_2.cpp ${D_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${D_RES_FILE})
|
||||
target_link_libraries( Delaunay_triangulation_2
|
||||
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
|
||||
|
||||
|
|
@ -59,8 +61,10 @@ add_to_cached_list( CGAL_EXECUTABLE_TARGETS Delaunay_triangulation_2 )
|
|||
#--------------------------------
|
||||
|
||||
# The executable itself.
|
||||
qt5_add_resources ( R_RES_FILE Regular_triangulation_2.qrc)
|
||||
qt5_wrap_ui(R_UI_FILES Regular_triangulation_2.ui)
|
||||
add_executable ( Regular_triangulation_2
|
||||
Regular_triangulation_2.cpp)
|
||||
Regular_triangulation_2.cpp ${R_UI_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${R_RES_FILE})
|
||||
target_link_libraries(Regular_triangulation_2
|
||||
PRIVATE CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Widgets)
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ protected:
|
|||
private:
|
||||
|
||||
DT * dt;
|
||||
typedef typename DT::Vertex_handle Vertex_handle;
|
||||
typename DT::Vertex_handle hint;
|
||||
typename DT::Face_handle fh;
|
||||
QGraphicsScene *scene_;
|
||||
|
|
@ -89,8 +90,12 @@ TriangulationCircumcircle<T>::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
{
|
||||
if(dt->dimension() != 2){
|
||||
circle->hide();
|
||||
hint = Vertex_handle();
|
||||
return;
|
||||
}
|
||||
if (hint == Vertex_handle()){
|
||||
hint = dt->infinite_vertex();
|
||||
}
|
||||
typename T::Point p = typename T::Point(event->scenePos().x(), event->scenePos().y());
|
||||
fh = dt->locate(p, hint->face());
|
||||
hint = fh->vertex(0);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
// SPDX-License-Identifier: LGPL-3.0
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
// SPDX-License-Identifier: LGPL-3.0
|
||||
//
|
||||
//
|
||||
// Author(s) : Laurent Rineau and Maxime Gimeno
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ namespace Qt {
|
|||
class CGAL_QT_EXPORT GraphicsItem : public QObject, public QGraphicsItem {
|
||||
|
||||
Q_OBJECT
|
||||
#ifdef CGAL_HEADER_ONLY
|
||||
Q_INTERFACES(QGraphicsItem)
|
||||
#endif
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,543 @@
|
|||
/****************************************************************************
|
||||
|
||||
Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
|
||||
|
||||
This file is part of the CGAL::QGLViewer library version 2.7.0.
|
||||
|
||||
http://www.libqglviewer.com - contact@libqglviewer.com
|
||||
|
||||
This file may be used under the terms of the GNU General Public License
|
||||
version 3.0 as published by the Free Software Foundation and
|
||||
appearing in the LICENSE file included in the packaging of this file.
|
||||
|
||||
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
|
||||
purchase a libCGAL::QGLViewer Commercial License.
|
||||
|
||||
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
*****************************************************************************/
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
|
||||
#ifndef QGLVIEWER_CAMERA_H
|
||||
#define QGLVIEWER_CAMERA_H
|
||||
#include <QMap>
|
||||
#include <QDomElement>
|
||||
#include <CGAL/Qt/vec.h>
|
||||
#include <CGAL/Qt/quaternion.h>
|
||||
#include <CGAL/export/Qt.h>
|
||||
#include <QOpenGLFunctions_2_1>
|
||||
|
||||
namespace CGAL{
|
||||
class QGLViewer;
|
||||
namespace qglviewer {
|
||||
|
||||
class KeyFrameInterpolator;
|
||||
class Frame;
|
||||
class ManipulatedCameraFrame;
|
||||
|
||||
|
||||
/*! \brief A perspective or orthographic camera.
|
||||
\class Camera camera.h CGAL::QGLViewer/camera.h
|
||||
|
||||
A Camera defines some intrinsic parameters (fieldOfView(), position(),
|
||||
viewDirection(), upVector()...) and useful positioning tools that ease its
|
||||
placement (showEntireScene(), fitSphere(), lookAt()...). It exports its
|
||||
associated OpenGL projection and modelview matrices and can interactively be
|
||||
modified using the mouse.
|
||||
|
||||
<h3>Mouse manipulation</h3>
|
||||
|
||||
The position() and orientation() of the Camera are defined by a
|
||||
ManipulatedCameraFrame (retrieved using frame()). These methods are just
|
||||
convenient wrappers to the equivalent Frame methods. This also means that the
|
||||
Camera frame() can be attached to a Frame::referenceFrame() which enables
|
||||
complex Camera setups.
|
||||
|
||||
Different displacements can be performed using the mouse. The list of possible
|
||||
actions is defined by the CGAL::QGLViewer::MouseAction enum. Use
|
||||
CGAL::QGLViewer::setMouseBinding() to attach a specific action to an arbitrary mouse
|
||||
button-state key binding. These actions are detailed in the <a
|
||||
href="../mouse.html">mouse page</a>.
|
||||
|
||||
The default button binding are: CGAL::QGLViewer::ROTATE (left), CGAL::QGLViewer::ZOOM
|
||||
(middle) and CGAL::QGLViewer::TRANSLATE (right). With this configuration, the Camera
|
||||
\e observes a scene and rotates around its pivotPoint(). You can switch
|
||||
between this mode and a fly mode using the CGAL::QGLViewer::CAMERA_MODE (see
|
||||
CGAL::QGLViewer::toggleCameraMode()) keyboard shortcut (default is 'Space').
|
||||
|
||||
<h3>Other functionalities</h3>
|
||||
|
||||
The type() of the Camera can be Camera::ORTHOGRAPHIC or Camera::PERSPECTIVE
|
||||
(see Type()). fieldOfView() is meaningless with Camera::ORTHOGRAPHIC.
|
||||
|
||||
The near and far planes of the Camera are fitted to the scene and determined
|
||||
from CGAL::QGLViewer::sceneRadius(), CGAL::QGLViewer::sceneCenter() and
|
||||
zClippingCoefficient() by the zNear() and zFar() methods. Reasonable values on
|
||||
the scene extends hence have to be provided to the CGAL::QGLViewer in order for the
|
||||
Camera to correctly display the scene. High level positioning methods also use
|
||||
this information (showEntireScene(), centerScene()...).
|
||||
|
||||
A Camera holds KeyFrameInterpolator that can be used to save Camera positions
|
||||
and paths. You can interactively addKeyFrameToPath() to a given path using the
|
||||
default \c Alt+F[1-12] shortcuts. Use playPath() to make the Camera follow the
|
||||
path (default shortcut is F[1-12]). See the <a
|
||||
href="../keyboard.html">keyboard page</a> for details on key customization.
|
||||
|
||||
Use cameraCoordinatesOf() and worldCoordinatesOf() to convert to and from the
|
||||
Camera frame() coordinate system. projectedCoordinatesOf() and
|
||||
unprojectedCoordinatesOf() will convert from screen to 3D coordinates.
|
||||
convertClickToLine() is very useful for analytical object selection.
|
||||
|
||||
Stereo display is possible on machines with quad buffer capabilities (with
|
||||
Camera::PERSPECTIVE type() only). Test the <a
|
||||
href="../examples/stereoViewer.html">stereoViewer example</a> to check.
|
||||
|
||||
A Camera can also be used outside of a CGAL::QGLViewer or even without OpenGL for
|
||||
its coordinate system conversion capabilities. Note however that some of them
|
||||
explicitly rely on the presence of a Z-buffer. \nosubgrouping */
|
||||
class CGAL_QT_EXPORT Camera : public QObject {
|
||||
#ifndef DOXYGEN
|
||||
friend class ::CGAL::QGLViewer;
|
||||
#endif
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Camera(QObject *parent);
|
||||
virtual ~Camera();
|
||||
|
||||
Camera(const Camera &camera);
|
||||
Camera &operator=(const Camera &camera);
|
||||
|
||||
/*! Enumerates the two possible types of Camera.
|
||||
|
||||
See type() and setType(). This type mainly defines different Camera projection
|
||||
matrix (see loadProjectionMatrix()). Many other methods (pointUnderPixel(),
|
||||
convertClickToLine(), projectedCoordinatesOf(), pixelGLRatio()...) are
|
||||
affected by this Type. */
|
||||
enum Type { PERSPECTIVE, ORTHOGRAPHIC };
|
||||
|
||||
/*! @name Position and orientation */
|
||||
//@{
|
||||
public:
|
||||
Vec position() const;
|
||||
Vec upVector() const;
|
||||
Vec viewDirection() const;
|
||||
Vec rightVector() const;
|
||||
Quaternion orientation() const;
|
||||
|
||||
void setFromModelViewMatrix(const GLdouble *const modelViewMatrix);
|
||||
void setFromProjectionMatrix(const qreal matrix[12]);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setPosition(const Vec &pos);
|
||||
void setOrientation(const Quaternion &q);
|
||||
void setOrientation(qreal theta, qreal phi);
|
||||
void setUpVector(const Vec &up, bool noMove = true);
|
||||
void setViewDirection(const Vec &direction);
|
||||
//@}
|
||||
|
||||
/*! @name Positioning tools */
|
||||
//@{
|
||||
public Q_SLOTS:
|
||||
void lookAt(const Vec &target);
|
||||
void showEntireScene();
|
||||
void fitSphere(const Vec ¢er, qreal radius);
|
||||
void fitBoundingBox(const Vec &min, const Vec &max);
|
||||
void fitScreenRegion(const QRect &rectangle);
|
||||
void centerScene();
|
||||
void interpolateToZoomOnPixel(const QPoint &pixel);
|
||||
void interpolateToFitScene();
|
||||
void interpolateTo(const Frame &fr, qreal duration);
|
||||
//@}
|
||||
|
||||
/*! @name Frustum */
|
||||
//@{
|
||||
public:
|
||||
/*! Returns the Camera::Type of the Camera.
|
||||
|
||||
Set by setType(). Mainly used by loadProjectionMatrix().
|
||||
|
||||
A Camera::PERSPECTIVE Camera uses a classical projection mainly defined by its
|
||||
fieldOfView().
|
||||
|
||||
With a Camera::ORTHOGRAPHIC type(), the fieldOfView() is meaningless and the
|
||||
width and height of the Camera frustum are inferred from the distance to the
|
||||
pivotPoint() using getOrthoWidthHeight().
|
||||
|
||||
Both types use zNear() and zFar() (to define their clipping planes) and
|
||||
aspectRatio() (for frustum shape). */
|
||||
Type type() const { return type_; }
|
||||
|
||||
/*! Returns the vertical field of view of the Camera (in radians).
|
||||
|
||||
Value is set using setFieldOfView(). Default value is pi/4 radians. This value
|
||||
is meaningless if the Camera type() is Camera::ORTHOGRAPHIC.
|
||||
|
||||
The field of view corresponds the one used in \c gluPerspective (see manual).
|
||||
It sets the Y (vertical) aperture of the Camera. The X (horizontal) angle is
|
||||
inferred from the window aspect ratio (see aspectRatio() and
|
||||
horizontalFieldOfView()).
|
||||
|
||||
Use setFOVToFitScene() to adapt the fieldOfView() to a given scene. */
|
||||
qreal fieldOfView() const { return fieldOfView_; }
|
||||
|
||||
/*! Returns the horizontal field of view of the Camera (in radians).
|
||||
|
||||
Value is set using setHorizontalFieldOfView() or setFieldOfView(). These
|
||||
values are always linked by: \code horizontalFieldOfView() = 2.0 * atan (
|
||||
tan(fieldOfView()/2.0) * aspectRatio() ). \endcode */
|
||||
qreal horizontalFieldOfView() const;
|
||||
|
||||
/*! Returns the Camera aspect ratio defined by screenWidth() / screenHeight().
|
||||
|
||||
When the Camera is attached to a CGAL::QGLViewer, these values and hence the
|
||||
aspectRatio() are automatically fitted to the viewer's window aspect ratio
|
||||
using setScreenWidthAndHeight(). */
|
||||
qreal aspectRatio() const {
|
||||
return screenWidth_ / static_cast<qreal>(screenHeight_);
|
||||
}
|
||||
/*! Returns the width (in pixels) of the Camera screen.
|
||||
|
||||
Set using setScreenWidthAndHeight(). This value is automatically fitted to the
|
||||
CGAL::QGLViewer's window dimensions when the Camera is attached to a CGAL::QGLViewer. See
|
||||
also QOpenGLWidget::width() */
|
||||
int screenWidth() const { return screenWidth_; }
|
||||
/*! Returns the height (in pixels) of the Camera screen.
|
||||
|
||||
Set using setScreenWidthAndHeight(). This value is automatically fitted to the
|
||||
CGAL::QGLViewer's window dimensions when the Camera is attached to a CGAL::QGLViewer. See
|
||||
also QOpenGLWidget::height() */
|
||||
int screenHeight() const { return screenHeight_; }
|
||||
void getViewport(GLint viewport[4]) const;
|
||||
qreal pixelGLRatio(const Vec &position) const;
|
||||
|
||||
/*! Returns the coefficient which is used to set zNear() when the Camera is
|
||||
inside the sphere defined by sceneCenter() and zClippingCoefficient() *
|
||||
sceneRadius().
|
||||
|
||||
In that case, the zNear() value is set to zNearCoefficient() *
|
||||
zClippingCoefficient() * sceneRadius(). See the zNear() documentation for
|
||||
details.
|
||||
|
||||
Default value is 0.005, which is appropriate for most applications. In case
|
||||
you need a high dynamic ZBuffer precision, you can increase this value (~0.1).
|
||||
A lower value will prevent clipping of very close objects at the expense of a
|
||||
worst Z precision.
|
||||
|
||||
Only meaningful when Camera type is Camera::PERSPECTIVE. */
|
||||
qreal zNearCoefficient() const { return zNearCoef_; }
|
||||
/*! Returns the coefficient used to position the near and far clipping planes.
|
||||
|
||||
The near (resp. far) clipping plane is positioned at a distance equal to
|
||||
zClippingCoefficient() * sceneRadius() in front of (resp. behind) the
|
||||
sceneCenter(). This garantees an optimal use of the z-buffer range and
|
||||
minimizes aliasing. See the zNear() and zFar() documentations.
|
||||
|
||||
Default value is square root of 3.0 (so that a cube of size sceneRadius() is
|
||||
not clipped).
|
||||
|
||||
However, since the sceneRadius() is used for other purposes (see
|
||||
showEntireScene(), flySpeed(),
|
||||
...) and you may want to change this value to define more precisely the
|
||||
location of the clipping planes. See also zNearCoefficient().
|
||||
|
||||
For a total control on clipping planes' positions, an other option is to
|
||||
overload the zNear() and zFar() methods. See the <a
|
||||
href="../examples/standardCamera.html">standardCamera example</a>.
|
||||
|
||||
\attention When CGAL::QGLViewer::cameraPathAreEdited(), this value is set to 5.0 so
|
||||
that the Camera paths are not clipped. The previous zClippingCoefficient()
|
||||
value is restored back when you leave this mode. */
|
||||
qreal zClippingCoefficient() const { return zClippingCoef_; }
|
||||
|
||||
virtual qreal zNear() const;
|
||||
virtual qreal zFar() const;
|
||||
virtual void getOrthoWidthHeight(GLdouble &halfWidth,
|
||||
GLdouble &halfHeight) const;
|
||||
void getFrustumPlanesCoefficients(GLdouble coef[6][4]) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setType(Type type);
|
||||
|
||||
void setFieldOfView(qreal fov);
|
||||
|
||||
/*! Sets the horizontalFieldOfView() of the Camera (in radians).
|
||||
|
||||
horizontalFieldOfView() and fieldOfView() are linked by the aspectRatio().
|
||||
This method actually calls setFieldOfView(( 2.0 * atan (tan(hfov / 2.0) /
|
||||
aspectRatio()) )) so that a call to horizontalFieldOfView() returns the
|
||||
expected value. */
|
||||
void setHorizontalFieldOfView(qreal hfov);
|
||||
|
||||
void setFOVToFitScene();
|
||||
|
||||
/*! Defines the Camera aspectRatio().
|
||||
|
||||
This value is actually inferred from the screenWidth() / screenHeight() ratio.
|
||||
You should use setScreenWidthAndHeight() instead.
|
||||
|
||||
This method might however be convenient when the Camera is not associated with
|
||||
a CGAL::QGLViewer. It actually sets the screenHeight() to 100 and the screenWidth()
|
||||
accordingly. See also setFOVToFitScene().
|
||||
|
||||
\note If you absolutely need an aspectRatio() that does not correspond to your
|
||||
viewer's window dimensions, overload loadProjectionMatrix() or multiply the
|
||||
created GL_PROJECTION matrix by a scaled diagonal matrix in your
|
||||
CGAL::QGLViewer::draw() method. */
|
||||
void setAspectRatio(qreal aspect) {
|
||||
setScreenWidthAndHeight(int(100.0 * aspect), 100);
|
||||
}
|
||||
|
||||
void setScreenWidthAndHeight(int width, int height);
|
||||
/*! Sets the zNearCoefficient() value. */
|
||||
void setZNearCoefficient(qreal coef) {
|
||||
zNearCoef_ = coef;
|
||||
projectionMatrixIsUpToDate_ = false;
|
||||
}
|
||||
/*! Sets the zClippingCoefficient() value. */
|
||||
void setZClippingCoefficient(qreal coef) {
|
||||
zClippingCoef_ = coef;
|
||||
projectionMatrixIsUpToDate_ = false;
|
||||
}
|
||||
//@}
|
||||
|
||||
/*! @name Scene radius and center */
|
||||
//@{
|
||||
public:
|
||||
/*! Returns the radius of the scene observed by the Camera.
|
||||
|
||||
You need to provide such an approximation of the scene dimensions so that the
|
||||
Camera can adapt its zNear() and zFar() values. See the sceneCenter()
|
||||
documentation.
|
||||
|
||||
See also setSceneBoundingBox().
|
||||
|
||||
Note that CGAL::QGLViewer::sceneRadius() (resp. CGAL::QGLViewer::setSceneRadius()) simply
|
||||
call this method (resp. setSceneRadius()) on its associated
|
||||
CGAL::QGLViewer::camera(). */
|
||||
qreal sceneRadius() const { return sceneRadius_; }
|
||||
|
||||
/*! Returns the position of the scene center, defined in the world coordinate
|
||||
system.
|
||||
|
||||
The scene observed by the Camera should be roughly centered on this position,
|
||||
and included in a sceneRadius() sphere. This approximate description of the
|
||||
scene permits a zNear() and zFar() clipping planes definition, and allows
|
||||
convenient positioning methods such as showEntireScene().
|
||||
|
||||
Default value is (0,0,0) (world origin). Use setSceneCenter() to change it.
|
||||
See also setSceneBoundingBox().
|
||||
|
||||
Note that CGAL::QGLViewer::sceneCenter() (resp. CGAL::QGLViewer::setSceneCenter()) simply
|
||||
calls this method (resp. setSceneCenter()) on its associated
|
||||
CGAL::QGLViewer::camera(). */
|
||||
Vec sceneCenter() const { return sceneCenter_; }
|
||||
qreal distanceToSceneCenter() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setSceneRadius(qreal radius);
|
||||
void setSceneCenter(const Vec ¢er);
|
||||
bool setSceneCenterFromPixel(const QPoint &pixel);
|
||||
void setSceneBoundingBox(const Vec &min, const Vec &max);
|
||||
//@}
|
||||
|
||||
/*! @name Pivot Point */
|
||||
//@{
|
||||
public Q_SLOTS:
|
||||
void setPivotPoint(const Vec &point);
|
||||
bool setPivotPointFromPixel(const QPoint &pixel);
|
||||
|
||||
public:
|
||||
Vec pivotPoint() const;
|
||||
|
||||
//@}
|
||||
|
||||
/*! @name Associated frame */
|
||||
//@{
|
||||
public:
|
||||
/*! Returns the ManipulatedCameraFrame attached to the Camera.
|
||||
|
||||
This ManipulatedCameraFrame defines its position() and orientation() and can
|
||||
translate mouse events into Camera displacement. Set using setFrame(). */
|
||||
ManipulatedCameraFrame *frame() const { return frame_; }
|
||||
public Q_SLOTS:
|
||||
void setFrame(ManipulatedCameraFrame *const mcf);
|
||||
//@}
|
||||
|
||||
/*! @name KeyFramed paths */
|
||||
//@{
|
||||
public:
|
||||
KeyFrameInterpolator *keyFrameInterpolator(unsigned int i) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setKeyFrameInterpolator(unsigned int i, KeyFrameInterpolator *const kfi);
|
||||
|
||||
virtual void addKeyFrameToPath(unsigned int i);
|
||||
virtual void playPath(unsigned int i);
|
||||
virtual void deletePath(unsigned int i);
|
||||
virtual void resetPath(unsigned int i);
|
||||
//@}
|
||||
|
||||
/*! @name OpenGL matrices */
|
||||
//@{
|
||||
public:
|
||||
virtual void loadProjectionMatrix(bool reset = true) const;
|
||||
virtual void loadModelViewMatrix(bool reset = true) const;
|
||||
void computeProjectionMatrix() const;
|
||||
void computeModelViewMatrix() const;
|
||||
//!Sets the frustum according to the current type of the camera
|
||||
//! (PERSPECTIVE or ORTHOGRAPHIC) in this order :
|
||||
//! left, right, top, bottom, near, far
|
||||
void setFrustum(double frustum[6]);
|
||||
//!Fills `frustum` from the current frustum of the camera according
|
||||
//! to the current type (PERSPECTIVE or ORTHOGRAPHIC) in this order :
|
||||
//! left, right, top, bottom, near, far
|
||||
void getFrustum(double frustum[6]);
|
||||
|
||||
virtual void loadProjectionMatrixStereo(bool leftBuffer = true) const;
|
||||
virtual void loadModelViewMatrixStereo(bool leftBuffer = true) const;
|
||||
|
||||
void getProjectionMatrix(GLfloat m[16]) const;
|
||||
void getProjectionMatrix(GLdouble m[16]) const;
|
||||
|
||||
void getModelViewMatrix(GLfloat m[16]) const;
|
||||
void getModelViewMatrix(GLdouble m[16]) const;
|
||||
|
||||
void getModelViewProjectionMatrix(GLfloat m[16]) const;
|
||||
void getModelViewProjectionMatrix(GLdouble m[16]) const;
|
||||
//@}
|
||||
|
||||
/*! @name World to Camera coordinate systems conversions */
|
||||
//@{
|
||||
public:
|
||||
Vec cameraCoordinatesOf(const Vec &src) const;
|
||||
Vec worldCoordinatesOf(const Vec &src) const;
|
||||
void getCameraCoordinatesOf(const qreal src[3], qreal res[3]) const;
|
||||
void getWorldCoordinatesOf(const qreal src[3], qreal res[3]) const;
|
||||
//@}
|
||||
|
||||
/*! @name 2D screen to 3D world coordinate systems conversions */
|
||||
//@{
|
||||
public:
|
||||
Vec projectedCoordinatesOf(const Vec &src, const Frame *frame = NULL) const;
|
||||
Vec unprojectedCoordinatesOf(const Vec &src, const Frame *frame = NULL) const;
|
||||
void getProjectedCoordinatesOf(const qreal src[3], qreal res[3],
|
||||
const Frame *frame = NULL) const;
|
||||
void getUnprojectedCoordinatesOf(const qreal src[3], qreal res[3],
|
||||
const Frame *frame = NULL) const;
|
||||
void convertClickToLine(const QPoint &pixel, Vec &orig, Vec &dir) const;
|
||||
Vec pointUnderPixel(const QPoint &pixel, bool &found) const;
|
||||
//@}
|
||||
|
||||
/*! @name Fly speed */
|
||||
//@{
|
||||
public:
|
||||
qreal flySpeed() const;
|
||||
public Q_SLOTS:
|
||||
void setFlySpeed(qreal speed);
|
||||
//@}
|
||||
|
||||
/*! @name Stereo parameters */
|
||||
//@{
|
||||
public:
|
||||
/*! Returns the user's inter-ocular distance (in meters). Default value is
|
||||
0.062m, which fits most people.
|
||||
|
||||
loadProjectionMatrixStereo() uses this value to define the Camera offset and
|
||||
frustum. See setIODistance(). */
|
||||
qreal IODistance() const { return IODistance_; }
|
||||
|
||||
/*! Returns the physical distance between the user's eyes and the screen (in
|
||||
meters).
|
||||
|
||||
physicalDistanceToScreen() and focusDistance() represent the same distance.
|
||||
The former is expressed in physical real world units, while the latter is
|
||||
expressed in OpenGL virtual world units.
|
||||
|
||||
This is a helper function. It simply returns physicalScreenWidth() / 2.0 /
|
||||
tan(horizontalFieldOfView() / 2.0); */
|
||||
qreal physicalDistanceToScreen() const;
|
||||
|
||||
/*! Returns the physical screen width, in meters. Default value is 0.5m
|
||||
(average monitor width).
|
||||
|
||||
Used for stereo display only (see loadModelViewMatrixStereo() and
|
||||
loadProjectionMatrixStereo()). Set using setPhysicalScreenWidth(). */
|
||||
qreal physicalScreenWidth() const { return physicalScreenWidth_; }
|
||||
|
||||
/*! Returns the focus distance used by stereo display, expressed in OpenGL
|
||||
units.
|
||||
|
||||
This is the distance in the virtual world between the Camera and the plane
|
||||
where the horizontal stereo parallax is null (the stereo left and right
|
||||
cameras' lines of sigth cross at this distance).
|
||||
|
||||
This distance is the virtual world equivalent of the real-world
|
||||
physicalDistanceToScreen().
|
||||
|
||||
\attention This value is modified by CGAL::QGLViewer::setSceneRadius(),
|
||||
setSceneRadius() and setFieldOfView(). When one of these values is modified,
|
||||
focusDistance() is set to sceneRadius() / tan(fieldOfView()/2), which provides
|
||||
good results. */
|
||||
qreal focusDistance() const { return focusDistance_; }
|
||||
public Q_SLOTS:
|
||||
/*! Sets the IODistance(). */
|
||||
void setIODistance(qreal distance) { IODistance_ = distance; }
|
||||
|
||||
/*! Sets the physical screen (monitor or projected wall) width (in meters). */
|
||||
void setPhysicalScreenWidth(qreal width) { physicalScreenWidth_ = width; }
|
||||
|
||||
/*! Sets the focusDistance(), in OpenGL scene units. */
|
||||
void setFocusDistance(qreal distance) { focusDistance_ = distance; }
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
public:
|
||||
virtual QDomElement domElement(const QString &name,
|
||||
QDomDocument &document) const;
|
||||
public Q_SLOTS:
|
||||
virtual void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
private Q_SLOTS:
|
||||
void onFrameModified();
|
||||
|
||||
private:
|
||||
QOpenGLFunctions_2_1* gl() const{ return dynamic_cast<QOpenGLFunctions_2_1*>(parent()); }
|
||||
// F r a m e
|
||||
ManipulatedCameraFrame *frame_;
|
||||
|
||||
// C a m e r a p a r a m e t e r s
|
||||
int screenWidth_, screenHeight_; // size of the window, in pixels
|
||||
qreal fieldOfView_; // in radians
|
||||
Vec sceneCenter_;
|
||||
qreal sceneRadius_; // OpenGL units
|
||||
qreal zNearCoef_;
|
||||
qreal zClippingCoef_;
|
||||
qreal orthoCoef_;
|
||||
Type type_; // PERSPECTIVE or ORTHOGRAPHIC
|
||||
mutable GLdouble modelViewMatrix_[16]; // Buffered model view matrix.
|
||||
mutable bool modelViewMatrixIsUpToDate_;
|
||||
mutable GLdouble projectionMatrix_[16]; // Buffered projection matrix.
|
||||
mutable bool projectionMatrixIsUpToDate_;
|
||||
|
||||
// S t e r e o p a r a m e t e r s
|
||||
qreal IODistance_; // inter-ocular distance, in meters
|
||||
qreal focusDistance_; // in scene units
|
||||
qreal physicalScreenWidth_; // in meters
|
||||
|
||||
// P o i n t s o f V i e w s a n d K e y F r a m e s
|
||||
QMap<unsigned int, KeyFrameInterpolator *> kfi_;
|
||||
KeyFrameInterpolator *interpolationKfi_;
|
||||
};
|
||||
|
||||
} // namespace qglviewer
|
||||
} //CGAL
|
||||
#endif // QGLVIEWER_CAMERA_H
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,372 @@
|
|||
/****************************************************************************
|
||||
|
||||
Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
|
||||
|
||||
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0.
|
||||
|
||||
http://www.libqglviewer.com - contact@libqglviewer.com
|
||||
|
||||
This file may be used under the terms of the GNU General Public License
|
||||
version 3.0 as published by the Free Software Foundation and
|
||||
appearing in the LICENSE file included in the packaging of this file.
|
||||
|
||||
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
|
||||
purchase a libCGAL::QGLViewer Commercial License.
|
||||
|
||||
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
*****************************************************************************/
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
#ifndef QGLVIEWER_CONSTRAINT_H
|
||||
#define QGLVIEWER_CONSTRAINT_H
|
||||
|
||||
#include <CGAL/Qt/quaternion.h>
|
||||
#include <CGAL/Qt/vec.h>
|
||||
#include <CGAL/export/Qt.h>
|
||||
|
||||
namespace CGAL{
|
||||
namespace qglviewer {
|
||||
class Frame;
|
||||
class Camera;
|
||||
/*! \brief An interface class for Frame constraints.
|
||||
\class Constraint constraint.h CGAL::QGLViewer/constraint.h
|
||||
|
||||
This class defines the interface for the Constraints that can be applied to a
|
||||
Frame to limit its motion. Use Frame::setConstraint() to associate a
|
||||
Constraint to a Frame (default is a \c NULL Frame::constraint()).
|
||||
|
||||
<h3>How does it work ?</h3>
|
||||
|
||||
The Constraint acts as a filter on the translation and rotation Frame
|
||||
increments. constrainTranslation() and constrainRotation() should be
|
||||
overloaded to specify the constraint behavior: the desired displacement is
|
||||
given as a parameter that can optionally be modified.
|
||||
|
||||
Here is how the Frame::translate() and Frame::rotate() methods use the
|
||||
Constraint: \code Frame::translate(Vec& T)
|
||||
{
|
||||
if (constraint())
|
||||
constraint()->constrainTranslation(T, this);
|
||||
t += T;
|
||||
}
|
||||
|
||||
Frame::rotate(Quaternion& Q)
|
||||
{
|
||||
if (constraint())
|
||||
constraint()->constrainRotation(Q, this);
|
||||
q *= Q;
|
||||
}
|
||||
\endcode
|
||||
|
||||
The default behavior of constrainTranslation() and constrainRotation() is
|
||||
empty (meaning no filtering).
|
||||
|
||||
The Frame which uses the Constraint is passed as a parameter to the
|
||||
constrainTranslation() and constrainRotation() methods, so that they can have
|
||||
access to its current state (mainly Frame::position() and
|
||||
Frame::orientation()). It is not \c const for versatility reasons, but
|
||||
directly modifying it should be avoided.
|
||||
|
||||
\attention Frame::setTranslation(), Frame::setRotation() and similar methods
|
||||
will actually indeed set the frame position and orientation, without taking
|
||||
the constraint into account. Use the \e WithConstraint versions of these
|
||||
methods to enforce the Constraint.
|
||||
|
||||
<h3>Implemented Constraints</h3>
|
||||
|
||||
Classical axial and plane Constraints are provided for convenience: see the
|
||||
LocalConstraint, WorldConstraint and CameraConstraint classes' documentations.
|
||||
|
||||
Try the <a href="../examples/constrainedFrame.html">constrainedFrame</a> and
|
||||
<a href="../examples/constrainedCamera.html">constrainedCamera</a> examples
|
||||
for an illustration.
|
||||
|
||||
<h3>Creating new Constraints</h3>
|
||||
|
||||
The implementation of a new Constraint class simply consists in overloading
|
||||
the filtering methods: \code
|
||||
// This Constraint enforces that the Frame cannot have a negative z world
|
||||
coordinate. class myConstraint : public Constraint
|
||||
{
|
||||
public:
|
||||
virtual void constrainTranslation(Vec& t, Frame * const fr)
|
||||
{
|
||||
// Express t in the world coordinate system.
|
||||
const Vec tWorld = fr->inverseTransformOf(t);
|
||||
if (fr->position().z + tWorld.z < 0.0) // check the new fr z coordinate
|
||||
t.z = fr->transformOf(-fr->position().z); // t.z is clamped so that
|
||||
next z position is 0.0
|
||||
}
|
||||
};
|
||||
\endcode
|
||||
|
||||
Note that the translation (resp. rotation) parameter passed to
|
||||
constrainTranslation() (resp. constrainRotation()) is expressed in the \e
|
||||
local Frame coordinate system. Here, we use the Frame::transformOf() and
|
||||
Frame::inverseTransformOf() method to convert it to and from the world
|
||||
coordinate system.
|
||||
|
||||
Combined constraints can easily be achieved by creating a new class that
|
||||
applies the different constraint filters: \code
|
||||
myConstraint::constrainTranslation(Vec& v, Frame* const fr)
|
||||
{
|
||||
constraint1->constrainTranslation(v, fr);
|
||||
constraint2->constrainTranslation(v, fr);
|
||||
// and so on, with possible branches, tests, loops...
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
class CGAL_QT_EXPORT Constraint {
|
||||
public:
|
||||
/*! Virtual destructor. Empty. */
|
||||
virtual ~Constraint() {}
|
||||
|
||||
/*! Filters the translation applied to the \p frame. This default
|
||||
implementation is empty (no filtering).
|
||||
|
||||
Overload this method in your own Constraint class to define a new translation
|
||||
constraint. \p frame is the Frame to which is applied the translation. It is
|
||||
not defined \c const, but you should refrain from directly changing its value
|
||||
in the constraint. Use its Frame::position() and update the \p translation
|
||||
accordingly instead.
|
||||
|
||||
\p translation is expressed in local frame coordinate system. Use
|
||||
Frame::inverseTransformOf() to express it in the world coordinate system if
|
||||
needed. */
|
||||
virtual void constrainTranslation(Vec &translation, Frame *const frame) {
|
||||
Q_UNUSED(translation);
|
||||
Q_UNUSED(frame);
|
||||
}
|
||||
/*! Filters the rotation applied to the \p frame. This default implementation
|
||||
is empty (no filtering).
|
||||
|
||||
Overload this method in your own Constraint class to define a new rotation
|
||||
constraint. See constrainTranslation() for details.
|
||||
|
||||
Use Frame::inverseTransformOf() on the \p rotation Quaternion::axis() to
|
||||
express \p rotation in the world coordinate system if needed. */
|
||||
virtual void constrainRotation(Quaternion &rotation, Frame *const frame) {
|
||||
Q_UNUSED(rotation);
|
||||
Q_UNUSED(frame);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief An abstract class for Frame Constraints defined by an axis or a plane.
|
||||
\class AxisPlaneConstraint constraint.h CGAL::QGLViewer/constraint.h
|
||||
|
||||
AxisPlaneConstraint is an interface for (translation and/or rotation)
|
||||
Constraint that are defined by a direction. translationConstraintType() and
|
||||
rotationConstraintType() define how this direction should be interpreted: as
|
||||
an axis (AxisPlaneConstraint::AXIS) or as a plane normal
|
||||
(AxisPlaneConstraint::PLANE). See the Type() documentation for details.
|
||||
|
||||
The three implementations of this class: LocalConstraint, WorldConstraint and
|
||||
CameraConstraint differ by the coordinate system in which this direction is
|
||||
expressed.
|
||||
|
||||
Different implementations of this class are illustrated in the
|
||||
<a href="../examples/constrainedCamera.html">contrainedCamera</a> and
|
||||
<a href="../examples/constrainedFrame.html">constrainedFrame</a> examples.
|
||||
|
||||
\attention When applied, the rotational Constraint may not intuitively follow
|
||||
the mouse displacement. A solution would be to directly measure the rotation
|
||||
angle in screen coordinates, but that would imply to know the
|
||||
CGAL::QGLViewer::camera(), so that we can compute the projected coordinates of the
|
||||
rotation center (as is done with the CGAL::QGLViewer::SCREEN_ROTATE binding).
|
||||
However, adding an extra pointer to the CGAL::QGLViewer::camera() in all the
|
||||
AxisPlaneConstraint derived classes (which the user would have to update in a
|
||||
multi-viewer application) was judged as an overkill. */
|
||||
class CGAL_QT_EXPORT AxisPlaneConstraint : public Constraint {
|
||||
public:
|
||||
AxisPlaneConstraint();
|
||||
/*! Virtual destructor. Empty. */
|
||||
virtual ~AxisPlaneConstraint() {}
|
||||
|
||||
/*! Type lists the different types of translation and rotation constraints
|
||||
that are available.
|
||||
|
||||
It specifies the meaning of the constraint direction (see
|
||||
translationConstraintDirection() and rotationConstraintDirection()): as an
|
||||
axis direction (AxisPlaneConstraint::AXIS) or a plane normal
|
||||
(AxisPlaneConstraint::PLANE). AxisPlaneConstraint::FREE means no constraint
|
||||
while AxisPlaneConstraint::FORBIDDEN completely forbids the translation and/or
|
||||
the rotation.
|
||||
|
||||
See translationConstraintType() and rotationConstraintType().
|
||||
|
||||
\attention The AxisPlaneConstraint::PLANE Type is not valid for rotational
|
||||
constraint.
|
||||
|
||||
New derived classes can use their own extended enum for specific constraints:
|
||||
\code
|
||||
class MyAxisPlaneConstraint : public AxisPlaneConstraint
|
||||
{
|
||||
public:
|
||||
enum MyType { FREE, AXIS, PLANE, FORBIDDEN, CUSTOM };
|
||||
virtual void constrainTranslation(Vec &translation, Frame *const frame)
|
||||
{
|
||||
// translationConstraintType() is simply an int. CUSTOM Type is
|
||||
handled seamlessly. switch (translationConstraintType())
|
||||
{
|
||||
case MyAxisPlaneConstraint::FREE: ... break;
|
||||
case MyAxisPlaneConstraint::CUSTOM: ... break;
|
||||
}
|
||||
};
|
||||
|
||||
MyAxisPlaneConstraint* c = new MyAxisPlaneConstraint();
|
||||
// Note the Type conversion
|
||||
c->setTranslationConstraintType(AxisPlaneConstraint::Type(MyAxisPlaneConstraint::CUSTOM));
|
||||
};
|
||||
\endcode */
|
||||
enum Type { FREE, AXIS, PLANE, FORBIDDEN };
|
||||
|
||||
/*! @name Translation constraint */
|
||||
//@{
|
||||
/*! Overloading of Constraint::constrainTranslation(). Empty */
|
||||
virtual void constrainTranslation(Vec &translation, Frame *const frame) {
|
||||
Q_UNUSED(translation);
|
||||
Q_UNUSED(frame);
|
||||
};
|
||||
|
||||
void setTranslationConstraint(Type type, const Vec &direction);
|
||||
/*! Sets the Type() of the translationConstraintType(). Default is
|
||||
* AxisPlaneConstraint::FREE. */
|
||||
void setTranslationConstraintType(Type type) {
|
||||
translationConstraintType_ = type;
|
||||
};
|
||||
void setTranslationConstraintDirection(const Vec &direction);
|
||||
|
||||
/*! Returns the translation constraint Type().
|
||||
|
||||
Depending on this value, the Frame will freely translate
|
||||
(AxisPlaneConstraint::FREE), will only be able to translate along an axis
|
||||
direction (AxisPlaneConstraint::AXIS), will be forced to stay into a plane
|
||||
(AxisPlaneConstraint::PLANE) or will not able to translate at all
|
||||
(AxisPlaneConstraint::FORBIDDEN).
|
||||
|
||||
Use Frame::setPosition() to define the position of the constrained Frame
|
||||
before it gets constrained. */
|
||||
Type translationConstraintType() const { return translationConstraintType_; };
|
||||
/*! Returns the direction used by the translation constraint.
|
||||
|
||||
It represents the axis direction (AxisPlaneConstraint::AXIS) or the plane
|
||||
normal (AxisPlaneConstraint::PLANE) depending on the
|
||||
translationConstraintType(). It is undefined for AxisPlaneConstraint::FREE or
|
||||
AxisPlaneConstraint::FORBIDDEN.
|
||||
|
||||
The AxisPlaneConstraint derived classes express this direction in different
|
||||
coordinate system (camera for CameraConstraint, local for LocalConstraint, and
|
||||
world for WorldConstraint). This value can be modified with
|
||||
setTranslationConstraintDirection(). */
|
||||
Vec translationConstraintDirection() const {
|
||||
return translationConstraintDir_;
|
||||
};
|
||||
//@}
|
||||
|
||||
/*! @name Rotation constraint */
|
||||
//@{
|
||||
/*! Overloading of Constraint::constrainRotation(). Empty. */
|
||||
virtual void constrainRotation(Quaternion &rotation, Frame *const frame) {
|
||||
Q_UNUSED(rotation);
|
||||
Q_UNUSED(frame);
|
||||
};
|
||||
|
||||
void setRotationConstraint(Type type, const Vec &direction);
|
||||
void setRotationConstraintType(Type type);
|
||||
void setRotationConstraintDirection(const Vec &direction);
|
||||
|
||||
/*! Returns the rotation constraint Type(). */
|
||||
Type rotationConstraintType() const { return rotationConstraintType_; };
|
||||
/*! Returns the axis direction used by the rotation constraint.
|
||||
|
||||
This direction is defined only when rotationConstraintType() is
|
||||
AxisPlaneConstraint::AXIS.
|
||||
|
||||
The AxisPlaneConstraint derived classes express this direction in different
|
||||
coordinate system (camera for CameraConstraint, local for LocalConstraint, and
|
||||
world for WorldConstraint). This value can be modified with
|
||||
setRotationConstraintDirection(). */
|
||||
Vec rotationConstraintDirection() const { return rotationConstraintDir_; };
|
||||
//@}
|
||||
|
||||
private:
|
||||
// int and not Type to allow for overloading and new types definition.
|
||||
Type translationConstraintType_;
|
||||
Type rotationConstraintType_;
|
||||
|
||||
Vec translationConstraintDir_;
|
||||
Vec rotationConstraintDir_;
|
||||
};
|
||||
|
||||
/*! \brief An AxisPlaneConstraint defined in the Frame local coordinate system.
|
||||
\class LocalConstraint constraint.h CGAL::QGLViewer/constraint.h
|
||||
|
||||
The translationConstraintDirection() and rotationConstraintDirection() are
|
||||
expressed in the Frame local coordinate system (see Frame::referenceFrame()).
|
||||
|
||||
See the <a href="../examples/constrainedFrame.html">constrainedFrame</a>
|
||||
example for an illustration. */
|
||||
class CGAL_QT_EXPORT LocalConstraint : public AxisPlaneConstraint {
|
||||
public:
|
||||
/*! Virtual destructor. Empty. */
|
||||
virtual ~LocalConstraint(){};
|
||||
|
||||
virtual void constrainTranslation(Vec &translation, Frame *const frame);
|
||||
virtual void constrainRotation(Quaternion &rotation, Frame *const frame);
|
||||
};
|
||||
|
||||
/*! \brief An AxisPlaneConstraint defined in the world coordinate system.
|
||||
\class WorldConstraint constraint.h CGAL::QGLViewer/constraint.h
|
||||
|
||||
The translationConstraintDirection() and rotationConstraintDirection() are
|
||||
expressed in world coordinate system.
|
||||
|
||||
See the <a href="../examples/constrainedFrame.html">constrainedFrame</a> and
|
||||
<a href="../examples/multiView.html">multiView</a> examples for an
|
||||
illustration. */
|
||||
class CGAL_QT_EXPORT WorldConstraint : public AxisPlaneConstraint {
|
||||
public:
|
||||
/*! Virtual destructor. Empty. */
|
||||
virtual ~WorldConstraint(){};
|
||||
|
||||
virtual void constrainTranslation(Vec &translation, Frame *const frame);
|
||||
virtual void constrainRotation(Quaternion &rotation, Frame *const frame);
|
||||
};
|
||||
|
||||
/*! \brief An AxisPlaneConstraint defined in the camera coordinate system.
|
||||
\class CameraConstraint constraint.h CGAL::QGLViewer/constraint.h
|
||||
|
||||
The translationConstraintDirection() and rotationConstraintDirection() are
|
||||
expressed in the associated camera() coordinate system.
|
||||
|
||||
See the <a href="../examples/constrainedFrame.html">constrainedFrame</a> and
|
||||
<a href="../examples/constrainedCamera.html">constrainedCamera</a> examples
|
||||
for an illustration. */
|
||||
class CGAL_QT_EXPORT CameraConstraint : public AxisPlaneConstraint {
|
||||
public:
|
||||
explicit CameraConstraint(const Camera *const camera);
|
||||
/*! Virtual destructor. Empty. */
|
||||
virtual ~CameraConstraint(){}
|
||||
|
||||
virtual void constrainTranslation(Vec &translation, Frame *const frame);
|
||||
virtual void constrainRotation(Quaternion &rotation, Frame *const frame);
|
||||
|
||||
/*! Returns the associated Camera. Set using the CameraConstraint constructor.
|
||||
*/
|
||||
const Camera *camera() const { return camera_; }
|
||||
|
||||
private:
|
||||
const Camera *const camera_;
|
||||
};
|
||||
|
||||
}} // namespace CGAL::qglviewer
|
||||
|
||||
#ifdef CGAL_HEADER_ONLY
|
||||
//#include <CGAL/Qt/qglviewer_impl_list.h>
|
||||
#endif // CGAL_HEADER_ONLY
|
||||
#endif // QGLVIEWER_CONSTRAINT_H
|
||||
|
|
@ -0,0 +1,303 @@
|
|||
/****************************************************************************
|
||||
|
||||
Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
|
||||
|
||||
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0.
|
||||
|
||||
http://www.libqglviewer.com - contact@libqglviewer.com
|
||||
|
||||
This file may be used under the terms of the GNU General Public License
|
||||
version 3.0 as published by the Free Software Foundation and
|
||||
appearing in the LICENSE file included in the packaging of this file.
|
||||
|
||||
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
|
||||
purchase a libCGAL::QGLViewer Commercial License.
|
||||
|
||||
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
*****************************************************************************/
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
#ifdef CGAL_HEADER_ONLY
|
||||
#define CGAL_INLINE_FUNCTION inline
|
||||
|
||||
#include <CGAL/license/GraphicsView.h>
|
||||
|
||||
#else
|
||||
#define CGAL_INLINE_FUNCTION
|
||||
#endif
|
||||
|
||||
#include <CGAL/Qt/constraint.h>
|
||||
#include <CGAL/Qt/manipulatedCameraFrame.h>
|
||||
#include <CGAL/Qt/camera.h>
|
||||
|
||||
using namespace CGAL::qglviewer;
|
||||
using namespace std;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Constraint //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! Default constructor.
|
||||
|
||||
translationConstraintType() and rotationConstraintType() are set to
|
||||
AxisPlaneConstraint::FREE. translationConstraintDirection() and
|
||||
rotationConstraintDirection() are set to (0,0,0). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
AxisPlaneConstraint::AxisPlaneConstraint()
|
||||
: translationConstraintType_(FREE), rotationConstraintType_(FREE) {
|
||||
// Do not use set since setRotationConstraintType needs a read.
|
||||
}
|
||||
|
||||
/*! Simply calls setTranslationConstraintType() and
|
||||
* setTranslationConstraintDirection(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void AxisPlaneConstraint::setTranslationConstraint(Type type,
|
||||
const Vec &direction) {
|
||||
setTranslationConstraintType(type);
|
||||
setTranslationConstraintDirection(direction);
|
||||
}
|
||||
|
||||
/*! Defines the translationConstraintDirection(). The coordinate system where \p
|
||||
* direction is expressed depends on your class implementation. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void AxisPlaneConstraint::setTranslationConstraintDirection(
|
||||
const Vec &direction) {
|
||||
if ((translationConstraintType() != AxisPlaneConstraint::FREE) &&
|
||||
(translationConstraintType() != AxisPlaneConstraint::FORBIDDEN)) {
|
||||
const qreal norm = direction.norm();
|
||||
if (norm < 1E-8) {
|
||||
qWarning("AxisPlaneConstraint::setTranslationConstraintDir: null vector "
|
||||
"for translation constraint");
|
||||
translationConstraintType_ = AxisPlaneConstraint::FREE;
|
||||
} else
|
||||
translationConstraintDir_ = direction / norm;
|
||||
}
|
||||
}
|
||||
|
||||
/*! Simply calls setRotationConstraintType() and
|
||||
* setRotationConstraintDirection(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void AxisPlaneConstraint::setRotationConstraint(Type type,
|
||||
const Vec &direction) {
|
||||
setRotationConstraintType(type);
|
||||
setRotationConstraintDirection(direction);
|
||||
}
|
||||
|
||||
/*! Defines the rotationConstraintDirection(). The coordinate system where \p
|
||||
* direction is expressed depends on your class implementation. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void AxisPlaneConstraint::setRotationConstraintDirection(const Vec &direction) {
|
||||
if ((rotationConstraintType() != AxisPlaneConstraint::FREE) &&
|
||||
(rotationConstraintType() != AxisPlaneConstraint::FORBIDDEN)) {
|
||||
const qreal norm = direction.norm();
|
||||
if (norm < 1E-8) {
|
||||
qWarning("AxisPlaneConstraint::setRotationConstraintDir: null vector for "
|
||||
"rotation constraint");
|
||||
rotationConstraintType_ = AxisPlaneConstraint::FREE;
|
||||
} else
|
||||
rotationConstraintDir_ = direction / norm;
|
||||
}
|
||||
}
|
||||
|
||||
/*! Set the Type() of the rotationConstraintType(). Default is
|
||||
AxisPlaneConstraint::FREE.
|
||||
|
||||
Depending on this value, the Frame will freely rotate
|
||||
(AxisPlaneConstraint::FREE), will only be able to rotate around an axis
|
||||
(AxisPlaneConstraint::AXIS), or will not able to rotate at all
|
||||
(AxisPlaneConstraint::FORBIDDEN).
|
||||
|
||||
Use Frame::setOrientation() to define the orientation of the constrained Frame
|
||||
before it gets constrained.
|
||||
|
||||
\attention An AxisPlaneConstraint::PLANE Type() is not meaningful for
|
||||
rotational constraints and will be ignored. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void AxisPlaneConstraint::setRotationConstraintType(Type type) {
|
||||
if (rotationConstraintType() == AxisPlaneConstraint::PLANE) {
|
||||
qWarning("AxisPlaneConstraint::setRotationConstraintType: the PLANE type "
|
||||
"cannot be used for a rotation constraints");
|
||||
return;
|
||||
}
|
||||
|
||||
rotationConstraintType_ = type;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// LocalConstraint //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! Depending on translationConstraintType(), constrain \p translation to be
|
||||
along an axis or limited to a plane defined in the Frame local coordinate
|
||||
system by translationConstraintDirection(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void LocalConstraint::constrainTranslation(Vec &translation,
|
||||
Frame *const frame) {
|
||||
Vec proj;
|
||||
switch (translationConstraintType()) {
|
||||
case AxisPlaneConstraint::FREE:
|
||||
break;
|
||||
case AxisPlaneConstraint::PLANE:
|
||||
proj = frame->rotation().rotate(translationConstraintDirection());
|
||||
translation.projectOnPlane(proj);
|
||||
break;
|
||||
case AxisPlaneConstraint::AXIS:
|
||||
proj = frame->rotation().rotate(translationConstraintDirection());
|
||||
translation.projectOnAxis(proj);
|
||||
break;
|
||||
case AxisPlaneConstraint::FORBIDDEN:
|
||||
translation = Vec(0.0, 0.0, 0.0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*! When rotationConstraintType() is AxisPlaneConstraint::AXIS, constrain \p
|
||||
rotation to be a rotation around an axis whose direction is defined in the
|
||||
Frame local coordinate system by rotationConstraintDirection(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void LocalConstraint::constrainRotation(Quaternion &rotation, Frame *const) {
|
||||
switch (rotationConstraintType()) {
|
||||
case AxisPlaneConstraint::FREE:
|
||||
break;
|
||||
case AxisPlaneConstraint::PLANE:
|
||||
break;
|
||||
case AxisPlaneConstraint::AXIS: {
|
||||
Vec axis = rotationConstraintDirection();
|
||||
Vec quat = Vec(rotation[0], rotation[1], rotation[2]);
|
||||
quat.projectOnAxis(axis);
|
||||
rotation = Quaternion(quat, 2.0 * acos(rotation[3]));
|
||||
} break;
|
||||
case AxisPlaneConstraint::FORBIDDEN:
|
||||
rotation = Quaternion(); // identity
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// WorldConstraint //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! Depending on translationConstraintType(), constrain \p translation to be
|
||||
along an axis or limited to a plane defined in the world coordinate system by
|
||||
translationConstraintDirection(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void WorldConstraint::constrainTranslation(Vec &translation,
|
||||
Frame *const frame) {
|
||||
Vec proj;
|
||||
switch (translationConstraintType()) {
|
||||
case AxisPlaneConstraint::FREE:
|
||||
break;
|
||||
case AxisPlaneConstraint::PLANE:
|
||||
if (frame->referenceFrame()) {
|
||||
proj = frame->referenceFrame()->transformOf(
|
||||
translationConstraintDirection());
|
||||
translation.projectOnPlane(proj);
|
||||
} else
|
||||
translation.projectOnPlane(translationConstraintDirection());
|
||||
break;
|
||||
case AxisPlaneConstraint::AXIS:
|
||||
if (frame->referenceFrame()) {
|
||||
proj = frame->referenceFrame()->transformOf(
|
||||
translationConstraintDirection());
|
||||
translation.projectOnAxis(proj);
|
||||
} else
|
||||
translation.projectOnAxis(translationConstraintDirection());
|
||||
break;
|
||||
case AxisPlaneConstraint::FORBIDDEN:
|
||||
translation = Vec(0.0, 0.0, 0.0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*! When rotationConstraintType() is AxisPlaneConstraint::AXIS, constrain \p
|
||||
rotation to be a rotation around an axis whose direction is defined in the
|
||||
world coordinate system by rotationConstraintDirection(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void WorldConstraint::constrainRotation(Quaternion &rotation,
|
||||
Frame *const frame) {
|
||||
switch (rotationConstraintType()) {
|
||||
case AxisPlaneConstraint::FREE:
|
||||
break;
|
||||
case AxisPlaneConstraint::PLANE:
|
||||
break;
|
||||
case AxisPlaneConstraint::AXIS: {
|
||||
Vec quat(rotation[0], rotation[1], rotation[2]);
|
||||
Vec axis = frame->transformOf(rotationConstraintDirection());
|
||||
quat.projectOnAxis(axis);
|
||||
rotation = Quaternion(quat, 2.0 * acos(rotation[3]));
|
||||
break;
|
||||
}
|
||||
case AxisPlaneConstraint::FORBIDDEN:
|
||||
rotation = Quaternion(); // identity
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// CameraConstraint //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! Creates a CameraConstraint, whose constrained directions are defined in the
|
||||
\p camera coordinate system. */
|
||||
CGAL_INLINE_FUNCTION
|
||||
CameraConstraint::CameraConstraint(const Camera *const camera)
|
||||
: AxisPlaneConstraint(), camera_(camera) {}
|
||||
|
||||
/*! Depending on translationConstraintType(), constrain \p translation to be
|
||||
along an axis or limited to a plane defined in the camera() coordinate system
|
||||
by translationConstraintDirection(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void CameraConstraint::constrainTranslation(Vec &translation,
|
||||
Frame *const frame) {
|
||||
Vec proj;
|
||||
switch (translationConstraintType()) {
|
||||
case AxisPlaneConstraint::FREE:
|
||||
break;
|
||||
case AxisPlaneConstraint::PLANE:
|
||||
proj =
|
||||
camera()->frame()->inverseTransformOf(translationConstraintDirection());
|
||||
if (frame->referenceFrame())
|
||||
proj = frame->referenceFrame()->transformOf(proj);
|
||||
translation.projectOnPlane(proj);
|
||||
break;
|
||||
case AxisPlaneConstraint::AXIS:
|
||||
proj =
|
||||
camera()->frame()->inverseTransformOf(translationConstraintDirection());
|
||||
if (frame->referenceFrame())
|
||||
proj = frame->referenceFrame()->transformOf(proj);
|
||||
translation.projectOnAxis(proj);
|
||||
break;
|
||||
case AxisPlaneConstraint::FORBIDDEN:
|
||||
translation = Vec(0.0, 0.0, 0.0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*! When rotationConstraintType() is AxisPlaneConstraint::AXIS, constrain \p
|
||||
rotation to be a rotation around an axis whose direction is defined in the
|
||||
camera() coordinate system by rotationConstraintDirection(). */
|
||||
CGAL_INLINE_FUNCTION
|
||||
void CameraConstraint::constrainRotation(Quaternion &rotation,
|
||||
Frame *const frame) {
|
||||
switch (rotationConstraintType()) {
|
||||
case AxisPlaneConstraint::FREE:
|
||||
break;
|
||||
case AxisPlaneConstraint::PLANE:
|
||||
break;
|
||||
case AxisPlaneConstraint::AXIS: {
|
||||
Vec axis = frame->transformOf(
|
||||
camera()->frame()->inverseTransformOf(rotationConstraintDirection()));
|
||||
Vec quat = Vec(rotation[0], rotation[1], rotation[2]);
|
||||
quat.projectOnAxis(axis);
|
||||
rotation = Quaternion(quat, 2.0 * acos(rotation[3]));
|
||||
} break;
|
||||
case AxisPlaneConstraint::FORBIDDEN:
|
||||
rotation = Quaternion(); // identity
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
/****************************************************************************
|
||||
|
||||
Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
|
||||
|
||||
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0.
|
||||
|
||||
http://www.libqglviewer.com - contact@libqglviewer.com
|
||||
|
||||
This file may be used under the terms of the GNU General Public License
|
||||
version 3.0 as published by the Free Software Foundation and
|
||||
appearing in the LICENSE file included in the packaging of this file.
|
||||
|
||||
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
|
||||
purchase a libCGAL::QGLViewer Commercial License.
|
||||
|
||||
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
*****************************************************************************/
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
#ifndef QGLVIEWER_DOMUTILS_H
|
||||
#define QGLVIEWER_DOMUTILS_H
|
||||
#include <qglobal.h>
|
||||
#include <QColor>
|
||||
#include <QDomElement>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
// QDomElement loading with syntax checking.
|
||||
class DomUtils {
|
||||
private:
|
||||
static void warning(const QString &message) {
|
||||
qWarning("%s", message.toLatin1().constData());
|
||||
}
|
||||
|
||||
public:
|
||||
static qreal qrealFromDom(const QDomElement &e, const QString &attribute,
|
||||
qreal defValue) {
|
||||
qreal value = defValue;
|
||||
if (e.hasAttribute(attribute)) {
|
||||
const QString s = e.attribute(attribute);
|
||||
bool ok;
|
||||
value = s.toDouble(&ok);
|
||||
if (!ok) {
|
||||
warning(QString("'%1' is not a valid qreal syntax for attribute \"%2\" "
|
||||
"in initialization of \"%3\". Setting value to %4.")
|
||||
.arg(s)
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(defValue)));
|
||||
value = defValue;
|
||||
}
|
||||
} else {
|
||||
warning(QString("\"%1\" attribute missing in initialization of \"%2\". "
|
||||
"Setting value to %3.")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(value)));
|
||||
}
|
||||
|
||||
#if defined(isnan)
|
||||
// The "isnan" method may not be available on all platforms.
|
||||
// Find its equivalent or simply remove these two lines
|
||||
if (isnan(value))
|
||||
warning(
|
||||
QString(
|
||||
"Warning, attribute \"%1\" initialized to Not a Number in \"%2\"")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName()));
|
||||
#endif
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static int intFromDom(const QDomElement &e, const QString &attribute,
|
||||
int defValue) {
|
||||
int value = defValue;
|
||||
if (e.hasAttribute(attribute)) {
|
||||
const QString s = e.attribute(attribute);
|
||||
bool ok;
|
||||
value = s.toInt(&ok);
|
||||
if (!ok) {
|
||||
warning(
|
||||
QString("'%1' is not a valid integer syntax for attribute \"%2\" "
|
||||
"in initialization of \"%3\". Setting value to %4.")
|
||||
.arg(s)
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(defValue)));
|
||||
value = defValue;
|
||||
}
|
||||
} else {
|
||||
warning(QString("\"%1\" attribute missing in initialization of \"%2\". "
|
||||
"Setting value to %3.")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(value)));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static unsigned int uintFromDom(const QDomElement &e,
|
||||
const QString &attribute,
|
||||
unsigned int defValue) {
|
||||
unsigned int value = defValue;
|
||||
if (e.hasAttribute(attribute)) {
|
||||
const QString s = e.attribute(attribute);
|
||||
bool ok;
|
||||
value = s.toUInt(&ok);
|
||||
if (!ok) {
|
||||
warning(
|
||||
QString("'%1' is not a valid unsigned integer syntax for attribute "
|
||||
"\"%2\" in initialization of \"%3\". Setting value to %4.")
|
||||
.arg(s)
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(defValue)));
|
||||
value = defValue;
|
||||
}
|
||||
} else {
|
||||
warning(QString("\"%1\" attribute missing in initialization of \"%2\". "
|
||||
"Setting value to %3.")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(QString::number(value)));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static bool boolFromDom(const QDomElement &e, const QString &attribute,
|
||||
bool defValue) {
|
||||
bool value = defValue;
|
||||
if (e.hasAttribute(attribute)) {
|
||||
const QString s = e.attribute(attribute);
|
||||
if (s.toLower() == QString("true"))
|
||||
value = true;
|
||||
else if (s.toLower() == QString("false"))
|
||||
value = false;
|
||||
else {
|
||||
warning(
|
||||
QString("'%1' is not a valid boolean syntax for attribute \"%2\" "
|
||||
"in initialization of \"%3\". Setting value to %4.")
|
||||
.arg(s)
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(defValue ? "true" : "false"));
|
||||
}
|
||||
} else {
|
||||
warning(QString("\"%1\" attribute missing in initialization of \"%2\". "
|
||||
"Setting value to %3.")
|
||||
.arg(attribute)
|
||||
.arg(e.tagName())
|
||||
.arg(value ? "true" : "false"));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static void setBoolAttribute(QDomElement &element, const QString &attribute,
|
||||
bool value) {
|
||||
element.setAttribute(attribute, (value ? "true" : "false"));
|
||||
}
|
||||
|
||||
static QDomElement QColorDomElement(const QColor &color, const QString &name,
|
||||
QDomDocument &doc) {
|
||||
QDomElement de = doc.createElement(name);
|
||||
de.setAttribute("red", QString::number(color.red()));
|
||||
de.setAttribute("green", QString::number(color.green()));
|
||||
de.setAttribute("blue", QString::number(color.blue()));
|
||||
return de;
|
||||
}
|
||||
|
||||
static QColor QColorFromDom(const QDomElement &e) {
|
||||
int color[3];
|
||||
QStringList attribute;
|
||||
attribute << "red"
|
||||
<< "green"
|
||||
<< "blue";
|
||||
for (int i = 0; i < attribute.count(); ++i)
|
||||
color[i] = DomUtils::intFromDom(e, attribute[i], 0);
|
||||
return QColor(color[0], color[1], color[2]);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // DOXYGEN
|
||||
#endif //QGLVIEWER_DOMUTILS_H
|
||||
|
|
@ -0,0 +1,467 @@
|
|||
/****************************************************************************
|
||||
|
||||
Copyright (c) 2018 GeometryFactory Sarl (France).
|
||||
Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
|
||||
|
||||
This file is part of a fork of the CGAL::QGLViewer library version 2.7.0.
|
||||
|
||||
http://www.libqglviewer.com - contact@libqglviewer.com
|
||||
|
||||
This file may be used under the terms of the GNU General Public License
|
||||
version 3.0 as published by the Free Software Foundation and
|
||||
appearing in the LICENSE file included in the packaging of this file.
|
||||
|
||||
libCGAL::QGLViewer uses dual licensing. Commercial/proprietary software must
|
||||
purchase a libCGAL::QGLViewer Commercial License.
|
||||
|
||||
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
*****************************************************************************/
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
#ifndef QGLVIEWER_FRAME_H
|
||||
#define QGLVIEWER_FRAME_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <CGAL/export/Qt.h>
|
||||
#include <CGAL/Qt/vec.h>
|
||||
#include <CGAL/Qt/quaternion.h>
|
||||
|
||||
namespace CGAL{
|
||||
namespace qglviewer {
|
||||
class Constraint;
|
||||
|
||||
/*! \brief The Frame class represents a coordinate system, defined by a position
|
||||
and an orientation. \class Frame frame.h CGAL::QGLViewer/frame.h
|
||||
|
||||
A Frame is a 3D coordinate system, represented by a position() and an
|
||||
orientation(). The order of these transformations is important: the Frame is
|
||||
first translated \e and \e then rotated around the new translated origin.
|
||||
|
||||
A Frame is useful to define the position and orientation of a 3D rigid object,
|
||||
using its matrix() method, as shown below: \code
|
||||
// Builds a Frame at position (0.5,0,0) and oriented such that its Y axis is
|
||||
along the (1,1,1)
|
||||
// direction. One could also have used setPosition() and setOrientation().
|
||||
Frame fr(Vec(0.5,0,0), Quaternion(Vec(0,1,0), Vec(1,1,1)));
|
||||
glPushMatrix();
|
||||
glMultMatrixd(fr.matrix());
|
||||
// Draw your object here, in the local fr coordinate system.
|
||||
glPopMatrix();
|
||||
\endcode
|
||||
|
||||
Many functions are provided to transform a 3D point from one coordinate system
|
||||
(Frame) to an other: see coordinatesOf(), inverseCoordinatesOf(),
|
||||
coordinatesOfIn(), coordinatesOfFrom()...
|
||||
|
||||
You may also want to transform a 3D vector (such as a normal), which
|
||||
corresponds to applying only the rotational part of the frame transformation:
|
||||
see transformOf() and inverseTransformOf(). See the <a
|
||||
href="../examples/frameTransform.html">frameTransform example</a> for an
|
||||
illustration.
|
||||
|
||||
The translation() and the rotation() that are encapsulated in a Frame can also
|
||||
be used to represent a \e rigid \e transformation of space. Such a
|
||||
transformation can also be interpreted as a change of coordinate system, and
|
||||
the coordinate system conversion functions actually allow you to use a Frame
|
||||
as a rigid transformation. Use inverseCoordinatesOf() (resp. coordinatesOf())
|
||||
to apply the transformation (resp. its inverse). Note the inversion.
|
||||
|
||||
<h3>Hierarchy of Frames</h3>
|
||||
|
||||
The position and the orientation of a Frame are actually defined with respect
|
||||
to a referenceFrame(). The default referenceFrame() is the world coordinate
|
||||
system (represented by a \c NULL referenceFrame()). If you setReferenceFrame()
|
||||
to a different Frame, you must then differentiate:
|
||||
|
||||
\arg the \e local translation() and rotation(), defined with respect to the
|
||||
referenceFrame(),
|
||||
|
||||
\arg the \e global position() and orientation(), always defined with respect
|
||||
to the world coordinate system.
|
||||
|
||||
A Frame is actually defined by its translation() with respect to its
|
||||
referenceFrame(), and then by a rotation() of the coordinate system around the
|
||||
new translated origin.
|
||||
|
||||
This terminology for \e local (translation() and rotation()) and \e global
|
||||
(position() and orientation()) definitions is used in all the methods' names
|
||||
and should be sufficient to prevent ambiguities. These notions are obviously
|
||||
identical when the referenceFrame() is \c NULL, i.e. when the Frame is defined
|
||||
in the world coordinate system (the one you are in at the beginning of the
|
||||
CGAL::QGLViewer::draw() method, see the <a href="../introduction.html">introduction
|
||||
page</a>).
|
||||
|
||||
Frames can hence easily be organized in a tree hierarchy, which root is the
|
||||
world coordinate system. A loop in the hierarchy would result in an
|
||||
inconsistent (multiple) Frame definition.
|
||||
settingAsReferenceFrameWillCreateALoop() checks this and prevents
|
||||
setReferenceFrame() from creating such a loop.
|
||||
|
||||
This frame hierarchy is used in methods like coordinatesOfIn(),
|
||||
coordinatesOfFrom()... which allow coordinates (or vector) conversions from a
|
||||
Frame to any other one (including the world coordinate system).
|
||||
|
||||
However, one must note that this hierarchical representation is internal to
|
||||
the Frame classes. When the Frames represent OpenGL coordinates system, one
|
||||
should map this hierarchical representation to the OpenGL GL_MODELVIEW matrix
|
||||
stack. See the matrix() documentation for details.
|
||||
|
||||
<h3>Constraints</h3>
|
||||
|
||||
An interesting feature of Frames is that their displacements can be
|
||||
constrained. When a Constraint is attached to a Frame, it filters the input of
|
||||
translate() and rotate(), and only the resulting filtered motion is applied to
|
||||
the Frame. The default constraint() is \c NULL resulting in no filtering. Use
|
||||
setConstraint() to attach a Constraint to a frame.
|
||||
|
||||
Constraints are especially usefull for the ManipulatedFrame instances, in
|
||||
order to forbid some mouse motions. See the <a
|
||||
href="../examples/constrainedFrame.html">constrainedFrame</a>, <a
|
||||
href="../examples/constrainedCamera.html">constrainedCamera</a> and <a
|
||||
href="../examples/luxo.html">luxo</a> examples for an illustration.
|
||||
|
||||
Classical constraints are provided for convenience (see LocalConstraint,
|
||||
WorldConstraint and CameraConstraint) and new constraints can very easily be
|
||||
implemented.
|
||||
|
||||
<h3>Derived classes</h3>
|
||||
|
||||
The ManipulatedFrame class inherits Frame and implements a mouse motion
|
||||
convertion, so that a Frame (and hence an object) can be manipulated in the
|
||||
scene with the mouse.
|
||||
|
||||
\nosubgrouping */
|
||||
class CGAL_QT_EXPORT Frame : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Frame();
|
||||
|
||||
/*! Virtual destructor. Empty. */
|
||||
virtual ~Frame() {}
|
||||
|
||||
Frame(const Frame &frame);
|
||||
Frame &operator=(const Frame &frame);
|
||||
|
||||
Q_SIGNALS:
|
||||
/*! This signal is emitted whenever the position() or the orientation() of the
|
||||
Frame is modified.
|
||||
|
||||
Connect this signal to any object that must be notified:
|
||||
\code
|
||||
QObject::connect(myFrame, SIGNAL(modified()), myObject, SLOT(update()));
|
||||
\endcode
|
||||
Use the CGAL::QGLViewer::QGLViewerPool() to connect the signal to all the viewers.
|
||||
|
||||
\note If your Frame is part of a Frame hierarchy (see referenceFrame()), a
|
||||
modification of one of the parents of this Frame will \e not emit this signal.
|
||||
Use code like this to change this behavior (you can do this recursively for
|
||||
all the referenceFrame() until the \c NULL world root frame is encountered):
|
||||
\code
|
||||
// Emits the Frame modified() signal when its referenceFrame() is modified().
|
||||
connect(myFrame->referenceFrame(), SIGNAL(modified()), myFrame,
|
||||
SIGNAL(modified())); \endcode
|
||||
|
||||
\attention Connecting this signal to a QOpenGLWidget::update() slot (or a
|
||||
method that calls it) will prevent you from modifying the Frame \e inside your
|
||||
CGAL::QGLViewer::draw() method as it would result in an infinite loop. However,
|
||||
CGAL::QGLViewer::draw() should not modify the scene.
|
||||
|
||||
\note Note that this signal might be emitted even if the Frame is not actually
|
||||
modified, for instance after a translate(Vec(0,0,0)) or a
|
||||
setPosition(position()). */
|
||||
void modified();
|
||||
|
||||
/*! This signal is emitted when the Frame is interpolated by a
|
||||
KeyFrameInterpolator.
|
||||
|
||||
See the KeyFrameInterpolator documentation for details.
|
||||
|
||||
If a KeyFrameInterpolator is used to successively interpolate several Frames
|
||||
in your scene, connect the KeyFrameInterpolator::interpolated() signal instead
|
||||
(identical, but independent of the interpolated Frame). */
|
||||
void interpolated();
|
||||
|
||||
public:
|
||||
/*! @name World coordinates position and orientation */
|
||||
//@{
|
||||
Frame(const Vec &position, const Quaternion &orientation);
|
||||
|
||||
void setPosition(const Vec &position);
|
||||
void setPosition(qreal x, qreal y, qreal z);
|
||||
void setPositionWithConstraint(Vec &position);
|
||||
|
||||
void setOrientation(const Quaternion &orientation);
|
||||
void setOrientation(qreal q0, qreal q1, qreal q2, qreal q3);
|
||||
void setOrientationWithConstraint(Quaternion &orientation);
|
||||
|
||||
void setPositionAndOrientation(const Vec &position,
|
||||
const Quaternion &orientation);
|
||||
void setPositionAndOrientationWithConstraint(Vec &position,
|
||||
Quaternion &orientation);
|
||||
|
||||
Vec position() const;
|
||||
Quaternion orientation() const;
|
||||
|
||||
void getPosition(qreal &x, qreal &y, qreal &z) const;
|
||||
void getOrientation(qreal &q0, qreal &q1, qreal &q2, qreal &q3) const;
|
||||
//@}
|
||||
|
||||
public:
|
||||
/*! @name Local translation and rotation w/r reference Frame */
|
||||
//@{
|
||||
/*! Sets the translation() of the frame, locally defined with respect to the
|
||||
referenceFrame(). Emits the modified() signal.
|
||||
|
||||
Use setPosition() to define the world coordinates position(). Use
|
||||
setTranslationWithConstraint() to take into account the potential constraint()
|
||||
of the Frame. */
|
||||
void setTranslation(const Vec &translation) {
|
||||
t_ = translation;
|
||||
Q_EMIT modified();
|
||||
}
|
||||
void setTranslation(qreal x, qreal y, qreal z);
|
||||
void setTranslationWithConstraint(Vec &translation);
|
||||
|
||||
/*! Set the current rotation Quaternion. See rotation() and the different
|
||||
Quaternion constructors. Emits the modified() signal. See also
|
||||
setTranslation() and setRotationWithConstraint(). */
|
||||
|
||||
/*! Sets the rotation() of the Frame, locally defined with respect to the
|
||||
referenceFrame(). Emits the modified() signal.
|
||||
|
||||
Use setOrientation() to define the world coordinates orientation(). The
|
||||
potential constraint() of the Frame is not taken into account, use
|
||||
setRotationWithConstraint() instead. */
|
||||
void setRotation(const Quaternion &rotation) {
|
||||
q_ = rotation;
|
||||
Q_EMIT modified();
|
||||
}
|
||||
void setRotation(qreal q0, qreal q1, qreal q2, qreal q3);
|
||||
void setRotationWithConstraint(Quaternion &rotation);
|
||||
|
||||
void setTranslationAndRotation(const Vec &translation,
|
||||
const Quaternion &rotation);
|
||||
void setTranslationAndRotationWithConstraint(Vec &translation,
|
||||
Quaternion &rotation);
|
||||
|
||||
/*! Returns the Frame translation, defined with respect to the
|
||||
referenceFrame().
|
||||
|
||||
Use position() to get the result in the world coordinates. These two values
|
||||
are identical when the referenceFrame() is \c NULL (default).
|
||||
|
||||
See also setTranslation() and setTranslationWithConstraint(). */
|
||||
Vec translation() const { return t_; }
|
||||
/*! Returns the Frame rotation, defined with respect to the referenceFrame().
|
||||
|
||||
Use orientation() to get the result in the world coordinates. These two values
|
||||
are identical when the referenceFrame() is \c NULL (default).
|
||||
|
||||
See also setRotation() and setRotationWithConstraint(). */
|
||||
|
||||
/*! Returns the current Quaternion orientation. See setRotation(). */
|
||||
Quaternion rotation() const { return q_; }
|
||||
|
||||
void getTranslation(qreal &x, qreal &y, qreal &z) const;
|
||||
void getRotation(qreal &q0, qreal &q1, qreal &q2, qreal &q3) const;
|
||||
//@}
|
||||
|
||||
public:
|
||||
/*! @name Frame hierarchy */
|
||||
//@{
|
||||
/*! Returns the reference Frame, in which coordinates system the Frame is
|
||||
defined.
|
||||
|
||||
The translation() and rotation() of the Frame are defined with respect to the
|
||||
referenceFrame() coordinate system. A \c NULL referenceFrame() (default value)
|
||||
means that the Frame is defined in the world coordinate system.
|
||||
|
||||
Use position() and orientation() to recursively convert values along the
|
||||
referenceFrame() chain and to get values expressed in the world coordinate
|
||||
system. The values match when the referenceFrame() is \c NULL.
|
||||
|
||||
Use setReferenceFrame() to set this value and create a Frame hierarchy.
|
||||
Convenient functions allow you to convert 3D coordinates from one Frame to an
|
||||
other: see coordinatesOf(), localCoordinatesOf(), coordinatesOfIn() and their
|
||||
inverse functions.
|
||||
|
||||
Vectors can also be converted using transformOf(), transformOfIn,
|
||||
localTransformOf() and their inverse functions. */
|
||||
const Frame *referenceFrame() const { return referenceFrame_; }
|
||||
void setReferenceFrame(const Frame *const refFrame);
|
||||
bool settingAsReferenceFrameWillCreateALoop(const Frame *const frame);
|
||||
//@}
|
||||
|
||||
/*! @name Frame modification */
|
||||
//@{
|
||||
void translate(Vec &t);
|
||||
void translate(const Vec &t);
|
||||
// Some compilers complain about "overloading cannot distinguish from previous
|
||||
// declaration" Simply comment out the following method and its associated
|
||||
// implementation
|
||||
void translate(qreal x, qreal y, qreal z);
|
||||
void translate(qreal &x, qreal &y, qreal &z);
|
||||
|
||||
void rotate(Quaternion &q);
|
||||
void rotate(const Quaternion &q);
|
||||
// Some compilers complain about "overloading cannot distinguish from previous
|
||||
// declaration" Simply comment out the following method and its associated
|
||||
// implementation
|
||||
void rotate(qreal q0, qreal q1, qreal q2, qreal q3);
|
||||
void rotate(qreal &q0, qreal &q1, qreal &q2, qreal &q3);
|
||||
|
||||
void rotateAroundPoint(Quaternion &rotation, const Vec &point);
|
||||
void rotateAroundPoint(const Quaternion &rotation, const Vec &point);
|
||||
|
||||
void alignWithFrame(const Frame *const frame, bool move = false,
|
||||
qreal threshold = 0.0);
|
||||
void projectOnLine(const Vec &origin, const Vec &direction);
|
||||
//@}
|
||||
|
||||
/*! @name Coordinate system transformation of 3D coordinates */
|
||||
//@{
|
||||
Vec coordinatesOf(const Vec &src) const;
|
||||
Vec inverseCoordinatesOf(const Vec &src) const;
|
||||
Vec localCoordinatesOf(const Vec &src) const;
|
||||
Vec localInverseCoordinatesOf(const Vec &src) const;
|
||||
Vec coordinatesOfIn(const Vec &src, const Frame *const in) const;
|
||||
Vec coordinatesOfFrom(const Vec &src, const Frame *const from) const;
|
||||
|
||||
void getCoordinatesOf(const qreal src[3], qreal res[3]) const;
|
||||
void getInverseCoordinatesOf(const qreal src[3], qreal res[3]) const;
|
||||
void getLocalCoordinatesOf(const qreal src[3], qreal res[3]) const;
|
||||
void getLocalInverseCoordinatesOf(const qreal src[3], qreal res[3]) const;
|
||||
void getCoordinatesOfIn(const qreal src[3], qreal res[3],
|
||||
const Frame *const in) const;
|
||||
void getCoordinatesOfFrom(const qreal src[3], qreal res[3],
|
||||
const Frame *const from) const;
|
||||
//@}
|
||||
|
||||
/*! @name Coordinate system transformation of vectors */
|
||||
// A frame is as a new coordinate system, defined with respect to a reference
|
||||
// frame (the world coordinate system by default, see the "Composition of
|
||||
// frame" section).
|
||||
|
||||
// The transformOf() (resp. inverseTransformOf()) functions transform a 3D
|
||||
// vector from (resp. to) the world coordinates system. This section defines
|
||||
// the 3D vector transformation functions. See the Coordinate system
|
||||
// transformation of 3D points above for the transformation of 3D points. The
|
||||
// difference between the two sets of functions is simple: for vectors, only
|
||||
// the rotational part of the transformations is taken into account, while
|
||||
// translation is also considered for 3D points.
|
||||
|
||||
// The length of the resulting transformed vector is identical to the one of
|
||||
// the source vector for all the described functions.
|
||||
|
||||
// When local is prepended to the names of the functions, the functions simply
|
||||
// transform from (and to) the reference frame.
|
||||
|
||||
// When In (resp. From) is appended to the names, the functions transform from
|
||||
// (resp. To) the frame that is given as an argument. The frame does not need
|
||||
// to be in the same branch or the hierarchical tree, and can be \c NULL (the
|
||||
// world coordinates system).
|
||||
|
||||
// Combining any of these functions with its inverse (in any order) leads to
|
||||
// the identity.
|
||||
//@{
|
||||
Vec transformOf(const Vec &src) const;
|
||||
Vec inverseTransformOf(const Vec &src) const;
|
||||
Vec localTransformOf(const Vec &src) const;
|
||||
Vec localInverseTransformOf(const Vec &src) const;
|
||||
Vec transformOfIn(const Vec &src, const Frame *const in) const;
|
||||
Vec transformOfFrom(const Vec &src, const Frame *const from) const;
|
||||
|
||||
void getTransformOf(const qreal src[3], qreal res[3]) const;
|
||||
void getInverseTransformOf(const qreal src[3], qreal res[3]) const;
|
||||
void getLocalTransformOf(const qreal src[3], qreal res[3]) const;
|
||||
void getLocalInverseTransformOf(const qreal src[3], qreal res[3]) const;
|
||||
void getTransformOfIn(const qreal src[3], qreal res[3],
|
||||
const Frame *const in) const;
|
||||
void getTransformOfFrom(const qreal src[3], qreal res[3],
|
||||
const Frame *const from) const;
|
||||
//@}
|
||||
|
||||
/*! @name Constraint on the displacement */
|
||||
//@{
|
||||
/*! Returns the current constraint applied to the Frame.
|
||||
|
||||
A \c NULL value (default) means that no Constraint is used to filter Frame
|
||||
translation and rotation. See the Constraint class documentation for details.
|
||||
|
||||
You may have to use a \c dynamic_cast to convert the result to a Constraint
|
||||
derived class. */
|
||||
Constraint *constraint() const { return constraint_; }
|
||||
/*! Sets the constraint() attached to the Frame.
|
||||
|
||||
A \c NULL value means no constraint. The previous constraint() should be
|
||||
deleted by the calling method if needed. */
|
||||
void setConstraint(Constraint *const constraint) { constraint_ = constraint; }
|
||||
//@}
|
||||
|
||||
/*! @name Associated matrices */
|
||||
//@{
|
||||
public:
|
||||
const GLdouble *matrix() const;
|
||||
void getMatrix(GLdouble m[4][4]) const;
|
||||
void getMatrix(GLdouble m[16]) const;
|
||||
|
||||
const GLdouble *worldMatrix() const;
|
||||
void getWorldMatrix(GLdouble m[4][4]) const;
|
||||
void getWorldMatrix(GLdouble m[16]) const;
|
||||
|
||||
void setFromMatrix(const GLdouble m[4][4]);
|
||||
void setFromMatrix(const GLdouble m[16]);
|
||||
//@}
|
||||
|
||||
/*! @name Inversion of the transformation */
|
||||
//@{
|
||||
Frame inverse() const;
|
||||
/*! Returns the inverse() of the Frame world transformation.
|
||||
|
||||
The orientation() of the new Frame is the Quaternion::inverse() of the
|
||||
original orientation. Its position() is the negated and inverse rotated image
|
||||
of the original position.
|
||||
|
||||
The result Frame has a \c NULL referenceFrame() and a \c NULL constraint().
|
||||
|
||||
Use inverse() for a local (i.e. with respect to referenceFrame())
|
||||
transformation inverse. */
|
||||
Frame worldInverse() const {
|
||||
return Frame(-(orientation().inverseRotate(position())),
|
||||
orientation().inverse());
|
||||
}
|
||||
//@}
|
||||
|
||||
/*! @name XML representation */
|
||||
//@{
|
||||
public:
|
||||
virtual QDomElement domElement(const QString &name,
|
||||
QDomDocument &document) const;
|
||||
public Q_SLOTS:
|
||||
virtual void initFromDOMElement(const QDomElement &element);
|
||||
//@}
|
||||
|
||||
private:
|
||||
// P o s i t i o n a n d o r i e n t a t i o n
|
||||
Vec t_;
|
||||
Quaternion q_;
|
||||
|
||||
// C o n s t r a i n t s
|
||||
Constraint *constraint_;
|
||||
|
||||
// F r a m e c o m p o s i t i o n
|
||||
const Frame *referenceFrame_;
|
||||
};
|
||||
|
||||
}} // namespace CGAL::qglviewer
|
||||
|
||||
#ifdef CGAL_HEADER_ONLY
|
||||
//#include <CGAL/Qt/qglviewer_impl_list.h>
|
||||
#endif // CGAL_HEADER_ONLY
|
||||
|
||||
#endif // QGLVIEWER_FRAME_H
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue