From c5a93b4c86b5cae25ace670412ebe3035f5913e1 Mon Sep 17 00:00:00 2001 From: frozar Date: Wed, 31 Jan 2018 17:50:13 +0100 Subject: [PATCH] [3D CAMERA] BUGFIX: take into account the camera distance in get_view_transformation_matrix(). --- topics/three_dimensions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/topics/three_dimensions.py b/topics/three_dimensions.py index 022a213b..b0c18645 100644 --- a/topics/three_dimensions.py +++ b/topics/three_dimensions.py @@ -28,7 +28,8 @@ class ThreeDCamera(CameraWithPerspective): CONFIG = { "sun_vect" : 5*UP+LEFT, "shading_factor" : 0.2, - "distance" : 5, + "distance" : 5., + "default_distance" : 5., "phi" : 0, #Angle off z axis "theta" : -TAU/4, #Rotation about z axis } @@ -131,7 +132,7 @@ class ThreeDCamera(CameraWithPerspective): self.phi, self.theta, self.distance = point def get_view_transformation_matrix(self): - return np.dot( + return (self.default_distance / self.get_distance()) * np.dot( rotation_matrix(self.get_phi(), LEFT), rotation_about_z(-self.get_theta() - np.pi/2), )