Hi all
there is a spiral consist of way too many points and i need to find the nearest perpendicular intersection points on same spiral after one turn for all point.
using perpendicular plane/frame i will get all the intersection point between the spiral curve which need so heavy calculation and is not optimized and un-usable.
how can i get those point ? prependicular_003.gh (27.9 KB)
I’m not sure what you’re doing so maybe this isn’t worth much. Just a different way of dividing the initial curve into a polyline using Evaluate Length. I left the rest alone.
the spiral consist of points and i want to find first perpendicular point on same spiral for each point
i cleaned the file too : prependicular_003.gh (27.9 KB)
this will select one “control point” and i seek something like “point from perpendicular plane intersection”
there is no guarantee for that green point to be exactly a control point same as the one which i drawn in the image.
this creates an interpolated curve along your points, then retrieves the tangent vector of that new curve on each point to create small rectangular surfaces used to find each intersection on next loop
it’s a bit intense… wondering if there’s a much much easier solution
For each point I create a shorter version of the polyline so that when using closest point, it’s on the next “loop”
Around that closest point, I create a sub curve that will be used for the curve|plane intersection, performing only one intersection per plane (which was the goal of this nonsense script)
It’s kinda bad, has two values that probably need adjustments if even relevant in some edge case, and would need much more testing before trusting it
split the spiral into half-turns.
splitting curves will keep their domain - so the subCurves will have the same domain as the corresponding part of the main spiral.
With this background it is super easy to find the subCurve to search at with closest Point
The script does also handle the rare special case, where the corresponding closest point might become a start / endpoint of the subCurve - it tests the next curve as well, and compares the distances.
i have found each of these scripts work on special case and curve condition but on a spiral curve with 27k point the one by @Tom_P was successful in 455mb ram in 2 min (using one out of 32 core) and other usage start in range 10gb upto 32gb and a few unfinished in calculation or not proper or complete result.
learnt R tree , Curve|Line, segmentation , … and finally Splitting to half-turn was awesome many thanks for all you guys specially @Tom_P
how many turns did the spiral have ?
is the distance of the spiral turns given / known / constant ?
there is a lot of room for performance improvements…
155 turn and distance was given.
seems upcoming change to the exception handling has no such effect on the performance but the closest point make time complexity of algorithm(big O),its native and i hope state-of-art method employed by Dev team therefore better performance could be at another tactic,i think something like Curve|Line used by @magicteddy lead less O, pushing this code need to knowing the O complexity of few component to be used.by the way it is working and i am so grateful (praying currently )if the software was able to handle multi threading then there was not such dealing with other thing at all.
i see your next revision would be in 6ms. so great coding skill bro.
i look at the code, seems you able to remove the loop for checking and handle those rare case with something like distance checking equal to zero?