Main Content

cylinderModel

Parametric cylinder model

Description

The cylinderModel object stores a parametric cylinder model.

Creation

Description

model = cylinderModel(parameters) constructs a parametric cylinder model from the specified parameters. The parameters argument is a 1-by-7 numeric vector that determines the value of the Parameters property.

example

Input Arguments

expand all

Cylinder parameters, specified as a 1-by-7 numeric vector. This input specifies the Parameters property. The vector is of the form [x1 y1 z1 x2 y2 z2 r].

  • [x1 y1 z1] and [x2 y2 z2] are the 3-D centers of each end-cap surface of the cylinder.

  • r is the radius of the cylinder.

Properties

expand all

This property is read-only.

Cylinder model parameters, stored as a 1-by-7 numeric vector. The vector is of the form [x1 y1 z1 x2 y2 z2 r].

  • [x1 y1 z1] and [x2 y2 z2] are the 3-D centers of each end-cap surface of the cylinder.

  • r is the radius of the cylinder.

This property is read-only.

Center of the cylinder, stored as a 1-by-3 numeric vector representing the x-, y-, and z-coordinates.

This property is read-only.

Height of the cylinder, stored as a scalar.

This property is read-only.

Radius of the cylinder, stored as a scalar.

This property is read-only.

Orientation of the cylinder, stored as a 1-by-3 vector. The orientation vector points from one center [x1,y1,z1] of the cylinder end-cap to the center [x2,y2,z2] of the other end-cap.

Object Functions

plotPlot parametric model
findPointsInModelFind points in or on surface of geometric model

Examples

collapse all

Load a MAT file containing a point cloud into the workspace.

load("object3d.mat");

Display the point cloud.

figure
pcshow(ptCloud)
title("Detect a Cylinder in a Point Cloud")

Set the maximum point-to-cylinder distance for cylinder fitting to 5mm.

maxDistance = 0.005;

Specify a region of interest (ROI) to constrain the fitting function.

roi = [0.4 0.6; -inf 0.2; 0.1 inf];
sampleIndices = findPointsInROI(ptCloud,roi);

Set the orientation constraint for the fitting function

referenceVector = [0 0 1];

Detect the cylinder in the specified ROI of the point cloud and extract it.

model = pcfitcylinder(ptCloud,maxDistance,referenceVector, ...
        SampleIndices=sampleIndices);

Plot the model of the detected cylinder.

hold on
plot(model)

Figure contains an axes object. The axes object with title Detect a Cylinder in a Point Cloud contains 2 objects of type scatter, surface.

Version History

Introduced in R2015b