From c6f7fa8fb767015542724a7fd719ab7eca160d8b Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Tue, 18 Sep 2012 17:48:20 +0000 Subject: [PATCH] Check that P is non-empty before drawing covariance ellipses --- matlab/+gtsam/plotPoint2.m | 2 +- matlab/+gtsam/plotPose2.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/+gtsam/plotPoint2.m b/matlab/+gtsam/plotPoint2.m index 55e476118..cd066951d 100644 --- a/matlab/+gtsam/plotPoint2.m +++ b/matlab/+gtsam/plotPoint2.m @@ -5,6 +5,6 @@ if size(color,2)==1 else plot(p.x,p.y,color); end -if exist('P', 'var') +if exist('P', 'var') && (~isempty(P)) gtsam.covarianceEllipse([p.x;p.y],P,color(1)); end \ No newline at end of file diff --git a/matlab/+gtsam/plotPose2.m b/matlab/+gtsam/plotPose2.m index 799bad48e..7156f9b60 100644 --- a/matlab/+gtsam/plotPose2.m +++ b/matlab/+gtsam/plotPose2.m @@ -6,7 +6,7 @@ plot(pose.x,pose.y,[color '*']); c = cos(pose.theta); s = sin(pose.theta); quiver(pose.x,pose.y,c,s,axisLength,color); -if nargin>2 +if nargin>2 && (~isempty(P)) pPp = P(1:2,1:2); % covariance matrix in pose coordinate frame gRp = [c -s;s c]; % rotation from pose to global gtsam.covarianceEllipse([pose.x;pose.y],gRp*pPp*gRp',color);