I can't randomly distribute the dots

1 回表示 (過去 30 日間)
Ahmet Selim Arslan
Ahmet Selim Arslan 2021 年 1 月 13 日
回答済み: Adam Danz 2021 年 1 月 13 日
Hi everyone, I need to randomly distribute z points on a project I'm working on, but when I multiply 'rand' and 'height points', 'rand' is just one number and it's just multiplying the elevation points by that number. The resulting image is like this
%% Dosyaları oku (*.las)
clc;clear
[FileName, PathName]=uigetfile('*.*','select point file');
lasReader = lasFileReader(FileName);
ptCloud = readPointCloud(lasReader);
figure;
pcshow(ptCloud.Location);
%% Z ekseni noktalarını seç % Select z-axis points
Elevation=double(ptCloud.Location(:,3));
Yikikz=rand.*Elevation;
yikilan=[ptCloud.Location(:,1),ptCloud.Location(:,2),Yikikz];
figure;
pcshow(yikilan);
  1 件のコメント
Adam Danz
Adam Danz 2021 年 1 月 13 日
Yikikz=rand.*Elevation;
This is not randomly distributing the z-coordinates. This is adding noise to the coordinates.
My answer to your other question shows exactly how to randomly distribute, or permute, the z-coordinates.

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

回答 (2 件)

Alan Stevens
Alan Stevens 2021 年 1 月 13 日
Try using
Yikikz=rand(size(Elevation)).*Elevation;
  2 件のコメント
Ahmet Selim Arslan
Ahmet Selim Arslan 2021 年 1 月 13 日
This is how it happened this time, I want you to be like the image of a building collapsed in an earthquake. Height points scatter all over the x and y axes
%% Z ekseni noktalarını seç % Select z-axis points
Elevation=double(ptCloud.Location(:,3));
Yikikz=rand(size(Elevation)).*Elevation;
yikilan=[ptCloud.Location(:,1),ptCloud.Location(:,2),Yikikz];
figure;
pcshow(yikilan);
Alan Stevens
Alan Stevens 2021 年 1 月 13 日
編集済み: Alan Stevens 2021 年 1 月 13 日
Try adding
view(2)
after
pcshow(yikilan);
if what you're after is to see the distribution from above.

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


Adam Danz
Adam Danz 2021 年 1 月 13 日
> I want you to be like the image of a building collapsed in an earthquake. Height points scatter all over the x and y axes
What you're describing is a 2D plot, collapsing along the z-axis.
Set all z-values to 0 and add noise to the X and Y points.
I suggest using normallly distributed noise (randn) if you expect the particles to fall directly downward plus some variation.

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by