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
426787ca
Commit
426787ca
authored
6 years ago
by
Mirko Wächter
Browse files
Options
Downloads
Patches
Plain Diff
minor tweaks in trimesh grid creation
parent
144b737f
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/TriMeshUtils.cpp
+11
-6
11 additions, 6 deletions
VirtualRobot/Visualization/TriMeshUtils.cpp
with
11 additions
and
6 deletions
VirtualRobot/Visualization/TriMeshUtils.cpp
+
11
−
6
View file @
426787ca
...
...
@@ -31,9 +31,11 @@ void TriMeshUtils::CreateBoxTriangles(std::vector<TriMeshModel::triangle> &trian
auto
h
=
height
/
2
;
auto
d
=
depth
/
2
;
Eigen
::
Vector3f
globalPos
=
globalPose
.
block
<
3
,
1
>
(
0
,
3
);
Eigen
::
Matrix3f
globalOrientation
=
globalPose
.
block
<
3
,
3
>
(
0
,
0
);
auto
transf
=
[
&
](
Eigen
::
Vector3f
&
pos
)
{
pos
=
global
Pose
.
block
<
3
,
3
>
(
0
,
0
)
*
pos
+
globalPos
e
.
block
<
3
,
1
>
(
0
,
3
)
;
pos
=
global
Orientation
*
pos
+
globalPos
;
};
static
const
float
rawVertices
[]
=
{
...
...
@@ -76,16 +78,19 @@ void TriMeshUtils::CreateBoxTriangles(std::vector<TriMeshModel::triangle> &trian
};
triangles
.
resize
(
12
);
std
::
array
<
Eigen
::
Vector3f
,
3
>
vertices
;
auto
currentPointer
=
&
rawVertices
[
0
];
for
(
int
i
=
0
;
i
<
12
;
i
++
)
{
for
(
int
j
=
0
;
j
<
3
;
++
j
)
{
int
offset
=
i
*
9
+
j
*
3
;
auto
&
v
=
vertices
.
at
(
j
);
v
.
x
()
=
rawVertices
[
offset
+
0
]
*
w
;
v
.
y
()
=
rawVertices
[
offset
+
1
]
*
h
;
v
.
z
()
=
rawVertices
[
offset
+
2
]
*
d
;
v
.
x
()
=
(
*
currentPointer
++
)
*
w
;
v
.
y
()
=
(
*
currentPointer
++
)
*
h
;
v
.
z
()
=
(
*
currentPointer
++
)
*
d
;
transf
(
v
);
}
triangles
.
at
(
i
)
=
{
vertices
.
at
(
0
),
vertices
.
at
(
1
),
vertices
.
at
(
2
)};
auto
&
t
=
triangles
.
at
(
i
);
t
.
vertex1
=
vertices
.
at
(
0
);
t
.
vertex2
=
vertices
.
at
(
1
);
t
.
vertex3
=
vertices
.
at
(
2
);
}
}
...
...
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