Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: how to find closest point on a segment/rectangle to a given point

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: how to find closest point on a segment/rectangle to a given point


Chronological Thread 
  • From: updog <>
  • To:
  • Subject: [cgal-discuss] Re: how to find closest point on a segment/rectangle to a given point
  • Date: Thu, 23 Jun 2011 18:56:48 -0700 (PDT)

    Yes, common used functions like this are suitable to be included
in CGAL. Thank you for your replies.

On Thu, Jun 23, 2011 at 4:33 PM, Bernd Gaertner [via cgal-discuss]
<[hidden email]> wrote:

> You can also use the Quadratic programming solver whenever you need to
> compute the minimum squared distance between two objects, each of which
> can be described by linear equations and inequalities (lines, segments,
> boxes, points,...):
>
> http://www.cgal.org/Manual/latest/doc_html/cgal_manual/QP_solver/Chapter_main.html
>
>
> Best,
> Bernd.
>
>
>
> Sebastien Loriot (GeometryFactory) wrote:
>> Take a kernel with exact constructions (like
>> CGAL::Exact_predicates_exact_constructions_kernel).
>>
>> Construct you lines with this kernel.
>> compute the vector orthogonal to those two lines (using cross_product
>> on their director vectors)
>>
>> http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Function_cross_product.html
>>
>>
>> Assume the vector is not 0 and take any a point on Line_1
>>
>> http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Class_Line_3.html
>>
>> and construct the plane containing this line and having the computed
>> vector as orthogonal vector.
>>
>> http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Class_Plane_3.html
>>
>>
>> Take two points on Line_2 and project then on the plane. Construct the
>> line passing through the projected points and intersect it with Line_1
>> to get the first point.
>>
>> http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Function_intersection.html
>>
>> To get the second point construct the line containing the first point
>> with direction the computed vector. Intersect this line with Line_2 and
>> you will get the second point.
>>
>> I agree that a closest_point method would be nice to have in CGAL.
>>
>> Sebastien.
>>
>> updog wrote:
>>>  I just find CGAL::squared_distance() would be useful.
>>> However, is there a way to get the locations of the very pair of points
>>> achieving the minimal squared distance?
>>>
>>> --
>>> View this message in context:
>>>
>>> http://cgal-discuss.949826.n4.nabble.com/how-to-find-closest-point-on-a-segment-rectangle-to-a-given-point-tp3618761p3618911.html
>>>
>>> Sent from the cgal-discuss mailing list archive at Nabble.com.
>>>
>>
>>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://cgal-discuss.949826.n4.nabble.com/how-to-find-closest-point-on-a-segment-rectangle-to-a-given-point-tp3618761p3619259.html
> To unsubscribe from how to find closest point on a segment/rectangle to a
> given point, click here.



--
Regards,
Zihan, Sheldon Liu
------------------------
The Media Computing Group (MCG)
where Media Spectrum unleashes Digital Potential for Fun in Life.

School of Creative Media (SCM)
City University of Hong Kong


View this message in context: Re: how to find closest point on a segment/rectangle to a given point
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page