Removing Points Along a Diagonal Line

5 Ansichten (letzte 30 Tage)
racqs
racqs am 30 Jul. 2019
Kommentiert: darova am 31 Jul. 2019
I have a slope that i have discretized into points. However along the diagonal line I would like to remove all the points to the right of this line. Is this possible? All I have been able to do is remove the points as shown in the second figure but my slope actually looks like the first figure. The points to be reomved are all those lying within the shaded region. Is this possible?

Antworten (1)

infinity
infinity am 30 Jul. 2019
Hello,
I would suggest you a solution,
Since you have known two points of slope, which are (40,35) and (74.4, 15), you can easily get a segment passing to these points. Let say, y = ax + b.
Then, you can define a function, for example phi(x,y) = ax + b - y. As it can seen that phi(x,y) > 0 if (x,y) is in the left of the slope and phi(x,y) < 0 if (x,y) is in the right of the slope and phi(x,y) = 0 if (x,y) is in the slope. This technique is called "levelset method".
Now, what you can do is to use the phi funtion to check a point is in the left or the right of the slope. If it is in the right, you just eleminate it.
  5 Kommentare
infinity
infinity am 31 Jul. 2019
Bearbeitet: infinity am 31 Jul. 2019
Hello,
So, you could use for loop (or even don't need for loop) to check wheather a nodes in A is in B or not. If it is not, you store it into a new variable. For example,
clear
A = [1 2; 3 4; 5 6];
B = [3 4; 5 6];
C = [];
for i = 1:size(A,1)
if ~ismember(A(i,1),B(:,1)) || ~ismember(A(i,2),B(:,2))
C = [C; A(i,:)];
end
end
darova
darova am 31 Jul. 2019
Read about inpolygon() also

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by