Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor 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
schwede
openstructure
Commits
8d10b55c
Commit
8d10b55c
authored
13 years ago
by
Niklaus Johner
Browse files
Options
Downloads
Patches
Plain Diff
Added export for geom::MinDistance and optimized its speed a little
parent
8c575cfc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/geom/pymod/export_vecmat3_op.cc
+1
-0
1 addition, 0 deletions
modules/geom/pymod/export_vecmat3_op.cc
modules/geom/src/vecmat3_op.cc
+3
-3
3 additions, 3 deletions
modules/geom/src/vecmat3_op.cc
with
4 additions
and
3 deletions
modules/geom/pymod/export_vecmat3_op.cc
+
1
−
0
View file @
8d10b55c
...
...
@@ -64,4 +64,5 @@ void export_VecMat3_op()
def
(
"OrthogonalVector"
,
OrthogonalVector
);
def
(
"Min"
,
Vec3Min
);
def
(
"Max"
,
Vec3Max
);
def
(
"MinDistance"
,
MinDistance
);
}
This diff is collapsed.
Click to expand it.
modules/geom/src/vecmat3_op.cc
+
3
−
3
View file @
8d10b55c
...
...
@@ -196,15 +196,15 @@ Real MinDistance(const Vec3List& l1, const Vec3List& l2)
{
// returns the minimal distance between two sets of points (Vec3List)
if
(
l1
.
size
()
==
0
||
l2
.
size
()
==
0
){
throw
std
::
runtime_error
(
"cannot calculate minimal distance: empty Vec3List"
);}
Real
min
=
Distance
(
*
l1
.
begin
()
,
*
l2
.
begin
());
Real
min
=
Length2
(
*
l1
.
begin
()
-
*
l2
.
begin
());
Real
d
;
for
(
Vec3List
::
const_iterator
p1
=
l1
.
begin
(),
e1
=
l1
.
end
();
p1
!=
e1
;
p1
++
)
{
for
(
Vec3List
::
const_iterator
p2
=
l2
.
begin
(),
e2
=
l2
.
end
();
p2
!=
e2
;
p2
++
)
{
d
=
Distance
(
*
p1
,
*
p2
);
d
=
Length2
(
*
p1
-
*
p2
);
if
(
d
<
min
)
min
=
d
;
}
}
return
min
;
return
std
::
sqrt
(
min
)
;
}
}
// ns
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