Set camera inside box

Hi,
I have an issue that I have been trying to get to work without success.
I want to put a camera inside a box so I can see the inside of it, let's say the box is 1000x1000x1000 and I want to place the camera at 500x500x500, how can I do that?
I use the class Graphic3d_Camera:

from OCC.Display.SimpleGui import init_display

display, start_display, add_menu, add_function_to_menu = init_display()

camera=display.View.Camera().GetObject()

camera.setEye(gp_Pnt(500,500,500))

 

(as well as testing with setCetner, setDistance etc...).

I can change the camera position but it does not behave the way I want to.

Any help is greatly appreciated.

Regards

Staffan

Kirill Gavrilov's picture

I can change the camera position but it does not behave the way I want to.

And how observed behavior differs from expected?

camera.setEye(gp_Pnt(500,500,500))

Graphic3d_Camera::SetEye() sets new Eye position and keeps Graphic3d_Camera::Center() position as is (meaning that Graphic3d_Camera::Direction() is changed).
There is Graphic3d_Camera::MoveEyeTo() method in case If you need moving Eye and preserve camera Direction.

Normally, you would need also switching camera from orthographic to perspective projection.

Haglund.staffan_161026's picture

Hi, thank you, I was missing the perspective projection.
Regards Staffan