-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Add getters for camera parameters #1419 #1663
Open
Schwarzemann
wants to merge
9
commits into
f3d-app:master
Choose a base branch
from
Schwarzemann:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9e490af
FIX: Add getters for camera parameters #1419
Schwarzemann d04552e
FIX: Add getters for camera parameters #1419
Schwarzemann bc36eb7
Merge branch 'f3d-app:master' into master
Schwarzemann e8d0274
Merge branch 'f3d-app:master' into master
Schwarzemann 9096141
Merge branch 'f3d-app:master' into master
Schwarzemann 9973927
Feature: Add getters for camera parameters #1419
Schwarzemann 6e20870
Feature: Add getters for camera parameters #1419
Schwarzemann bb85a0d
Feature: Add getters for camera parameters #1419
Schwarzemann 6ce7254
Feature: Add getters for camera parameters #1419
Schwarzemann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"C_Cpp.errorSquiggles": "disabled", | ||
"files.associations": { | ||
"cmath": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,55 @@ | |
return angle; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
angle_deg_t camera_impl::getAzimuth() | ||
{ | ||
vtkCamera* cam = this->GetVTKCamera(); | ||
double pos[3], foc[3]; | ||
cam->GetPosition(pos); | ||
cam->GetFocalPoint(foc); | ||
double viewDir[3]; | ||
vtkMath::Subtract(foc, pos, viewDir); | ||
double viewDirProj[2] = { viewDir[0], viewDir[1] }; | ||
if (vtkMath::Dot2D(viewDirProj, viewDirProj) < VTK_DBL_EPSILON) | ||
{ | ||
return 0.0; | ||
} | ||
return vtkMath::DegreesFromRadians(atan2(viewDirProj[1], viewDirProj[0])); | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
angle_deg_t camera_impl::getYaw() | ||
{ | ||
vtkCamera* cam = this->GetVTKCamera(); | ||
double pos[3], foc[3]; | ||
cam->GetPosition(pos); | ||
cam->GetFocalPoint(foc); | ||
double viewDir[3]; | ||
vtkMath::Subtract(foc, pos, viewDir); | ||
double viewDirProj[2] = { viewDir[0], viewDir[2] }; | ||
if (vtkMath::Dot2D(viewDirProj, viewDirProj) < VTK_DBL_EPSILON) | ||
{ | ||
return 0.0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add a test for this |
||
} | ||
return vtkMath::DegreesFromRadians(atan2(viewDirProj[0], viewDirProj[1])); | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
angle_deg_t camera_impl::getElevation() | ||
{ | ||
vtkCamera* cam = this->GetVTKCamera(); | ||
double pos[3], foc[3]; | ||
cam->GetPosition(pos); | ||
cam->GetFocalPoint(foc); | ||
|
||
double viewDir[3]; | ||
vtkMath::Subtract(foc, pos, viewDir); | ||
vtkMath::Normalize(viewDir); | ||
|
||
return vtkMath::DegreesFromRadians(asin(viewDir[2])); | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
void camera_impl::getViewAngle(angle_deg_t& angle) | ||
{ | ||
|
@@ -215,7 +264,7 @@ | |
} | ||
|
||
//---------------------------------------------------------------------------- | ||
camera& camera_impl::azimuth(angle_deg_t angle) | ||
camera& camera_impl::addAzimuth(angle_deg_t angle) | ||
{ | ||
vtkCamera* cam = this->GetVTKCamera(); | ||
cam->Azimuth(angle); | ||
|
@@ -225,7 +274,7 @@ | |
} | ||
|
||
//---------------------------------------------------------------------------- | ||
camera& camera_impl::yaw(angle_deg_t angle) | ||
camera& camera_impl::addYaw(angle_deg_t angle) | ||
{ | ||
vtkCamera* cam = this->GetVTKCamera(); | ||
cam->Yaw(angle); | ||
|
@@ -235,7 +284,7 @@ | |
} | ||
|
||
//---------------------------------------------------------------------------- | ||
camera& camera_impl::elevation(angle_deg_t angle) | ||
camera& camera_impl::addElevation(angle_deg_t angle) | ||
{ | ||
vtkCamera* cam = this->GetVTKCamera(); | ||
cam->Elevation(angle); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a test for this