Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
f
m
o
q
s
v
Enumerations
Enumerator
a
b
c
d
g
h
n
o
r
s
v
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
g
h
i
m
n
o
p
r
s
t
v
Enumerations
Enumerator
a
d
e
f
h
i
n
o
p
q
v
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
Typedefs
b
c
d
f
i
m
p
q
r
s
t
v
Enumerations
Enumerator
b
e
m
n
o
q
r
s
t
w
x
z
Macros
_
b
c
d
e
f
g
h
m
n
o
p
q
r
s
t
w
z
third-parties
qhull
src
qhulltest
QhullRidge_test.cpp
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** Copyright (c) 2008-2015 C.B. Barber. All rights reserved.
4
** $Id: //main/2015/qhull/src/qhulltest/QhullRidge_test.cpp#3 $$Change: 2062 $
5
** $DateTime: 2016/01/17 13:13:18 $$Author: bbarber $
6
**
7
****************************************************************************/
8
9
//pre-compiled headers
10
#include <iostream>
11
#include "
RoadTest.h
"
// QT_VERSION
12
13
#include "
libqhullcpp/QhullRidge.h
"
14
#include "
libqhullcpp/QhullError.h
"
15
#include "
libqhullcpp/RboxPoints.h
"
16
#include "
libqhullcpp/QhullFacet.h
"
17
#include "
libqhullcpp/Qhull.h
"
18
19
using
std::cout;
20
using
std::endl;
21
using
std::ostringstream;
22
using
std::ostream;
23
using
std::string;
24
25
namespace
orgQhull
{
26
27
class
QhullRidge_test
:
public
RoadTest
28
{
29
Q_OBJECT
30
31
#
32
private slots:
33
void
cleanup
();
34
void
t_construct
();
35
void
t_getSet
();
36
void
t_foreach
();
37
void
t_io
();
38
};
//QhullRidge_test
39
40
void
41
add_QhullRidge_test
()
42
{
43
new
QhullRidge_test
();
// RoadTest::s_testcases
44
}
45
46
//Executed after each testcase
47
void
QhullRidge_test::
48
cleanup
()
49
{
50
RoadTest::cleanup
();
51
}
52
53
void
QhullRidge_test::
54
t_construct
()
55
{
56
// Qhull.runQhull() constructs QhullFacets as facetT
57
RboxPoints
rcube(
"c"
);
58
Qhull
q
(rcube,
"QR0"
);
// triangulation of rotated unit cube
59
QhullRidge
r
(
q
);
60
QVERIFY(!
r
.isValid());
61
QCOMPARE(
r
.dimension(),2);
62
QhullFacet
f(
q
.firstFacet());
63
QhullRidgeSet
rs(f.
ridges
());
64
QVERIFY(!rs.
isEmpty
());
// Simplicial facets do not have ridges()
65
QhullRidge
r2
(rs.
first
());
66
QCOMPARE(
r2
.dimension(), 2);
// One dimension lower than the facet
67
r
=
r2
;
68
QVERIFY(
r
.isValid());
69
QCOMPARE(
r
.dimension(), 2);
70
QhullRidge
r3(
q
,
r2
.getRidgeT());
71
QCOMPARE(
r
,r3);
72
QhullRidge
r4(
q
,
r2
.getBaseT());
73
QCOMPARE(
r
,r4);
74
QhullRidge
r5=
r2
;
// copy constructor
75
QVERIFY(r5==
r2
);
76
QVERIFY(r5==
r
);
77
}
//t_construct
78
79
void
QhullRidge_test::
80
t_getSet
()
81
{
82
RboxPoints
rcube(
"c"
);
83
{
84
Qhull
q
(rcube,
"QR0"
);
// triangulation of rotated unit cube
85
QCOMPARE(
q
.facetCount(), 6);
86
QCOMPARE(
q
.vertexCount(), 8);
87
QhullFacet
f(
q
.firstFacet());
88
QhullRidgeSet
rs= f.
ridges
();
89
QhullRidgeSetIterator
i(rs);
90
while
(i.
hasNext
()){
91
const
QhullRidge
r
= i.
next
();
92
cout <<
r
.id() << endl;
93
QVERIFY(
r
.bottomFacet()!=
r
.topFacet());
94
QCOMPARE(
r
.dimension(), 2);
// Ridge one-dimension less than facet
95
QVERIFY(
r
.id()>=0 &&
r
.id()<9*27);
96
QVERIFY(
r
.isValid());
97
QVERIFY(
r
==
r
);
98
QVERIFY(
r
==i.
peekPrevious
());
99
QCOMPARE(
r
.otherFacet(
r
.bottomFacet()),
r
.topFacet());
100
QCOMPARE(
r
.otherFacet(
r
.topFacet()),
r
.bottomFacet());
101
}
102
}
103
}
//t_getSet
104
105
void
QhullRidge_test::
106
t_foreach
()
107
{
108
RboxPoints
rcube(
"c"
);
// cube
109
{
110
Qhull
q
(rcube,
"QR0"
);
// rotated cube
111
QhullFacet
f(
q
.firstFacet());
112
foreach
(
const
QhullRidge
&
r
, f.
ridges
()){
// Qt only
113
QhullVertexSet
vs=
r
.vertices();
114
QCOMPARE(vs.
count
(), 2);
115
foreach
(
const
QhullVertex
&
v
, vs){
// Qt only
116
QVERIFY(f.
vertices
().
contains
(
v
));
117
}
118
}
119
QhullRidgeSet
rs= f.
ridges
();
120
QhullRidge
r
= rs.
first
();
121
QhullRidge
r2
=
r
;
122
QList<QhullVertex> vs;
123
int
count= 0;
124
while
(!count ||
r2
!=
r
){
125
++count;
126
QhullVertex
v
(
q
);
127
QVERIFY2(
r2
.hasNextRidge3d(f),
"A cube should only have non-simplicial facets."
);
128
QhullRidge
r3=
r2
.nextRidge3d(f, &
v
);
129
QVERIFY(!vs.contains(
v
));
130
vs <<
v
;
131
r2
=
r2
.nextRidge3d(f);
132
QCOMPARE(r3,
r2
);
133
}
134
QCOMPARE(vs.count(), rs.
count
());
135
QCOMPARE(count, rs.
count
());
136
}
137
}
//t_foreach
138
139
void
QhullRidge_test::
140
t_io
()
141
{
142
RboxPoints
rcube(
"c"
);
143
{
144
Qhull
q
(rcube,
""
);
145
QhullFacet
f(
q
.firstFacet());
146
QhullRidgeSet
rs= f.
ridges
();
147
QhullRidge
r
= rs.
first
();
148
ostringstream os;
149
os <<
"Ridges\n"
<< rs <<
"Ridge\n"
<<
r
;
150
os <<
r
.print(
"\nRidge with message"
);
151
cout << os.str();
152
QString s= QString::fromStdString(os.str());
153
QCOMPARE(s.count(
" r"
), 6);
154
}
155
}
//t_io
156
157
}
//orgQhull
158
159
#include "moc/QhullRidge_test.moc"
orgQhull::QhullRidge_test::cleanup
void cleanup()
Definition:
QhullRidge_test.cpp:48
QhullFacet.h
orgQhull::QhullVertexSet
Definition:
QhullVertexSet.h:33
orgQhull::QhullSet::first
const T first() const
Definition:
QhullSet.h:163
orgQhull::QhullRidge_test::t_io
void t_io()
Definition:
QhullRidge_test.cpp:140
orgQhull::QhullRidge_test::t_construct
void t_construct()
Definition:
QhullRidge_test.cpp:54
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition:
Coordinates.cpp:21
Qhull.h
orgQhull::QhullVertex
Definition:
QhullVertex.h:48
orgQhull::add_QhullRidge_test
void add_QhullRidge_test()
Definition:
QhullRidge_test.cpp:41
orgQhull::QhullSetIterator
Faster then interator/const_iterator due to T::base_type.
Definition:
QhullSet.h:289
octree.r
r
Definition:
octree.py:9
orgQhull::Qhull
Interface to Qhull from C++.
Definition:
Qhull.h:49
orgQhull::QhullSet::contains
bool contains(const T &t) const
Definition:
QhullSet.h:385
orgQhull::QhullSet::isEmpty
bool isEmpty() const
Definition:
QhullSet.h:76
QhullRidge.h
orgQhull::QhullSet::count
countT count(const T &t) const
Definition:
QhullSet.h:395
orgQhull::QhullRidge
Definition:
QhullRidge.h:58
orgQhull::QhullSet
Definition:
QhullSet.h:105
orgQhull::QhullFacet::vertices
QhullVertexSet vertices() const
Definition:
QhullFacet.cpp:198
orgQhull::QhullRidge_test
Definition:
QhullRidge_test.cpp:27
q
q
orgQhull::RoadTest
Definition:
RoadTest.h:54
orgQhull::QhullFacet
A QhullFacet is the C++ equivalent to Qhull's facetT*.
Definition:
QhullFacet.h:43
orgQhull::RboxPoints
Definition:
RboxPoints.h:37
orgQhull::QhullRidge_test::t_getSet
void t_getSet()
Definition:
QhullRidge_test.cpp:80
orgQhull::QhullFacet::ridges
QhullRidgeSet ridges() const
Definition:
QhullFacet.cpp:192
RoadTest.h
orgQhull::QhullRidge_test::t_foreach
void t_foreach()
Definition:
QhullRidge_test.cpp:106
r2
r2
orgQhull::QhullSetIterator::next
T next()
Definition:
QhullSet.h:317
RboxPoints.h
QhullError.h
orgQhull::RoadTest::cleanup
void cleanup()
Executed after each test.
Definition:
RoadTest.cpp:38
obb.v
list v
Definition:
obb.py:48
orgQhull::QhullSetIterator::hasNext
bool hasNext() const
Definition:
QhullSet.h:315
orgQhull::QhullSetIterator::peekPrevious
T peekPrevious() const
Definition:
QhullSet.h:319
hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:15