Skip to content

Commit e72ec23

Browse files
committed
add aspect ratio getter
1 parent 591f8d1 commit e72ec23

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

include/polyscope/view.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ void getCameraFrame(glm::vec3& lookDir, glm::vec3& upDir, glm::vec3& rightDir);
9191
glm::vec3 getUpVec();
9292
glm::vec3 getFrontVec();
9393
float getVerticalFieldOfViewDegrees();
94+
float getAspectRatioWidthOverHeight();
9495

9596
// Set the camera extrinsics to look at a particular location
9697
void setViewToCamera(const CameraParameters& p);

src/view.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ void setVerticalFieldOfViewDegrees(float newVal) {
633633

634634
float getVerticalFieldOfViewDegrees() { return view::fov; }
635635

636+
float getAspectRatioWidthOverHeight() { return (float)bufferWidth / bufferHeight; }
637+
636638
glm::mat4 getCameraPerspectiveMatrix() {
637639
double farClip = farClipRatio * state::lengthScale;
638640
double nearClip = nearClipRatio * state::lengthScale;

0 commit comments

Comments
 (0)