Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
1783ddfd
Commit
1783ddfd
authored
4 years ago
by
Raphael Grimm
Browse files
Options
Downloads
Patches
Plain Diff
Add TriMeshModel::nonUniformSampleSurface
parent
66cd6224
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
VirtualRobot/Visualization/TriMeshModel.h
+16
-0
16 additions, 0 deletions
VirtualRobot/Visualization/TriMeshModel.h
with
16 additions
and
0 deletions
VirtualRobot/Visualization/TriMeshModel.h
+
16
−
0
View file @
1783ddfd
...
...
@@ -64,6 +64,22 @@ namespace VirtualRobot
/// Virtual destructor.
virtual
~
TriMeshModel
()
=
default
;
Eigen
::
Vector3f
nonUniformSampleSurface
(
auto
&
gen
)
const
{
if
(
faces
.
empty
())
{
return
Eigen
::
Vector3f
::
Zero
();
}
std
::
uniform_int_distribution
<
std
::
size_t
>
d
{
0
,
faces
.
size
()};
const
auto
&
f
=
faces
.
at
(
d
(
gen
));
const
float
f0
=
1
+
d
(
gen
);
const
float
f1
=
1
+
d
(
gen
);
const
float
f2
=
1
+
d
(
gen
);
const
Eigen
::
Vector3f
factors
=
Eigen
::
Vector3f
{
f0
,
f1
,
f2
}.
normalized
();
return
factors
(
0
)
*
vertices
.
at
(
f
.
id1
)
+
factors
(
1
)
*
vertices
.
at
(
f
.
id2
)
+
factors
(
2
)
*
vertices
.
at
(
f
.
id3
);
}
void
addTriangleWithFace
(
const
Eigen
::
Vector3f
&
vertex1
,
const
Eigen
::
Vector3f
&
vertex2
,
const
Eigen
::
Vector3f
&
vertex3
);
void
addTriangleWithFace
(
const
Eigen
::
Vector3f
&
vertex1
,
const
Eigen
::
Vector3f
&
vertex2
,
const
Eigen
::
Vector3f
&
vertex3
,
Eigen
::
Vector3f
normal
,
...
...
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