Main Content

collisionCylinder

Create collision cylinder geometry

Description

Use collisionCylinder to create a cylinder collision geometry centered at the origin.

Creation

Description

example

CYL = collisionCylinder(Radius,Length) creates a cylinder collision geometry with a specified Radius and Length. The cylinder is axis-aligned with its own body-fixed frame. The side of the cylinder lies along the z-axis. The origin of the body-fixed frame is at the center of the cylinder.

Properties

expand all

Radius of cylinder, specified as a positive scalar. Units are in meters.

Data Types: double

Length of cylinder, specified as a positive scalar. Units are in meters.

Data Types: double

Pose of the collision geometry relative to the world frame, specified as a 4-by-4 homogeneous matrix. You can change the pose after you create the collision geometry.

Data Types: double

Object Functions

showShow collision geometry

Examples

collapse all

Create a cylinder collision geometry centered at the origin. The cylinder is 4 meters long with a radius of 1 meter.

rad = 1;
len = 4;
cyl = collisionCylinder(rad,len)
cyl = 
  collisionCylinder with properties:

    Radius: 1
    Length: 4
      Pose: [4x4 double]

Visualize the cylinder.

show(cyl)
title('Cylinder')

Figure contains an axes object. The axes object with title Cylinder contains an object of type patch.

Create a homogeneous transformation that corresponds to a clockwise rotation of π/4 radians about the y-axis. Set the cylinder pose to the new matrix. Show the cylinder.

ang = pi/4;
mat = axang2tform([0 1 0 ang]);
cyl.Pose = mat;
show(cyl)

Figure contains an axes object. The axes object contains an object of type patch.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2019b