Author Topic: How to remove a certain Points form a List<Point3d>?  (Read 3542 times)

0 Members and 1 Guest are viewing this topic.

waterharbin

  • Guest
How to remove a certain Points form a List<Point3d>?
« on: December 06, 2011, 06:52:15 AM »
Hello,everyone. I have a Point and a List<Point3d>. If there is another point in the List which is the same with my Point, I want to remobe the point form my List. Here is my way.
Code: [Select]
Point3d myPt = new Point3d(X,Y,Z);
//to determine whether a same point exsit in th list or not.
bool exsitPt = PointsLst.Exsits(pt =>
{
    if(pt = myPt)
        return true;
    return false;
});
//if do exsit,find the point.
Point3d foundPt = PointsLst.Find(pt =>
{
    if(pt = myPt)
        return true;
    return false;
});
//then remove it
PointsLst.Remove(foundPt);


Is there any better way?

fixo

  • Guest
Re: How to remove a certain Points form a List<Point3d>?
« Reply #1 on: December 06, 2011, 07:24:11 AM »
Just for info
After you've ignored my work:
http://www.theswamp.org/index.php?topic=40246.msg455549#msg455549I
I should not to help you at all in the future
good bye

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: How to remove a certain Points form a List<Point3d>?
« Reply #2 on: December 06, 2011, 12:41:26 PM »
Code: [Select]
PointsLst.Remove(myPt);
Speaking English as a French Frog

waterharbin

  • Guest
Re: How to remove a certain Points form a List<Point3d>?
« Reply #3 on: December 08, 2011, 01:41:52 AM »
Just for info
After you've ignored my work:
I should not to help you at all in the future
good bye
Hello,fixo.I am sorry if I have done something offend to you.  I think we have some misunderstandings between us.I am not a native English speaker.If I failed to thank you for your help, that is because I failed to understand you help.So,I am very sorry.

waterharbin

  • Guest
Re: How to remove a certain Points form a List<Point3d>?
« Reply #4 on: December 08, 2011, 02:03:13 AM »
Hello,gile.Thank you for your post. Because I am not good at English, I didn't express my meanings clearly here.What I really want to do it to remove the points or lines according to some criterion. For example,remove all the points near my point.I will show it in my image. So,my code should be something like this:
Code: [Select]
Point3d myPt = new Point3d(X,Y,Z);
//to determine whether a same point exsit in th list or not.
bool exsitPt = PointsLst.Exsits(pt =>
{
    if(|pt - myPt| <= range)
        return true;
    return false;
});
//if do exsit,find the point.
Point3d foundPt = PointsLst.Find(pt =>
{
    if(|pt - myPt| <= range)
        return true;
    return false;
});
//then remove it
PointsLst.Remove(foundPt);
In this case. myPoint is not contained by my list. I have try this:
Code: [Select]
PointsLst.Remove(pt =>
{
    if(|pt - myPt| <= range)
        return true;
    return false;
});
But it is wrong.I am not good at delegation or lambda.