-
Notifications
You must be signed in to change notification settings - Fork 15
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
Create Viewport camera using Python Plugin #81
Comments
setting the name is as easy as |
Thanks,
But the angle X1 Y2 Z3 ?
Il sab 18 nov 2023, 13:19 tmontaigu ***@***.***> ha scritto:
… setting the name is as easy as new_viewport_object.setName("my name")
—
Reply to this email directly, view it on GitHub
<#81 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQRUVSBLAFRCNWFKFNLE4Q3YFCRVNAVCNFSM6AAAAAA7P224C2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGQ4TGOBTGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
What are these angles ? |
To define a camera you need an origin point, a second point indicating the
direction of view of the camera and a third point indicating which is the
up direction of the camera last you need the focal length of the camera. In
a simpler way you need a point of origin a direction vector and a vector to
indicate which is the up direction and as before the focal length. A last
way is a point of origin, the focal length and the three Euler angles. The
simplest system is the point of origin, the two vectors and the focal
length.
Translated with www.DeepL.com/Translator (free version)
Il dom 19 nov 2023, 13:56 tmontaigu ***@***.***> ha scritto:
… What are these angles ?
—
Reply to this email directly, view it on GitHub
<#81 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQRUVSAQEGCXFLV2C3PSUTLYFH6XVAVCNFSM6AAAAAA7P224C2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXHA2DONBQHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
In that case I think the view_mat = pycc.ccGLMatrixd()
view_mat.initFromParameters(
phi_rad=0.1,
theta_rad=0.2,
psi_rad=0.3,
t3D=CCVector3d(0,0,0)
)
new_viewport_parameters.viewMat = view_mat; |
testing this code:
all paramter of the viewport are all zero ....... |
What do you mean they are zero ? import pycc
from cccorelib import CCVector3d
new_viewport_object = pycc.cc2DViewportObject()
new_viewport_object.setName('my name')
new_viewport_parameters = new_viewport_object.getParameters()
new_camera_center = CCVector3d(2023, 301, 610)
auto_update_focal = False
new_focal_distance = 600.5
new_pivot_point = CCVector3d(2028, 305, 485)
view_mat = pycc.ccGLMatrixd()
view_mat.initFromParameters(
phi_rad=0.1,
theta_rad=0.2,
psi_rad=0.3,
t3D=CCVector3d(0,0,0)
)
new_viewport_parameters.setCameraCenter(new_camera_center, auto_update_focal)
new_viewport_parameters.setPivotPoint(new_pivot_point, auto_update_focal)
new_viewport_parameters.computeDistanceToHalfWidthRation()
new_viewport_parameters.computeDistanceToWidthRatio()
new_viewport_parameters.computeViewMatrix()
new_viewport_parameters.computeWidthAtFocalDist()
new_viewport_parameters.viewMat = view_mat;
new_viewport_parameters.setFocalDistance(new_focal_distance)
new_viewport_object.setParameters(new_viewport_parameters)
pycc.GetInstance().addToDB(new_viewport_object)
new_viewport_parameters = new_viewport_object.getParameters()
print("Camera Center:", new_viewport_parameters.getCameraCenter())
print("Focal Distance:", new_viewport_parameters.getFocalDistance())
print("Pivot Point:", new_viewport_parameters.getPivotPoint())
print("Distance To Half Width Ratio:", new_viewport_parameters.computeDistanceToHalfWidthRation())
print("Distance To Width Ratio:", new_viewport_parameters.computeDistanceToWidthRatio())
print("View Matrix:", new_viewport_parameters.computeViewMatrix())
print("Width At Focal Dist:", new_viewport_parameters.computeWidthAtFocalDist())
print("View Mat", view_mat.asArray()) I don't see any zero |
Now it seems to be working !!! |
using angles is quite complicated, I am trying to use FromViewDirAndUpDir however I have an unexpected error ?
|
Indeed there is a problem with this function, I will push a fix for that |
Fixed with #82 |
I am a beginner in Python programming, I am trying to create a new "camera viewport" with the following code, however I am having difficulty finding a way to assign the created viewport name, however I can't enter the X1, Y2, Z3 angles.
If anyone can help me I thank you very much.
is it possible to have more examples than those plublished at this address ?
https://tmontaigu.github.io/CloudCompare-PythonPlugin/examples.html
CC & Python together are amazing !!! Congratulations !!!
The text was updated successfully, but these errors were encountered: