Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NeuroTessMesh
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SimVisSuite
NeuroTessMesh
Commits
cdcc0cb2
Commit
cdcc0cb2
authored
3 years ago
by
Felix de las Pozas
Browse files
Options
Downloads
Patches
Plain Diff
Small camera animation code cleanup.
parent
111ba292
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
neurotessmesh/Scene.cpp
+8
-16
8 additions, 16 deletions
neurotessmesh/Scene.cpp
neurotessmesh/Scene.h
+6
-8
6 additions, 8 deletions
neurotessmesh/Scene.h
with
14 additions
and
24 deletions
neurotessmesh/Scene.cpp
+
8
−
16
View file @
cdcc0cb2
...
@@ -121,12 +121,12 @@ namespace neurotessmesh
...
@@ -121,12 +121,12 @@ namespace neurotessmesh
const
auto
position
=
_boundingBox
.
center
();
const
auto
position
=
_boundingBox
.
center
();
const
auto
radius
=
_boundingBox
.
radius
(
)
/
FOV
;
const
auto
radius
=
_boundingBox
.
radius
(
)
/
FOV
;
animate
(
position
,
radius
);
animate
Camera
(
position
,
radius
);
}
}
void
Scene
::
cameraPosition
(
const
Eigen
::
Vector3f
&
position
,
const
float
radius
,
const
Eigen
::
Matrix3f
&
rotation
)
void
Scene
::
cameraPosition
(
const
Eigen
::
Vector3f
&
position
,
const
float
radius
,
const
Eigen
::
Matrix3f
&
rotation
)
{
{
animate
Position
(
position
,
radius
,
rotation
,
true
);
animate
Camera
(
position
,
radius
,
rotation
,
true
);
}
}
nlgeometry
::
AxisAlignedBoundingBox
Scene
::
computeBoundingBox
(
nlgeometry
::
AxisAlignedBoundingBox
Scene
::
computeBoundingBox
(
...
@@ -355,7 +355,7 @@ namespace neurotessmesh
...
@@ -355,7 +355,7 @@ namespace neurotessmesh
mode
(
Scene
::
EDITION
);
mode
(
Scene
::
EDITION
);
std
::
vector
<
unsigned
int
>
indices
=
{
id_
};
std
::
vector
<
unsigned
int
>
indices
=
{
id_
};
auto
aabb
=
computeBoundingBox
(
indices
);
auto
aabb
=
computeBoundingBox
(
indices
);
animate
(
aabb
.
center
(),
aabb
.
radius
(
)
/
sin
(
_camera
->
camera
()
->
fieldOfView
()));
animate
Camera
(
aabb
.
center
(),
aabb
.
radius
(
)
/
sin
(
_camera
->
camera
()
->
fieldOfView
()));
}
}
else
else
_editNeuron
=
nullptr
;
_editNeuron
=
nullptr
;
...
@@ -366,7 +366,7 @@ namespace neurotessmesh
...
@@ -366,7 +366,7 @@ namespace neurotessmesh
unsigned
int
Scene
::
numEditMorphologyNeurites
(
void
)
const
unsigned
int
Scene
::
numEditMorphologyNeurites
(
void
)
const
{
{
if
(
_editNeuron
)
if
(
_editNeuron
)
return
(
unsigned
int
)
_editNeuron
->
morphology
(
)
->
neurites
(
).
size
(
);
return
static_cast
<
unsigned
int
>
(
_editNeuron
->
morphology
(
)
->
neurites
(
).
size
(
)
);
return
0
;
return
0
;
}
}
...
@@ -445,21 +445,15 @@ namespace neurotessmesh
...
@@ -445,21 +445,15 @@ namespace neurotessmesh
if
(
indices_
.
size
(
)
>
0
)
if
(
indices_
.
size
(
)
>
0
)
{
{
auto
aabb
=
computeBoundingBox
(
indices_
);
auto
aabb
=
computeBoundingBox
(
indices_
);
animate
(
aabb
.
center
(
),
aabb
.
radius
(
)
/
sin
(
_camera
->
camera
()
->
fieldOfView
()));
animate
Camera
(
aabb
.
center
(
),
aabb
.
radius
(
)
/
sin
(
_camera
->
camera
()
->
fieldOfView
()));
}
}
else
else
{
{
animate
(
_boundingBox
.
center
(
),
_boundingBox
.
radius
(
)
/
sin
(
_camera
->
camera
()
->
fieldOfView
()));
animate
Camera
(
_boundingBox
.
center
(
),
_boundingBox
.
radius
(
)
/
sin
(
_camera
->
camera
()
->
fieldOfView
()));
}
}
}
}
void
Scene
::
animate
(
const
Eigen
::
Vector3f
&
position
,
const
float
radius
)
void
Scene
::
animateCamera
(
const
Eigen
::
Vector3f
&
position
,
const
float
radius
,
const
Eigen
::
Matrix3f
&
rotation
,
{
const
auto
rotation
=
Eigen
::
Matrix3f
::
Zero
();
animatePosition
(
position
,
radius
,
rotation
,
false
);
}
void
Scene
::
animatePosition
(
const
Eigen
::
Vector3f
&
position
,
const
float
radius
,
const
Eigen
::
Matrix3f
&
rotation
,
bool
rotAnimation
)
bool
rotAnimation
)
{
{
if
(
_camera
->
isAniming
())
if
(
_camera
->
isAniming
())
...
@@ -469,8 +463,7 @@ namespace neurotessmesh
...
@@ -469,8 +463,7 @@ namespace neurotessmesh
}
}
constexpr
float
CAMERA_ANIMATION_DURATION
=
2.
f
;
constexpr
float
CAMERA_ANIMATION_DURATION
=
2.
f
;
const
auto
rotInterpolation
=
rotAnimation
?
reto
::
CameraAnimation
::
LINEAR
:
reto
::
CameraAnimation
::
NONE
;
auto
rotInterpolation
=
rotAnimation
?
reto
::
CameraAnimation
::
LINEAR
:
reto
::
CameraAnimation
::
NONE
;
_animation
=
new
reto
::
CameraAnimation
(
reto
::
CameraAnimation
::
LINEAR
,
_animation
=
new
reto
::
CameraAnimation
(
reto
::
CameraAnimation
::
LINEAR
,
rotInterpolation
,
rotInterpolation
,
...
@@ -487,5 +480,4 @@ namespace neurotessmesh
...
@@ -487,5 +480,4 @@ namespace neurotessmesh
_camera
->
startAnim
(
_animation
);
_camera
->
startAnim
(
_animation
);
}
}
}
}
This diff is collapsed.
Click to expand it.
neurotessmesh/Scene.h
+
6
−
8
View file @
cdcc0cb2
...
@@ -215,19 +215,17 @@ namespace neurotessmesh
...
@@ -215,19 +215,17 @@ namespace neurotessmesh
NEUROTESSMESH_API
NEUROTESSMESH_API
void
focusOnIndices
(
const
std
::
vector
<
unsigned
int
>&
indices_
);
void
focusOnIndices
(
const
std
::
vector
<
unsigned
int
>&
indices_
);
protected
:
protected
:
/** \brief Animates the camera to the given position and radius.
* \param[in] position Focus position.
* \param[in] radius Aperture radius.
*
*/
void
animate
(
const
Eigen
::
Vector3f
&
position
,
const
float
radius
);
/** \brief Animates the camera to the given position, radius and rotation.
/** \brief Animates the camera to the given position, radius and rotation.
* \param[in] position Focus position.
* \param[in] position Focus position.
* \param[in] radius Aperture radius.
* \param[in] radius Aperture radius.
* \param[in] rotation Camera rotation matrix.
* \param[in] rotation Camera rotation matrix.
* \param[in] rotAnimation true to animate rotation and false otherwise.
*
*/
*/
void
animatePosition
(
const
Eigen
::
Vector3f
&
position
,
const
float
radius
,
const
Eigen
::
Matrix3f
&
rotation
,
bool
rotAnimation
);
void
animateCamera
(
const
Eigen
::
Vector3f
&
position
,
const
float
radius
,
const
Eigen
::
Matrix3f
&
rotation
=
Eigen
::
Matrix3f
::
Zero
(),
bool
rotAnimation
=
false
);
//! Scene mode
//! Scene mode
TSceneMode
_mode
;
TSceneMode
_mode
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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