Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RoFIbots
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Marek Trtík
RoFIbots
Commits
a642d592
There was an error fetching the commit references. Please try again later.
Commit
a642d592
authored
10 months ago
by
Martin Štourač
Browse files
Options
Downloads
Patches
Plain Diff
fix translation and rotation in export
parent
c23b0484
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/algo/include/algo/misc.hpp
+1
-1
1 addition, 1 deletion
src/algo/include/algo/misc.hpp
src/algo/src/misc.cpp
+27
-5
27 additions, 5 deletions
src/algo/src/misc.cpp
src/filein/src/rofiworld_loader.cpp
+2
-5
2 additions, 5 deletions
src/filein/src/rofiworld_loader.cpp
with
30 additions
and
11 deletions
src/algo/include/algo/misc.hpp
+
1
−
1
View file @
a642d592
...
...
@@ -24,7 +24,7 @@ bool AABB_intersect(const AABB &fst_aabb, const AABB &snd_aabb, const node_ptr &
std
::
pair
<
std
::
size_t
,
std
::
size_t
>
get_pad_width_height_from_connector_count
(
const
std
::
vector
<
connector_ptr
>
&
connectors
);
glm
::
vec3
convertToRoFICoordinates
(
const
glm
::
vec3
&
position
);
glm
::
vec3
convertToRoFICoordinates
(
const
glm
::
vec3
&
position
,
const
glm
::
vec3
&
to_voxel_center
);
glm
::
mat4
convertToRoFICoordinates
(
const
glm
::
mat4
&
matrix
);
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/algo/src/misc.cpp
+
27
−
5
View file @
a642d592
...
...
@@ -109,16 +109,38 @@ std::pair<std::size_t, std::size_t> get_pad_width_height_from_connector_count(co
return
{
static_cast
<
std
::
size_t
>
(
max_x_pos
)
+
1
,
static_cast
<
std
::
size_t
>
(
max_y_pos
)
+
1
};
}
glm
::
vec3
convertToRoFICoordinates
(
const
glm
::
vec3
&
position
)
glm
::
vec3
convertToRoFICoordinates
(
const
glm
::
vec3
&
position
,
const
glm
::
vec3
&
to_voxel_center
)
{
return
glm
::
vec3
(
position
.
z
,
position
.
x
,
position
.
y
);
const
auto
voxel_position
=
position
+
to_voxel_center
*
0.5
f
;
return
glm
::
vec3
(
voxel_position
.
z
,
voxel_position
.
x
,
voxel_position
.
y
);
}
glm
::
mat4
convertToRoFICoordinates
(
const
glm
::
mat4
&
matrix
)
{
auto
m
=
glm
::
toMat4
(
glm
::
angleAxis
(
glm
::
radians
(
90.0
f
),
glm
::
vec3
(
0.0
f
,
0.0
f
,
1.0
f
)))
*
glm
::
toMat4
(
glm
::
angleAxis
(
glm
::
radians
(
90.0
f
),
glm
::
vec3
(
1.0
f
,
0.0
f
,
0.0
f
)))
*
matrix
;
// E -> E'
// auto m = // glm::toMat4(glm::angleAxis(glm::radians(90.0f), glm::vec3(0.0f, 0.0f, -1.0f)))
// glm::toMat4(glm::angleAxis(glm::radians(90.0f), glm::vec3(0.0f, -1.0f, 0.0f)))
// * glm::toMat4(glm::angleAxis(glm::radians(90.0f), glm::vec3(-1.0f, 0.0f, 0.0f)))
// // * matrix
// // * r_matrix;
// * corrected_matrix;
const
auto
A_neg_X_local_correction_matrix
=
glm
::
mat4
(
0
,
0
,
1
,
0
,
// col X
0
,
-
1
,
0
,
0
,
// col Y
1
,
0
,
0
,
0
,
// col Z
0
,
0
,
0
,
1
// col W
);
const
auto
corrected_component_matrix
=
matrix
*
A_neg_X_local_correction_matrix
;
const
auto
magic_matrix
=
glm
::
mat4
(
0
,
1
,
0
,
0
,
// col X
0
,
0
,
1
,
0
,
// col Y
1
,
0
,
0
,
0
,
// col Z
0
,
0
,
0
,
1
// col W
);
auto
m
=
magic_matrix
*
corrected_component_matrix
;
m
[
3
]
=
glm
::
vec4
(
0.0
f
,
0.0
f
,
0.0
f
,
1.0
f
);
return
m
;
...
...
This diff is collapsed.
Click to expand it.
src/filein/src/rofiworld_loader.cpp
+
2
−
5
View file @
a642d592
...
...
@@ -142,8 +142,7 @@ void export_spaceJoint(boost::json::array &spaceJoints_array, const rofiworld_pt
void
export_spaceJoint_point
(
boost
::
json
::
object
&
spaceJoint_object
,
const
node_ptr
node
)
{
boost
::
json
::
array
point_array
;
const
auto
position
=
convertToRoFICoordinates
(
node
->
getPositionWorld
());
// const auto position = node->getPositionWorld();
const
auto
position
=
convertToRoFICoordinates
(
node
->
getPositionWorld
(),
node
->
getRotationAxisZWorld
());
for
(
int
i
=
0
;
i
<
3
;
++
i
)
point_array
.
emplace_back
(
position
[
i
]);
...
...
@@ -167,9 +166,7 @@ void export_spaceJoint_joint(boost::json::object &spaceJoint_object, const node_
void
export_spaceJoint_joint_matrix
(
boost
::
json
::
object
&
joint_object
,
const
node_ptr
node
)
{
auto
component_coord_convert
=
glm
::
toMat4
(
glm
::
rotation
(
glm
::
vec3
(
0.0
f
,
0.0
f
,
-
1.0
f
),
-
node
->
getRotationAxisZWorld
()));
// auto rotation_mat = convertToRoFICoordinates(component_coord_convert);
auto
rotation_mat
=
component_coord_convert
;
auto
rotation_mat
=
convertToRoFICoordinates
(
node
->
getRotationMatWorld
());
float
epsilon
=
0.00001
f
;
bool
is_identity
=
true
;
...
...
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