Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

get_part_studio_shaded_views rotation, translation, and zoom in #20

Open
BubuPalmer opened this issue Mar 16, 2020 · 2 comments
Open

get_part_studio_shaded_views rotation, translation, and zoom in #20

BubuPalmer opened this issue Mar 16, 2020 · 2 comments

Comments

@BubuPalmer
Copy link

Those are the transformation matrix that I apply for each position:

top
[[1. 0. 0.]
[0. 1. 0.]
[0. 0. 1.]]
bottom
[[ 1.0000000e+00 0.0000000e+00 0.0000000e+00]
[ 0.0000000e+00 -1.0000000e+00 -1.2246468e-16]
[ 0.0000000e+00 1.2246468e-16 -1.0000000e+00]]
front
[[ 1.000000e+00 0.000000e+00 0.000000e+00]
[ 0.000000e+00 6.123234e-17 1.000000e+00]
[ 0.000000e+00 -1.000000e+00 6.123234e-17]]
back
[[ 1.000000e+00 0.000000e+00 0.000000e+00]
[ 0.000000e+00 6.123234e-17 -1.000000e+00]
[ 0.000000e+00 1.000000e+00 6.123234e-17]]
left
[[ 6.123234e-17 0.000000e+00 1.000000e+00]
[ 0.000000e+00 1.000000e+00 0.000000e+00]
[-1.000000e+00 0.000000e+00 6.123234e-17]]
right
[[ 6.123234e-17 0.000000e+00 -1.000000e+00]
[ 0.000000e+00 1.000000e+00 0.000000e+00]
[ 1.000000e+00 0.000000e+00 6.123234e-17]]
iso
[[ 0.5 -0.5 0.70710678]
[ 0.85355339 0.14644661 -0.5 ]
[ 0.14644661 0.85355339 0.5 ]]

So, if I want to apply a translation, what I do first is to multiply also the translation matrix for the matrix of the bounding box in the form:
high_x low_x
high_y low_y
high_z low_z

Then I substrate high minus low of echa point, and I divide also each point by -2 to get the translation of x, y, and z. and aI add this column to the view matrix.

This works for almost all cases, but there are cases when this doesn't work and the image that i get is too small for one or all perspectives.

What I've seen is that for a large image with the top of the bounding box in the center of the coordinate axe I take very small pictures in all positions. And for images with one of the dimensions of the bounding box too much larger than the other two, I also get the image very small for two of the perspectives...

My question is fi you know any function to apply to the column of translation of the transformation matrix to emulate the zoom in of the camera in those cases keeping the image framed

@eak24
Copy link
Contributor

eak24 commented Apr 14, 2020

Sounds like you need a function to go from bounding box -> camera transformation matrix. I can ask someone on our graphics team.

@eak24
Copy link
Contributor

eak24 commented Apr 15, 2020

The basic idea would be to take axes of the view matrix and use those to define the translational component of the view matrix, based on the bounding box center.
So something like: viewMatrixTranslation = -viewMatrixRightDirection * boundsCenter - viewMatrixUpDirection * boundsCenter - viewMatrixForwardDirect * boundsCenter
It looks like zoom would be configured by the pixelSize parameter. So that would need to be computed based on the image dimensions and bound diameter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants