Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Intersection between plane and triangle through the same three points

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Intersection between plane and triangle through the same three points


Chronological Thread 
  • From: Marc Alexa <>
  • To:
  • Subject: Re: [cgal-discuss] Intersection between plane and triangle through the same three points
  • Date: Tue, 18 May 2021 11:51:33 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-hdrordr: A9a23:Plu7A6goUoPcqJvADj+B/jiZm3BQXvkji2hC6mlwRA09TyQY+vrPoB17726MtN9/YgBGpTntAtjjfZqjz/BICPgqXItKjDOW21dARbsKheDfKlXbdBEWndQtsZuIHZIObeHYPBxfoYLW6BS1euxM/PC3tISFwcbTynEFd2tXQpAlyys8Kj/zKCFLrXF9dPwEKKY=
  • Ironport-phdr: A9a23:NahnMBVHanVQdpIhPW02m0TrkHnV8KyKUjF92vMcY1JmTK2v8tzYMVDF4r011RmVBNSdsawawLeJ+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxhMiTanf79/LRS7oQrRu8QUnIBvNrs/xhzVr3VSZu9Y33loJVWdnxb94se/4ptu+DlOtvwi6sBNT7z0c7w3QrJEAjsmNXs15NDwuhnYUQSP/HocXX4InRdOHgPI8Qv1Xpb1siv9q+p9xCyXNtD4QLwoRTiv6bpgRRn1gykFKjE56nnahMxsg6xUrx2vuhJxw4DKbo6XN/RwebjQfc8DRWpEQspRVzBND4G6YoASD+QBJ+FYr4zlqlUJtxS+HxWjD/7zxz9MmHD30rc12PkmHAHDxgMgBc4BvG7Oo9XxKqgTXvq6wbLHzTXGdfxW2DP95JLUfRAmpPGBRLR9etfexkczDQ3KlEmQqZD7MDOP0OQAq2uW4epvWOyhhWArtQF8rDixy8swi4TEhoEYxkzH+Ch9zos5Ody1RFNnbdO5HpZetyOXO5d4TM4/TWxlpSY3x6EAtJWmciYKz5EnyATea/yBa4WI4xTjVPyQIThinn5ldqi/ihCv+kaj0u3xTte43EpOoyZfkdTBtmoB2wLP5sWEUPdw/lmt1S6S2w3d9u1IO104mKXfJpI737I9lIQfvV7HEyPonkj9kbWYeV8++uey7uTqerXmqYGYN49zkgz+N74hms27AeghLAcBQnWX9f2y1LDj40H1WrpKjvoxkqnWtJDVO94XqbK+Aw9Qyooj6hC/ACm60NkAg3ULMFZIdAiEgoXpIV3CPuz0APSlj1msjjtn3/XGMafgApXJIHjDirDhfbNl5k5Z0gUz18xQ64hOBbEFPv3yVVX+ucfXDh88KQO0wuLnBM9h2YMZXGKDGrWZP7/KsV+U+uIvJPGBa5MauDnnL/gp/uPhjX4imVABYKmpxoAXZWujHvVmJkWZeWDjjs0AEWcMpAo+TfblhEeMUT5JND6PWbkh7GQ7FJ6+FtWEAZu8haSImia9BJxfIG5cTUudFG/hMISCVfBLYy2bJoptkycPSKO6GLInzgykiALq1+9nMvbM4X9f8ony0cB8oezVjxA7szJuSN+M1nmECGBykGRPTDA/2OVzoFd210yYgpR/1vdXHNgW6/JSWRohLrbdyfZ7Apb8QFHvZNCMHXOvWN7uKDU8Xtt5l9oHeU07EtGvnhnr0C+jArtTnLuOUs9nupnA1mT8cp4ug03N07Ms2gFOqi5nOmivh6o5/A/WVdahe6qxmKOjdKBa1ynIpj7rJYumuUhZVEt9XfyAUy1FIETRqtv96wXJSLr8Udwa

Sure. If the coordinates have exact representations in binary float (and
their products and the sum of the products can be represented in the
available digits) then it probably works just as one would naively expect.
There are also other cases that are more convenient for the internal
representation.

If, as Andreas hinted, the internal representation of a plane was indeed a
point and a normal, the ‘has_on’ test still had a good chance to evaluate to
true consistently. Let X,N be the representation of the plane. Construction
from V0,V1,V2 could be implemented as X = V0, N = (V1-V0)x(V2-V0). Then
<V0,N>-<X,N> = <V0,N> - <V0,N> would evaluate to zero in most(?) floating
point implementations.

But the internal implementation is not point plus normal. Rather it is normal
plus offset. And apparently the offset is not just <V0,N> or else I would
expect that V0 is evaluated to be on the plane, despite inexact
representation in floating points (as per the argument above).

So there seems to be more going on in the construction. (Probably cannot hold
myself back from looking into it now…)

Best,
Marc




> On 18. May 2021, at 11:20, Michael Hoffmann <> wrote:
>
> Hi Marc,
>
> the coordinates of your points look nice in decimal, but they (e.g., 1.1,
> 0.3, 0.7) get pretty ugly once converted to binary…
>
> Best, Michael
>
>> On 18 May 2021, at 11:16, Marc Alexa <> wrote:
>>
>> Hi Andreas,
>>
>> Thanks for the quick answer.
>>
>> I think I just now fully understood the consequences of “inexact
>> constructions”. It does lead to some interesting results, I have to say. I
>> put a minimal program together that generates such a result, which is of
>> course unsurprising in general, but still a bit surprising to me for the
>> ‘exact predicates’ statement.
>>
>> Best,
>> Marc
>>
>> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
>> #include <CGAL/intersections.h>
>>
>> typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
>> typedef K::Point_3 Point;
>> typedef K::Line_3 Line;
>> typedef K::Plane_3 Plane;
>> typedef K::Triangle_3 Triangle;
>>
>> int main()
>> {
>> Point V0(1.0,0.3,0.7);
>> Point V1(0.3,1.1,0.2);
>> Point V2(3.3,4.7,5.1);
>>
>> Plane p(V0,V1,V2);
>>
>> std::cerr << "V0 on plane? " << p.has_on(V0) << std::endl;
>> std::cerr << "V1 on plane? " << p.has_on(V1) << std::endl;
>> std::cerr << "V2 on plane? " << p.has_on(V2) << std::endl;
>>
>> Triangle t(V0,V1,V2);
>>
>> std::cerr << "Triangle intersects plane? " << CGAL::do_intersect(p,t)
>> << std::endl;
>>
>> Line l(V0,V1);
>> std::cerr << "V0 on line? " << l.has_on(V0) << std::endl;
>> std::cerr << "V1 on line? " << l.has_on(V1) << std::endl;
>>
>> std::cerr << "Triangle intersects line? " << CGAL::do_intersect(l,t) <<
>> std::endl;
>>
>> std::cerr << "Plane intersects line? " << CGAL::do_intersect(l,p) <<
>> std::endl;
>>
>> return 0;
>> }
>>
>>
>>
>>> On 17. May 2021, at 20:53, Andreas Fabri
>>> <> wrote:
>>>
>>> Hi Marc,
>>>
>>> As the plane is internally a point and a normal this is a construction.
>>> So if the point is slightly off the plane of the triangle and the normal
>>> happens to be correct the plane and the triangle plane are parallel.
>>>
>>> Even if one takes a vertex of the triangle as base for the plane
>>> there is no guarantee that the intersection is the full triangle.
>>>
>>> andreas
>>>
>>> On 5/17/21 7:07 PM, Marc Alexa ( via cgal-discuss
>>> Mailing List) wrote:
>>>> Dear all,
>>>>
>>>> I’m a checking the intersection between Triangle_3 and Plane_3 objects.
>>>> If both are constructed from the same triple of points, the result is
>>>> false for most triples, but sometimes true. I’m using the exact
>>>> predicates / inexact constructions kernel. Is this the expected /
>>>> desired behavior? I had hope because of the exact predicates that the
>>>> result for such intersection tests is at least consistent (and actually
>>>> consistently true).
>>>>
>>>> Thanks!
>>>> -Marc
>>>>
>>>>
>>>>
>>>
>>> --
>>> You are currently subscribed to cgal-discuss.
>>> To unsubscribe or access the archives, go to
>>> https://sympa.inria.fr/sympa/info/cgal-discuss
>>>
>>>
>>
>>
>> --
>> You are currently subscribed to cgal-discuss.
>> To unsubscribe or access the archives, go to
>> https://sympa.inria.fr/sympa/info/cgal-discuss
>>
>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
>
>




Archive powered by MHonArc 2.6.19+.

Top of Page