Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
7b1b9b8d
Commit
7b1b9b8d
authored
Nov 30, 2010
by
Alexander Wiebel
Browse files
[ADD] new transformation function
parent
59da72da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
src/dataHandler/WGridRegular3D.cpp
src/dataHandler/WGridRegular3D.cpp
+16
-0
src/dataHandler/WGridRegular3D.h
src/dataHandler/WGridRegular3D.h
+7
-1
No files found.
src/dataHandler/WGridRegular3D.cpp
View file @
7b1b9b8d
...
...
@@ -386,6 +386,22 @@ wmath::WVector3D WGridRegular3D::worldCoordToTexCoord( wmath::WPosition point )
r
[
1
]
+=
0.5
/
m_nbPosY
;
r
[
2
]
+=
0.5
/
m_nbPosZ
;
return
r
;
}
wmath
::
WPosition
WGridRegular3D
::
texCoordToWorldCoord
(
wmath
::
WVector3D
coords
)
{
wmath
::
WVector3D
r
(
wmath
::
transformPosition3DWithMatrix4D
(
m_matrix
,
coords
)
);
// Correct the coordinates to have the position at the center of the texture voxel.
r
[
0
]
-=
0.5
/
m_nbPosX
;
r
[
1
]
-=
0.5
/
m_nbPosY
;
r
[
2
]
-=
0.5
/
m_nbPosZ
;
// Scale to [0,max]
r
[
0
]
=
r
[
0
]
*
m_nbPosX
;
r
[
1
]
=
r
[
1
]
*
m_nbPosY
;
r
[
2
]
=
r
[
2
]
*
m_nbPosZ
;
return
r
;
}
...
...
src/dataHandler/WGridRegular3D.h
View file @
7b1b9b8d
...
...
@@ -250,10 +250,16 @@ public:
/**
* Transforms world coordinates to texture coordinates.
* \param point The point with these coordinate
d
will be transformed.
* \param point The point with these coordinate
s
will be transformed.
*/
wmath
::
WVector3D
worldCoordToTexCoord
(
wmath
::
WPosition
point
);
/**
* Transforms texture coordinates to world coordinates.
* \param point The point with these coordinates will be transformed.
*/
wmath
::
WPosition
texCoordToWorldCoord
(
wmath
::
WVector3D
coords
);
/**
* Returns the i'th voxel where the given position belongs too.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment