help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: point projection on polyline


From: Juan Pablo Carbajal
Subject: Re: point projection on polyline
Date: Fri, 20 Nov 2015 19:04:48 +0100

On Fri, Nov 20, 2015 at 11:02 AM, rcharan51 <address@hidden> wrote:
> and sorry(I almost forgot) here's the code on bpaste
>
> https://bpaste.net/show/dc93ef0c7e20
>
> Best Regards,
>
> Raghu Charan A,
>
> B. Tech (Hons) Civil Engineering (class of 2015),
>
> School of Infrastructure,IIT Bhubaneswar, India.
>
> Email: address@hidden, address@hidden
> Mobile No: +91 8860567691, +91 7205733924
>
>
> On Fri, Nov 20, 2015 at 11:35 AM, Raghu Charan A <address@hidden> wrote:
>
>> No need to thank it's mutual. Congratulations !!
>> BTW whom do you support in the clasico?
>> On Nov 17, 2015 17:40, "Juan Pablo Carbajal-2 [via Octave]" <
>> address@hidden> wrote:
>>
>>> On Tue, Nov 17, 2015 at 6:44 AM, rcharan51 <[hidden email]
>>> <http:///user/SendEmail.jtp?type=node&node=4673532&i=0>> wrote:
>>>
>>> > Is there any alternative without calling distancePointEdge inside
>>> > projectPointOnPolyline, which I beleive is the main reason for slow
>>> running
>>> > of the function. I could not understand the algorithm but I found a
>>> similar
>>> > function in Scilab. here's the source code for it
>>> > https://searchcode.com/codesearch/view/25401835/
>>> >
>>> >
>>> >
>>> > --
>>> > View this message in context:
>>> http://octave.1599824.n4.nabble.com/point-projection-on-polyline-tp4673298p4673526.html
>>> > Sent from the Octave - General mailing list archive at Nabble.com.
>>> >
>>> > _______________________________________________
>>> > Help-octave mailing list
>>> > [hidden email] <http:///user/SendEmail.jtp?type=node&node=4673532&i=1>
>>> > https://lists.gnu.org/mailman/listinfo/help-octave
>>>
>>> Hi,
>>> Thanks for sending the demos, but I did not get anything. Sometimes
>>> the mailing list filters attachments. Better post the code in Gist[1]
>>> or in bpaste[2].
>>>
>>> My daughter was born 4 days ago, so it might be a while till I am able
>>> to look into the code, but I will do it asap.
>>>
>>>
>>> [1] https://gist.github.com/
>>> [2] https://bpaste.net/
>>>
>>> _______________________________________________
>>> Help-octave mailing list
>>> [hidden email] <http:///user/SendEmail.jtp?type=node&node=4673532&i=2>
>>> https://lists.gnu.org/mailman/listinfo/help-octave
>>>
>>>
>>> ------------------------------
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://octave.1599824.n4.nabble.com/point-projection-on-polyline-tp4673298p4673532.html
>>> To start a new topic under Octave - General, email
>>> address@hidden
>>> To unsubscribe from Octave, click here
>>> <http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1599824&code=c3JhMTBAaWl0YmJzLmFjLmlufDE1OTk4MjR8MTU5MDQyODc2Mw==>
>>> .
>>> NAML
>>> <http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>>
>
> --
>
> ------------------------------
> *Disclaimer: *This email and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify the
> system manager. This message contains confidential information and is
> intended only for the individual named. If you are not the named addressee
> you should not disseminate, distribute or copy this e-mail. Please notify
> the sender immediately by e-mail if you have received this e-mail by
> mistake and delete this e-mail from your system. If you are not the
> intended recipient you are notified that disclosing, copying, distributing
> or taking any action in reliance on the contents of this information is
> strictly prohibited.
>
>
>
>
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/point-projection-on-polyline-tp4673298p4673580.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave

Ok, thakns. I had already added  demot that is quite similar to ours.
Let me know if you think yours adds soemthing special that I did not
noticed.
The algorithm of the two functions is the same. You calculate the
distance between a given point and all the segments of the polyline.
Then you return this distance and the orthogonal projection on that
segment. This is brute force search, and there is little else you can
do unless you want to implement octrees or another data structure that
optimizes the search. The difference between the function you sent and
the one in geometry is that the computation of the distance and
projection on the edge is encapsulated in the function
distancePointEdge. This last function has some optimizations on it
that use broadcast instead of looping, but feel free to profile it and
check if there is anything to improve.

If you port the Scilab function it should perform similarly.

What is your problem exactly? Do you have many points and a single
polyline or your have a massive polyline and a few points (compared
with the number of vertices of the polyline)?

If you have many points and a fixed polyline, look at the demo I added
to the function. It uses arrayfun and calls the function for each
point (this prevents one of the nested loops within the function, and
it cloud be improved to do this by default). If your polyline has many
segments then I can provide a function that uses arrayfun for the
looping of the edges.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]