As I understand it points should be selected based on inclusion in one (1) curve, and as soon as one point is part of (or inside) one curve, or area, it no longer has to be tested for in other curves(areas)? Is that correct?
Anyway, I tested my idea in code, but the CurveCurve intersection method doesn’t return an array of intersecting points like some of the other methods do, so my strategy doesn’t work with this intersection method in code (see code far below, but the “res” will only contain maximum two points if an intersection occurs).
But with the GrassHopper component “Curve |Line (CLX)” the intersections seems all have been picked up, but I have not enough experience of DataTree’s to traverse the tree to get the points (which should be handled in the order I handle them in the code snippet below, if you just get the individual result-arrays per intersection out of the tree):
Fig 1. Some weird forms based on Curves -> Surfaces -> Boolean -> Surface Border Curve, which then was tested for intersection for each point in the picture. Count the number of “hits” from the center along the lines, and check distances or index = modulo 2 reminder and keep all points which have shorter distance than this curve intersection point index (phew).
PointInCurve.gh (14.2 KB)
Unfortunately I couldn’t prove my claim in the code below, but someone who masters examining the unbalanced data tree can fix such inclusion tests using the CLX component. When I tried this form didn’t know the forms you used, but my form isn’t any simpler it seems…
private void RunScript(Point3d CP, Curve Crv, List<Point3d> P, ref object F)
{
var boolfilter = new bool[P.Count];
var line = new Line();
line.From = CP;
for (var i = 0;i < P.Count;i++)
{
var pt = P[i];
line.To = pt;
var crv = line.ToNurbsCurve();
// This "res" should have been an array of hit points,
// but now it isn't, so my strategy failed. Otherwise
// this would have returned all points inside the shape's
// border curve.
var res = Rhino.Geometry.Intersect.Intersection.CurveCurve(Crv, crv, 0.001, 0.001);
for (var j = 0; j < res.Count;j++)
{
if (j % 2 == 0.0)
{
var hit_pt = Point3d.Unset; // should have been = res[j];
var dist_ct2pt = CP.DistanceTo(pt);
var dist_crvpt = CP.DistanceTo(hit_pt);
if (dist_ct2pt <= dist_crvpt)
{
boolfilter[i] = true;
}
}
}
}
F = boolfilter;
}
// Rolf