Fit collision capsule around collision geometry
Fit Collision Capsule Around Collision Box
Create a box with a length, width, and height of
1 meter and fit a collision capsule on it.
box = collisionBox(1,1,1); show(box); hold on [collcaps,fitinfo]= fitCollisionCapsule(box);
Visualize the new collision capsule on top of the box and set the alphas of the capsule to a low value so that the box is visible.
[~,capvis] = show(collcaps); capvis.FaceAlpha=0.4; xlim auto ylim auto zlim auto
collCapsule — Collision capsule of the collision geometry
Collision capsule of the collision geometry, returned as a
fitInfo — Fit information of collision capsule
Fit information of the collision capsule, returned as a structure. The structure
Residual field, returned as an
N-element vector, where N is the total number of
points of the collision geometry. Each element of the vector specifies the residual of a
point of the collision geometry as:
ocg is the origin of the fitted collision object.
lcc is the closest point of the central line of the collision capsule to ocg.
rcc is the radius of the collision capsule.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2022b