Subject: CGAL users discussion list
List archive
- From: Rahul Verma <>
- To:
- Subject: [cgal-discuss] Finding intersections between line and polygon in 2D/3D
- Date: Wed, 15 May 2019 23:16:26 -0500
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:mYioch/xDJZ9nv9uRHKM819IXTAuvvDOBiVQ1KB42uscTK2v8tzYMVDF4r011RmVBNyduqMP1LuempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffhhEiCC5bL52Ixm7rwHcvdQKjIV/Lao81gHHqWZSdeRMwmNoK1OTnxLi6cq14ZVu7Sdete8/+sBZSan1cLg2QrJeDDQ9LmA6/9brugXZTQuO/XQTTGMbmQdVDgff7RH6WpDxsjbmtud4xSKXM9H6QawyVD+/6apgVR3mhzodNzMh/27ZisJ+gqFGrhy/uxNy2JTbbJ2POfdkYq/RYdEXSGxcVchRTSxBBYa8YpMTAeUbPeZYso39rEYBohSgHwmsAfngwSJPi3/sx6I60/khEQXY3AM+BdIOtW7bodb2OaoJXuC1ybPHzTTHb/9MxTj9743IfwknrPqRU7xwds/RxlMuFwPDlliQpo3lPy+V1uQQqGeX9fZvVeWqi2I/sAFxviKgydsvionOmIIa1ErE9St9wIYyK9y0UlJ0YdmhEJZWqiqUNJN2T9s8T210vCs20L4LtJ6hcCQU1JgqxATTZvyIfoWO/xntTvyeIS1ii3JgYL+/hwi98UynyuDkU8m7yldKri5cntbSq38BygXf6saHR/Zy5Euh1jGP1wfc6uFAP084j7bUK5kkwrIol5oTt1rMHjPulUnokKObcl8o9+uo5uj9fLnqupyRO5V0hwzxKqgun9awAeU8MggARWib/uG82aX5/ULjQLVKk/k2krfHv5DAIMQUvK20DgxO34Ys7hawFTam0NACkXYbK1JFfQqLj5L1NFHWPPD4EfC/jkywnzdk3f/GOqTtDYjMLnjYjLjhYK1961VHxQoozdFf4opUBasbLPLyXE/xrt3YAQUjPwy62ea0QOl6g4gRUGbKDq6CO77JqneJ4PguKq+Cftw7ojH4fsIs5+PqxUE0g1oUNf2z1JsKbG61BPFvcxWxbn/lg9NHGmAP6FltBNf2gUGPBGYAL025WLgxs2liWdCWSLzbT4Xou4SvmSKyH5lYfGdDUwneHnLhdoHCUPAJOnvLf51R1wccXL3kcLcPkBGjsAigluhiJ+vQvyAU7NftiYQz6OrUmhU/szdzCpbFij3ffyRPhmoNAgQO8uVnu0UkkwWM1KF5h7pTEtkBv/4=
I'm trying to use the CGAL python-bindings to write a program (in Python) to find intersections between 1 object (which could be a line segment(s) or a polygon/polyhedron) and another polygon/polyhedron. While I am currently working in 2D, I would like to extend the program to 3D as well. I have asked this question here as well: https://stackoverflow.com/questions/56157264/finding-intersections-between-line-segment-and-general-polygon-in-2d-3d
I've installed the python-bindings for CGAL already. I understand it is still under development, but it seems it can already do a lot of things. I have managed to get it to output intersections between a line segment and a tetrahedron (using the AABB tree algorithms), and intersecting sequences of dD iso-oriented boxes. However, the AABB tree algorithms seem to only work with 3D objects. I guess I can represent my general shape as a pseudo-3D object, but then I ran into the problem of actually constructing the 3D object. The examples given in the python-bindings only work for tetrahedrons, and I cannot figure out how to create a general polyhedron. So my problem has become two-fold:
- How do I define a general polyhedron using the CGAL python-bindings?
- How do I use the defined polyhedron to calculate intersections and distances from other general shapes like line segments and polygons?
So for a tetrahedron, the package does (from https://github.com/CGAL/cgal-swig-bindings/blob/master/examples/python/AABB_polyhedron_facet_intersection_example.py) :
from CGAL.CGAL_Kernel import Point_3
from CGAL.CGAL_Polyhedron_3 import Polyhedron_3
p=Point_3(1.0, 0.0, 0.0)
q=Point_3(0.0, 1.0, 0.0)
r=Point_3(0.0, 0.0, 1.0)
s=Point_3(0.0, 0.0, 0.0)
polyhedron = Polyhedron_3()
polyhedron.make_tetrahedron(p, q, r, s)
#constructs AABB tree
tree = AABB_tree_Polyhedron_3_Facet_handle(polyhedron.facets())
#constructs segment query
a = Point_3(-0.2, 0.2, -0.2)
b = Point_3(1.3, 0.2, 1.3)
segment_query=Segment_3(a,b)
This creates a tetrahedron, which can support queries on intersection, squared distance etc. However, this does not work for more than 4 points. In my case, the polygon/polyhedron would be defined by around 50 points. How do I create such an object using CGAL-python?
Thanks,
Rahul
- [cgal-discuss] Finding intersections between line and polygon in 2D/3D, Rahul Verma, 05/16/2019
Archive powered by MHonArc 2.6.18.