Point cloud with Matlab

How to divide a point cloud in four quadrants? Please help me with the code in matlab.

1 件のコメント

Walter Roberson
Walter Roberson 2025 年 3 月 28 日
Use pca() to find the orientation of the planes, and use the centroid of the point cloud as the center of the planes

サインインしてコメントする。

回答 (1 件)

Dev
Dev 2025 年 3 月 28 日

0 投票

Hi @QS,
To divide a point cloud into four quadrants, we can loop through each point using a ‘for’ loop and assign it to a quadrant. I have added a reference code snippet below which can be used inside this loop to help us achieve the same-
% Assign each point to the respective quadrant
if x >= origin(1) && y >= origin(2)
quadrant1 = [quadrant1; x, y]; % Quadrant I
elseif x < origin(1) && y >= origin(2)
quadrant2 = [quadrant2; x, y]; % Quadrant II
elseif x < origin(1) && y < origin(2)
quadrant3 = [quadrant3; x, y]; % Quadrant III
else
quadrant4 = [quadrant4; x, y]; % Quadrant IV
end
To visualize the point cloud, we can use the ‘scatter’ function in MATLAB. I have attached an example output of a point cloud divided into quadrants below, for your reference.
For more information regarding the usage of the ‘for’ loop and the ‘scatter’ function, please refer to the documentation links below-
Hope this solves the query.

カテゴリ

タグ

質問済み:

QS
2019 年 2 月 20 日

コメント済み:

2025 年 3 月 28 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by