필터 지우기
필터 지우기

Remove points from a mesh

조회 수: 19 (최근 30일)
ibabinaca
ibabinaca 2019년 2월 4일
댓글: Adam Danz 2019년 2월 4일
I have a mesh of points intersecting a cone, and i want to remove all the points inside the conic surface and near to the limits of it. I can check whether the point is on the inside of the circumference slice of the cone for a given height but, this will take me a lot of time since the mesh has a lot of points. I was wondering if there is a better and faster way to do it.
Thank you.
coonno.PNG

채택된 답변

Adam Danz
Adam Danz 2019년 2월 4일
편집: Adam Danz 2019년 2월 4일
If you know the parameters of the circle that encompasses the area you'd like to remove (ie, the center coordinates and the radius), you could just calculate the distance of all points to the circle's center and then eliminate all dots whose distance is less than the radius. This would work if all of the dots are on the same plane as the circle's center which appears to be the case.
Here's an example where x and y are the coordinates of your dots. c is the (x,y) center of your circle and r is the radius.
% create data
x = rand(1000,1);
y = rand(1000,1);
c = [.5, .5]; %[x,y] center of circle
r = 0.2; %radius
% Calculate distance to circle center
d = sqrt((x - c(1)).^2 + (y - c(2)).^2);
% find dots on/in circle
inCircleIdx = d <= r;
% remove dots on/in circle
x(inCircleIdx) = [];
y(inCircleIdx) = [];
  댓글 수: 3
Adam Danz
Adam Danz 2019년 2월 4일
For a 3D mesh, what are you aiming to remove? Everything to the left of the blue manifold?
Adam Danz
Adam Danz 2019년 2월 4일
There are several ways to determine if a point in 3D space is within a convex 3D object.
This file exchange submition inhull() combines matlab's delaunayn() with tsearchn() into one function. I haven't used the FEX but here's an example using the function separately.
% xyz are the coordinates of your cone manifold
T = delaunayn(xyz);
% xyzTestPoints are the coordinates you're testing
isIn = ~isnan(tsearchn(xyz,T,xyzTestPoints));
% isIn is a logical vector of points inside the 3D object

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by