Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
graintracking
DCT
Commits
fa50ebb8
Commit
fa50ebb8
authored
9 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
Polyhedron: fixed possible issue with incomplete sets of plane normals
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
cb8a63db
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
zUtil_Maths/gtMathsGetPolyhedronVerticesFromPlaneNormals.m
+12
-5
12 additions, 5 deletions
zUtil_Maths/gtMathsGetPolyhedronVerticesFromPlaneNormals.m
with
12 additions
and
5 deletions
zUtil_Maths/gtMathsGetPolyhedronVerticesFromPlaneNormals.m
+
12
−
5
View file @
fa50ebb8
...
...
@@ -19,8 +19,9 @@ function verts = gtMathsGetPolyhedronVerticesFromPlaneNormals(pl_normals)
for
ii
=
1
:
num_pls
[
ps
,
ds_vers
]
=
get_intersecting_lines
(
ii
,
pl_normals
,
pl_normals_vers
,
pl_normals_norm
);
verts
=
[
verts
;
...
get_intersection_points
(
ps
,
ds_vers
,
pl_normals_vers
,
pl_normals_norm
)];
%#ok<AGROW>
[
new_verts
,
valid
]
=
...
get_intersection_points
(
ps
,
ds_vers
,
pl_normals_vers
,
pl_normals_norm
);
verts
=
[
verts
;
new_verts
(
valid
,
:)];
%#ok<AGROW>
end
validation_norms
=
pl_normals_norm
+
eps
(
'single'
);
...
...
@@ -73,7 +74,7 @@ function [ps, ds_vers] = get_intersecting_lines(pl_ii, pl_normals, pl_normals_ve
end
end
function
points
=
get_intersection_points
(
ps
,
ds_vers
,
pl_normals_vers
,
pl_normals_norm
)
function
[
points
,
valid
]
=
get_intersection_points
(
ps
,
ds_vers
,
pl_normals_vers
,
pl_normals_norm
)
num_ps
=
size
(
ps
,
1
);
% this is based on the fact that the intersection with the different planes
...
...
@@ -83,6 +84,7 @@ function points = get_intersection_points(ps, ds_vers, pl_normals_vers, pl_norma
% If they are not valid, we will take care of it later.
points
=
zeros
(
2
*
num_ps
,
3
);
valid
=
false
(
2
*
num_ps
,
1
);
dot_prods_ds_pls
=
(
ds_vers
*
pl_normals_vers
')'
;
not_perpendiculars
=
abs
(
dot_prods_ds_pls
)
>
eps
(
'single'
);
...
...
@@ -103,8 +105,13 @@ function points = get_intersection_points(ps, ds_vers, pl_normals_vers, pl_norma
min_norm
=
min
(
ds_norm
(
dot_prods_d_pls
>
0
));
max_norm
=
max
(
ds_norm
(
dot_prods_d_pls
<
0
));
points
(
2
*
(
line_ii
-
1
)
+
1
,
:)
=
p
+
d_vers
*
min_norm
;
points
(
2
*
line_ii
,
:)
=
p
+
d_vers
*
max_norm
;
if
(
~
isempty
(
min_norm
))
points
(
2
*
(
line_ii
-
1
)
+
1
,
:)
=
p
+
d_vers
*
min_norm
;
end
if
(
~
isempty
(
max_norm
))
points
(
2
*
line_ii
,
:)
=
p
+
d_vers
*
max_norm
;
end
valid
(
2
*
line_ii
+
(
-
1
:
0
))
=
~
[
isempty
(
min_norm
);
isempty
(
max_norm
)];
end
end
...
...
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