Jiantao Song , Rui Xu , Wensong Wang , Shiqing Xin , Shuangmin Chen , Jiaye Wang , Taku Komura , Wenping Wang , Changhe Tu
{"title":"P2Seg:从点到段的距离查询","authors":"Jiantao Song , Rui Xu , Wensong Wang , Shiqing Xin , Shuangmin Chen , Jiaye Wang , Taku Komura , Wenping Wang , Changhe Tu","doi":"10.1016/j.cad.2025.103947","DOIUrl":null,"url":null,"abstract":"<div><div>Querying the nearest distance from a point to <span><math><mi>n</mi></math></span> line segments in 2D is a textbook problem in computational geometry. This paper presents P2Seg, a novel algorithmic strategy that transforms the intricate problem into an accessible linear traversal. Our method precomputes a KD tree and a Voronoi diagram for the site collection <span><math><mi>S</mi></math></span>, where <span><math><mi>S</mi></math></span> refers to the endpoints of all line segments. Obviously, for a query point <span><math><mi>q</mi></math></span>, the nearest site <span><math><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub></math></span> provides a crucial clue for pinpointing the nearest line segment, i.e., the pairing <span><math><mrow><mo>(</mo><mi>q</mi><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></math></span> effectively reduces the search from <span><math><mi>n</mi></math></span> line segments to a limited number, represented as <span><math><mrow><mi>L</mi><mrow><mo>(</mo><mi>q</mi><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></mrow></math></span>. The key idea of this paper is driven by an insightful observation: if the ray <span><math><mrow><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mi>q</mi></mrow></math></span> intersects with <span><math><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub></math></span>’s Voronoi cell at a point, say <span><math><msup><mrow><mi>q</mi></mrow><mrow><mo>′</mo></mrow></msup></math></span>, then <span><math><mrow><mi>L</mi><mrow><mo>(</mo><mi>q</mi><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></mrow></math></span> is a subset of <span><math><mrow><mi>L</mi><mrow><mo>(</mo><msup><mrow><mi>q</mi></mrow><mrow><mo>′</mo></mrow></msup><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></mrow></math></span>. This suggests that preprocessing efforts can be substantially minimized by focusing solely on scenarios where the query point lies on the Voronoi edges, which are fundamentally one-dimensional. We further prove that the challenge of locating the nearest line segment from <span><math><mrow><mi>L</mi><mrow><mo>(</mo><msup><mrow><mi>q</mi></mrow><mrow><mo>′</mo></mrow></msup><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></mrow></math></span> can be distilled down to a simple linear traversal. Testing on datasets of varying complexities shows that P2Seg significantly outperforms state-of-the-art techniques. For example, in scenarios involving 10K segments with an average length of 0.5, our method runs 2.2 times faster than P2M and 60 times faster than AABB, as illustrated in the teaser figure.</div></div>","PeriodicalId":50632,"journal":{"name":"Computer-Aided Design","volume":"189 ","pages":"Article 103947"},"PeriodicalIF":3.1000,"publicationDate":"2025-08-20","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"P2Seg: Distance query from point to segments\",\"authors\":\"Jiantao Song , Rui Xu , Wensong Wang , Shiqing Xin , Shuangmin Chen , Jiaye Wang , Taku Komura , Wenping Wang , Changhe Tu\",\"doi\":\"10.1016/j.cad.2025.103947\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<div><div>Querying the nearest distance from a point to <span><math><mi>n</mi></math></span> line segments in 2D is a textbook problem in computational geometry. This paper presents P2Seg, a novel algorithmic strategy that transforms the intricate problem into an accessible linear traversal. Our method precomputes a KD tree and a Voronoi diagram for the site collection <span><math><mi>S</mi></math></span>, where <span><math><mi>S</mi></math></span> refers to the endpoints of all line segments. Obviously, for a query point <span><math><mi>q</mi></math></span>, the nearest site <span><math><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub></math></span> provides a crucial clue for pinpointing the nearest line segment, i.e., the pairing <span><math><mrow><mo>(</mo><mi>q</mi><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></math></span> effectively reduces the search from <span><math><mi>n</mi></math></span> line segments to a limited number, represented as <span><math><mrow><mi>L</mi><mrow><mo>(</mo><mi>q</mi><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></mrow></math></span>. The key idea of this paper is driven by an insightful observation: if the ray <span><math><mrow><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mi>q</mi></mrow></math></span> intersects with <span><math><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub></math></span>’s Voronoi cell at a point, say <span><math><msup><mrow><mi>q</mi></mrow><mrow><mo>′</mo></mrow></msup></math></span>, then <span><math><mrow><mi>L</mi><mrow><mo>(</mo><mi>q</mi><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></mrow></math></span> is a subset of <span><math><mrow><mi>L</mi><mrow><mo>(</mo><msup><mrow><mi>q</mi></mrow><mrow><mo>′</mo></mrow></msup><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></mrow></math></span>. This suggests that preprocessing efforts can be substantially minimized by focusing solely on scenarios where the query point lies on the Voronoi edges, which are fundamentally one-dimensional. We further prove that the challenge of locating the nearest line segment from <span><math><mrow><mi>L</mi><mrow><mo>(</mo><msup><mrow><mi>q</mi></mrow><mrow><mo>′</mo></mrow></msup><mo>,</mo><msub><mrow><mi>s</mi></mrow><mrow><mi>i</mi></mrow></msub><mo>)</mo></mrow></mrow></math></span> can be distilled down to a simple linear traversal. Testing on datasets of varying complexities shows that P2Seg significantly outperforms state-of-the-art techniques. For example, in scenarios involving 10K segments with an average length of 0.5, our method runs 2.2 times faster than P2M and 60 times faster than AABB, as illustrated in the teaser figure.</div></div>\",\"PeriodicalId\":50632,\"journal\":{\"name\":\"Computer-Aided Design\",\"volume\":\"189 \",\"pages\":\"Article 103947\"},\"PeriodicalIF\":3.1000,\"publicationDate\":\"2025-08-20\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Computer-Aided Design\",\"FirstCategoryId\":\"94\",\"ListUrlMain\":\"https://www.sciencedirect.com/science/article/pii/S0010448525001083\",\"RegionNum\":3,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q2\",\"JCRName\":\"COMPUTER SCIENCE, SOFTWARE ENGINEERING\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computer-Aided Design","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0010448525001083","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
Querying the nearest distance from a point to line segments in 2D is a textbook problem in computational geometry. This paper presents P2Seg, a novel algorithmic strategy that transforms the intricate problem into an accessible linear traversal. Our method precomputes a KD tree and a Voronoi diagram for the site collection , where refers to the endpoints of all line segments. Obviously, for a query point , the nearest site provides a crucial clue for pinpointing the nearest line segment, i.e., the pairing effectively reduces the search from line segments to a limited number, represented as . The key idea of this paper is driven by an insightful observation: if the ray intersects with ’s Voronoi cell at a point, say , then is a subset of . This suggests that preprocessing efforts can be substantially minimized by focusing solely on scenarios where the query point lies on the Voronoi edges, which are fundamentally one-dimensional. We further prove that the challenge of locating the nearest line segment from can be distilled down to a simple linear traversal. Testing on datasets of varying complexities shows that P2Seg significantly outperforms state-of-the-art techniques. For example, in scenarios involving 10K segments with an average length of 0.5, our method runs 2.2 times faster than P2M and 60 times faster than AABB, as illustrated in the teaser figure.
期刊介绍:
Computer-Aided Design is a leading international journal that provides academia and industry with key papers on research and developments in the application of computers to design.
Computer-Aided Design invites papers reporting new research, as well as novel or particularly significant applications, within a wide range of topics, spanning all stages of design process from concept creation to manufacture and beyond.