First prependicular point along spiral curve

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)


P.S: replaced with proper gh ,image , title

image

To have more chance on someone help you, I’d internalise the curves that come out of Nautilus for the one that don’t have the plugin.

2 Likes

missing

sorry for that
prependicular_002.gh (26.8 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.


prependicular_2023JuL17a.gh (34.3 KB)

1 Like

let me describe the problem by this image:
i need the green point in the below image for each point.


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)

prependicular_002 Edited V0 Lunchbox RTree.gh (34.8 KB)

It only works if the curve has a constant gap.

3 Likes

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


prependicular_003_Re.gh (40.1 KB)

2 Likes

Here’s is another try to avoid the curve|plane overcalculation by performing plenty of [in the end] useless calculations.

In short:

  • 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 :slight_smile:

prependicular_003.gh (39.6 KB)

1 Like

Curve | Curve for me…

prependicular_004.gh (54.2 KB)

4 Likes

prependicular_002 Edited V0 Lunchbox RTree V1.gh (35.1 KB)
That will make things much simpler because there is a plugin that just does that.

2 Likes

@Joseph_Oster @Quan_Li @magicteddy @inno @antoinemaes
thanks for helping me.
i am going to try/compare entries and will post the result.
meanwhile the post is open for other ppl solution.

used a c# script for the main logic.

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.

firstPerpendicular_00_tp.gh (48.6 KB)

3 Likes

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

1 Like

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 :sweat_smile:)if the software was able to handle multi threading then there was not such dealing with other thing at all.

dividing the initial curve to get 27000 points (arround 25 seconds)

using those points with the initial script posted above 897ms (top component)
after some optimisation 103ms (middle component in screenshot)

1 Like

mind blowing !

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?