I guess that this is a follow up from previous question.
Your code is not complete since we don't know what is
RemainingXPoints
.
I will assume that all points are in
DataList
Here is a piece of code that check if a point is in cone and gives you the list of points not in cone.
Points= 0
For Scan= 1 to DataList.GetUpperBound(0)
Visible= True
For Check= 0 To Points
XTRange = DataList(Check).Range - DataList(Scan).Range
myAngle = If(XTRange < Thresh, NearAngle, FarAngle)
Dim Tj = New Double() {DataList(Scan).Tx, DataList(Scan).Ty, DataList(Scan).Tz}
Dim Bj = New Double() {DataList(Scan).Bx, DataList(Scan).By, DataList(Scan).Bz}
Dim Xk = New Double() {DataList(Check).Tx, DataList(Check).Ty, DataList(Check).Tz}
If isLyingInCone(Xk, Tj, Bj, myAngle) = True Then
Visible= False
Exit for
End If
Next
If Visible Then
Points= Points + 1
DataList(Points) = DataList(Scan)
End If
Next scan
For Scan= 0 to Points
Next Scan
The code is untested