Skip to content

Commit

Permalink
Merge remote-tracking branch 'cgal/master' into BGL-Openmesh_selectio…
Browse files Browse the repository at this point in the history
…n-GF
  • Loading branch information
janetournois committed Sep 9, 2024
2 parents 4aae544 + 9ff7098 commit 1066666
Show file tree
Hide file tree
Showing 63 changed files with 1,383 additions and 298 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void test_algebraic_structure_intern(
//commutative
assert(a+b+c==c+b+a);
assert(a*b*c==c*b*a);
//distributiv
//distributive
assert((a-b)*c==a*c-b*c);
assert((a+b)*c==a*c+b*c);
//binom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,10 @@ void CurveInputMethod::beginInput_()

static inline void clearPainterPath(QPainterPath& ppath)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0))
ppath.clear();
#else
ppath = {};
#endif
}


void CurveInputMethod::reset()
{
this->resetInput();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ void GridGraphicsItem::setSpacing(int spacing_)
static inline qreal
horizontalAdvance(const QFontMetrics& fm, const QString& text)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
return fm.horizontalAdvance(text);
#else
return fm.boundingRect(text).width();
#endif
}

void GridGraphicsItem::paint(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Input is based on the curves and points indexes from intersect.pt
# intersect.xcv. The first two numbers are the numbers of the input curves
# to be intersected. After that there is the number of intesections and
# to be intersected. After that there is the number of intersections and
# 2-3 numbers representing each intersection. Meaning, the input is of the form:
# intersect <id of 1st x-curve> <id of 2nd x-curve> \
# <expected number of intersections> [<type of intersection> \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,62 +76,13 @@ class External_structure_builder : public Modifier_base<typename Nef_::SNC_and_P

SNC_structure* sncp(sncpl.sncp);
SNC_point_locator* pl(sncpl.pl);



Unique_hash_map<SHalfedge_handle, SFace_handle> sedge2sface;
/*
SFace_iterator sfi;
CGAL_forall_sfaces(sfi, *sncp) {
SFace_cycle_iterator sfc;
for(sfc = sfi->sface_cycles_begin(); sfc != sfi->sface_cycles_end(); ++sfc) {
if(sfc.is_shalfedge()){
SHalfedge_around_sface_circulator eaf(sfc), end(eaf);
CGAL_For_all(eaf,end) {
SHalfedge_handle se(eaf);
sedge2sface[eaf] = sfi;
}
}
}
}
// CGAL::SNC_io_parser<SNC_structure> O0(std::cerr, *sncp, false);
// O0.print();
SHalfedge_iterator sei;
CGAL_forall_shalfedges(sei, *sncp) {
SHalfedge_handle se(sei);
if(sedge2sface[se] == SFace_handle()) {
SM_decorator SD(&*sei->source()->source());
SFace_handle sf_new = SD.new_sface();
sf_new->mark() = sei->incident_sface()->mark();
CGAL_NEF_TRACEN("new entry sedge " << sei->source()->point()
<< "->" << sei->twin()->source()->point()
<< " at " << sei->source()->source()->point());
SD.link_as_face_cycle(sei, sf_new);
SHalfedge_around_sface_circulator eaf(se), end(eaf);
CGAL_For_all(eaf,end) {
SHalfedge_handle se(eaf);
sedge2sface[eaf] = sf_new;
}
// TODO: relink inner sface cycles
}
}
*/
SNC_point_locator* old_pl = pl;
pl = pl->clone();
sncpl.pl = pl;
delete old_pl;
SNC_external_structure C(*sncp,pl);
C.clear_external_structure();
C.build_external_structure();

// CGAL::SNC_io_parser<SNC_structure> Ox(std::cerr, *sncp, false);
// Ox.print();
delete old_pl;
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <CGAL/Nef_3/SNC_indexed_items.h>
#include <CGAL/convex_decomposition_3.h>
#include <list>

typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
typedef CGAL::Nef_polyhedron_3<Kernel, CGAL::SNC_indexed_items> Nef_polyhedron_3;
typedef Nef_polyhedron_3::Volume_const_iterator Volume_const_iterator;

std::size_t run(std::string path)
{
Polyhedron_3 input;
std::ifstream(path) >> input;

Nef_polyhedron_3 N(input);

CGAL::convex_decomposition_3(N);
std::list<Polyhedron_3> convex_parts;

Volume_const_iterator ci = ++N.volumes_begin();
for( ; ci != N.volumes_end(); ++ci) {
if(ci->mark()) {
Polyhedron_3 P;
N.convert_inner_shell_to_polyhedron(ci->shells_begin(), P);
convex_parts.push_back(P);
}
}

// int i=0;
for (const Polyhedron_3& P : convex_parts)
{
// std::ofstream("out_"+std::to_string(i++)+".off") << std::setprecision(17) << P;
assert(P.size_of_vertices()!=0);
}

return convex_parts.size();
}

int main()
{
std::size_t val = run("data/in1.off");
assert(val==9);
val = run("data/in2.off");
assert(val==10);
val = run("data/in3.off");
assert(val==13);
val = run("data/in4.off");
assert(val==17);
}
117 changes: 117 additions & 0 deletions Convex_decomposition_3/test/Convex_decomposition_3/data/in1.off
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
OFF 40 76 0
5 -5 4
5 -5 2
5 5 2
5 5 4
5 -5 -2
5 -5 -4
5 5 -4
5 5 -2
-5 5 4
-5 -5 4
-4 -4 4
-4 4 4
4 4 4
4 -4 4
-5 -5 -4
-5 5 -4
-4 4 -4
-4 -4 -4
4 -4 -4
4 4 -4
-5 5 2
-5 -5 2
-5 -5 -2
-5 5 -2
4 4 2
4 -4 2
4 -4 -2
4 4 -2
-4 4 2
-4 -4 2
-4 4 -2
-4 -4 -2
6 -6 2
6 -6 -2
6 6 -2
6 6 2
-6 6 2
-6 -6 2
-6 -6 -2
-6 6 -2
3 0 2 3
3 2 0 1
3 4 6 7
3 6 4 5
3 3 12 0
3 3 11 12
3 11 8 10
3 8 11 3
3 13 0 12
3 10 0 13
3 10 9 0
3 9 10 8
3 5 18 6
3 5 17 18
3 17 14 16
3 14 17 5
3 19 6 18
3 16 6 19
3 16 15 6
3 15 16 14
3 21 8 20
3 8 21 9
3 14 23 15
3 23 14 22
3 2 8 3
3 8 2 20
3 6 23 7
3 23 6 15
3 21 0 9
3 0 21 1
3 14 4 22
3 4 14 5
3 25 12 24
3 12 25 13
3 18 27 19
3 27 18 26
3 10 28 11
3 28 10 29
3 31 16 30
3 16 31 17
3 28 12 11
3 12 28 24
3 16 27 30
3 27 16 19
3 25 10 13
3 10 25 29
3 18 31 26
3 31 18 17
3 32 34 35
3 34 32 33
3 35 2 32
3 35 20 2
3 20 36 21
3 36 20 35
3 1 32 2
3 21 32 1
3 21 37 32
3 37 21 36
3 28 25 24
3 25 28 29
3 33 4 34
3 33 22 4
3 22 38 23
3 38 22 33
3 7 34 4
3 23 34 7
3 23 39 34
3 39 23 38
3 31 27 26
3 27 31 30
3 38 36 39
3 36 38 37
3 34 36 35
3 36 34 39
3 38 32 37
3 32 38 33
Loading

0 comments on commit 1066666

Please sign in to comment.