Skip to content

Commit d1c5def

Browse files
committed
optimization for ellipse display
1 parent 0e2ee22 commit d1c5def

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

roboticstoolbox/backends/PyPlot/EllipsePlot.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -186,29 +186,18 @@ def make_ellipsoid2(self):
186186
"Can not do rotational ellipse for a 2d robot plot. Set opt='trans'"
187187
)
188188

189-
# if not self.vell:
190-
# # Do the extra step for the force ellipse
191-
# try:
192-
# A = np.linalg.inv(A)
193-
# except:
194-
# A = np.zeros((2,2))
195-
if self.vell:
196-
# Do the extra step for the velocity ellipse
197-
A = np.linalg.inv(A)
189+
# velocity ellipsoid is E = A^-1
190+
# force ellipsoid is E = A
191+
#
192+
# rather than compute the inverse we can have base.ellipse() do it for us
193+
# using the inverted argument. For the velocity ellipse we already have the
194+
# inverse of E, it is A, so we set inverted=True.
198195

199196
if isinstance(self.centre, str) and self.centre == "ee":
200197
centre = self.robot.fkine(self.q).A[:3, -1]
201198
else:
202199
centre = self.centre
203200

204-
# points on unit circle
205-
# theta = np.linspace(0.0, 2.0 * np.pi, 50)
206-
# y = np.array([np.cos(theta), np.sin(theta)])
207-
# RVC2 p 602
208-
# x = sp.linalg.sqrtm(A) @ y
209-
210-
x, y = base.ellipse(A, inverted=False, centre=centre[:2], scale=self.scale)
201+
x, y = base.ellipse(A, inverted=self.vell, centre=centre[:2], scale=self.scale)
211202
self.x = x
212203
self.y = y
213-
# = x[0,:] * self.scale + centre[0]
214-
# self.y = x[1,:] * self.scale + centre[1]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy