Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
predicats
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vincent Nivoliers
predicats
Commits
8b0cf459
Commit
8b0cf459
authored
5 years ago
by
Vincent Nivoliers
Browse files
Options
Downloads
Patches
Plain Diff
typos in presentation
parent
4997461b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/hull.cpp
+86
-19
86 additions, 19 deletions
Code/hull.cpp
Presentation/presentation.tex
+5
-5
5 additions, 5 deletions
Presentation/presentation.tex
with
91 additions
and
24 deletions
Code/hull.cpp
+
86
−
19
View file @
8b0cf459
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
//{{{ struct vec
//{{{ struct vec
struct
vec
{
struct
vec
{
vec
()
{}
;
vec
(
float
x
,
float
y
)
:
x
(
x
),
y
(
y
)
{}
vec
(
float
x
,
float
y
)
:
x
(
x
),
y
(
y
)
{}
float
x
;
float
x
;
float
y
;
float
y
;
...
@@ -36,6 +38,11 @@ struct vec {
...
@@ -36,6 +38,11 @@ struct vec {
float
length
()
const
{
float
length
()
const
{
return
sqrt
(
length2
())
;
return
sqrt
(
length2
())
;
}
}
bool
lexicoinf
(
const
vec
&
rhs
)
const
{
if
(
x
==
rhs
.
x
)
return
y
<
rhs
.
y
;
return
x
<
rhs
.
x
;
}
}
;
}
;
//}}}
//}}}
...
@@ -46,12 +53,29 @@ int sign(float x) {
...
@@ -46,12 +53,29 @@ int sign(float x) {
return
0
;
return
0
;
}
}
int
orient
(
const
vec
&
v0
,
const
vec
&
v1
)
{
int
orient
(
const
vec
&
v0_in
,
const
vec
&
v1_in
)
{
vec
v0
,
v1
;
int
factor
=
1
;
if
(
v0_in
.
lexicoinf
(
v1_in
))
{
v0
=
v0_in
;
v1
=
v1_in
;
}
else
{
v0
=
v1_in
;
v1
=
v0_in
;
factor
=
-
1
;
}
//determinant
//determinant
float
d
=
v0
.
x
*
v1
.
y
-
v0
.
y
*
v1
.
x
;
float
d
=
v0
.
x
*
v1
.
y
-
v0
.
y
*
v1
.
x
;
return
d
;
if
(
d
!=
0
)
return
factor
*
sign
(
d
)
;
//encode as sign
//perturbation
return
sign
(
d
)
;
if
(
v1
.
y
!=
0
)
return
factor
*
sign
(
v1
.
y
)
;
float
a
=
v0
.
x
-
v0
.
y
-
v1
.
x
;
if
(
a
!=
0
)
return
factor
*
sign
(
a
)
;
return
factor
*
1
;
}
}
struct
vec_compare
{
struct
vec_compare
{
...
@@ -108,7 +132,13 @@ void compute_hull(std::vector<vec>& points, std::vector<vec>& hull) {
...
@@ -108,7 +132,13 @@ void compute_hull(std::vector<vec>& points, std::vector<vec>& hull) {
//{{{ generate svg
//{{{ generate svg
void
svg_hull
(
const
std
::
string
&
filename
,
const
std
::
vector
<
vec
>&
points
,
const
std
::
vector
<
vec
>&
hull
)
{
void
svg_hull
(
const
std
::
string
&
filename
,
const
std
::
vector
<
vec
>&
points
,
const
std
::
vector
<
vec
>&
hull
,
float
salt
=
0
)
{
std
::
ofstream
file
(
filename
)
;
std
::
ofstream
file
(
filename
)
;
SvgPad
svg
(
file
,
1024
,
1024
)
;
SvgPad
svg
(
file
,
1024
,
1024
)
;
svg
.
open
()
;
svg
.
open
()
;
...
@@ -118,15 +148,35 @@ void svg_hull(const std::string& filename, const std::vector<vec>& points, const
...
@@ -118,15 +148,35 @@ void svg_hull(const std::string& filename, const std::vector<vec>& points, const
}
}
size_t
hs
=
hull
.
size
()
;
size_t
hs
=
hull
.
size
()
;
std
::
mt19937
mt
;
std
::
uniform_real_distribution
<
float
>
rf
(
-
salt
,
salt
)
;
for
(
size_t
i
=
0
;
i
<
hs
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
hs
;
++
i
)
{
vec
salti
(
0
,
0
)
;
vec
saltip
(
0
,
0
)
;
if
(
salt
>
0
)
{
salti
.
x
=
rf
(
mt
)
;
salti
.
y
=
rf
(
mt
)
;
saltip
.
x
=
rf
(
mt
)
;
saltip
.
y
=
rf
(
mt
)
;
}
svg
.
contour_point
(
hull
[
i
].
x
,
hull
[
i
].
y
)
;
svg
.
contour_point
(
hull
[
i
].
x
,
hull
[
i
].
y
)
;
svg
.
line
(
hull
[
i
].
x
,
hull
[
i
].
y
,
hull
[(
i
+
1
)
%
hs
].
x
,
hull
[(
i
+
1
)
%
hs
].
y
)
;
svg
.
line
(
hull
[
i
].
x
+
salti
.
x
,
hull
[
i
].
y
+
salti
.
y
,
hull
[(
i
+
1
)
%
hs
].
x
+
saltip
.
x
,
hull
[(
i
+
1
)
%
hs
].
y
+
saltip
.
y
)
;
}
}
svg
.
close
()
;
svg
.
close
()
;
}
}
void
svg_sort
(
const
std
::
string
&
filename
,
const
std
::
vector
<
vec
>&
points
)
{
void
svg_sort
(
const
std
::
string
&
filename
,
const
std
::
vector
<
vec
>&
points
)
{
std
::
ofstream
file
(
filename
)
;
std
::
ofstream
file
(
filename
)
;
SvgPad
svg
(
file
,
1024
,
1024
)
;
SvgPad
svg
(
file
,
1024
,
1024
)
;
svg
.
open
()
;
svg
.
open
()
;
...
@@ -179,20 +229,37 @@ int main() {
...
@@ -179,20 +229,37 @@ int main() {
//{{{ wicked test
//{{{ wicked test
{
{
std
::
vector
<
vec
>
points
;
std
::
vector
<
vec
>
aligned_
points
;
//aligned points
//aligned points
points
.
emplace_back
(
0
,
0.5
)
;
aligned_points
.
emplace_back
(
0
,
1
)
;
points
.
emplace_back
(
0
,
1
)
;
aligned_points
.
emplace_back
(
0
,
0
)
;
points
.
emplace_back
(
0
,
0
)
;
aligned_points
.
emplace_back
(
0
,
0.8
)
;
points
.
emplace_back
(
0
,
0.8
)
;
aligned_points
.
emplace_back
(
0
,
0.5
)
;
//make the hull non flat
points
.
emplace_back
(
1
,
0.5
)
;
int
indices
[
4
]
=
{
0
,
1
,
2
,
3
}
;
int
permutation_index
=
0
;
//hull
std
::
vector
<
vec
>
hull
;
//test every permutation of the input
compute_hull
(
points
,
hull
)
;
do
{
svg_hull
(
"/tmp/hull_aligned.svg"
,
points
,
hull
)
;
std
::
vector
<
vec
>
points
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
{
points
.
push_back
(
aligned_points
[
indices
[
i
]])
;
}
//make the hull non flat
points
.
emplace_back
(
1
,
0.5
)
;
//hull
std
::
vector
<
vec
>
hull
;
compute_hull
(
points
,
hull
)
;
//export
std
::
stringstream
ss
;
ss
<<
"/tmp/hull_aligned_"
<<
permutation_index
<<
".svg"
;
svg_hull
(
ss
.
str
(),
points
,
hull
,
0.02
)
;
//move to next permutation
++
permutation_index
;
}
while
(
std
::
next_permutation
(
indices
,
indices
+
4
))
;
}
}
//}}}
//}}}
...
...
This diff is collapsed.
Click to expand it.
Presentation/presentation.tex
+
5
−
5
View file @
8b0cf459
...
@@ -270,7 +270,7 @@
...
@@ -270,7 +270,7 @@
}
}
\frame
{
\frame
{
\frametitle
{
Simulation de simplicité (Edelsbrnner
\&
Mücke 90)
}
\frametitle
{
Simulation de simplicité (Edelsbr
u
nner
\&
Mücke 90)
}
\begin{center}
\begin{center}
\begin{myblock}
{
0.8
\li
}
\begin{myblock}
{
0.8
\li
}
...
@@ -285,7 +285,7 @@
...
@@ -285,7 +285,7 @@
\textbf
{
Principe :
}
\textbf
{
Principe :
}
\begin{itemize}
\begin{itemize}
\item
$
\sum
_{
k
=
0
}^
n
2
^
k
=
2
^{
k
+
1
}
-
1
$
\item
$
\sum
_{
k
=
0
}^
n
2
^
k
=
2
^{
k
+
1
}
-
1
$
\item
$
\prod
_{
k
=
0
}^
n
\eps
^{
2
^
k
}
=
\eps
^{
\sum
_{
k
=
0
}^
n
2
^
k
}
=
\eps
^{
2
^{
k
+
1
}
-
1
}
>>
\eps
^{
2
^{
k
+
1
}}$
\item
$
\prod
_{
k
=
0
}^
n
\eps
^{
2
^
k
}
=
\eps
^{
\sum
_{
k
=
0
}^
n
2
^
k
}
=
\eps
^{
2
^{
n
+
1
}
-
1
}
>>
\eps
^{
2
^{
n
+
1
}}$
\end{itemize}
\end{itemize}
}
}
...
@@ -294,10 +294,10 @@
...
@@ -294,10 +294,10 @@
\begin{equation*}
\begin{equation*}
\begin{pmatrix}
\begin{pmatrix}
p
_{
0,0
}
+
\eps
{
0,0
}
&
p
_{
0,1
}
+
\eps
{
0,1
}
&
\cdots
&
p
_{
0,d
}
+
\eps
{
0,d-1
}
&
1
\\
p
_{
0,0
}
+
\eps
_
{
0,0
}
&
p
_{
0,1
}
+
\eps
_
{
0,1
}
&
\cdots
&
p
_{
0,d
}
+
\eps
_
{
0,d-1
}
&
1
\\
p
_{
1,0
}
+
\eps
{
1,0
}
&
p
_{
1,1
}
+
\eps
{
1,1
}
&
\cdots
&
p
_{
1,d
}
+
\eps
{
1,d-1
}
&
1
\\
p
_{
1,0
}
+
\eps
_
{
1,0
}
&
p
_{
1,1
}
+
\eps
_
{
1,1
}
&
\cdots
&
p
_{
1,d
}
+
\eps
_
{
1,d-1
}
&
1
\\
\vdots
&
\vdots
&
\ddots
&
\vdots
\\
\vdots
&
\vdots
&
\ddots
&
\vdots
\\
p
_{
d,0
}
+
\eps
{
d,0
}
&
p
_{
d,1
}
+
\eps
{
d,1
}
&
\cdots
&
p
_{
d,d-1
}
+
\eps
{
d,d-1
}
&
1
p
_{
d,0
}
+
\eps
_
{
d,0
}
&
p
_{
d,1
}
+
\eps
_
{
d,1
}
&
\cdots
&
p
_{
d,d-1
}
+
\eps
_
{
d,d-1
}
&
1
\end{pmatrix}
\end{pmatrix}
\end{equation*}
\end{equation*}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment