Hello.

I am trying to make a C# component that filters a list of points. The idea is to filter the points so that only points with the z-coordinate of zero gets on the new list. Can somebody help with this? I am very new to C#.

Hello.

I am trying to make a C# component that filters a list of points. The idea is to filter the points so that only points with the z-coordinate of zero gets on the new list. Can somebody help with this? I am very new to C#.

in pseudocode:

for pts.Count

if(pts[i].Z ==0)

zeroList.Add(pt[i]);

you may want also check for tolerance

This can be done easily with standard GH. Why use C#?

Thanks! But how exactly do i implement this in the C# component. It doesnâ€™t seem to work.

It is a part of an assignment at my university.

1 Like

It works perfectly!! Thank you so much!

Should you compare a System.Double like that? (floating point problem)

3 Likes

of course not

but given the assignment I thought the â€śfloating point numbers comparationâ€ť chapter will be only next week let him get there first

1 Like

It depends, I work on an interface which only deals with doubles for any type of numbers for simplicity. As long as you are not applying any computation on the double, its perfectly fine to compare it like this. This can be true if the double represents an integer/enum state or an user applied number like an coordinate. If you can ensure that the number is not created through a computation, then its ok and quicker as applying a tolerance-based comparison. So its not wrong if you know what you are doingâ€¦