A method, system, and storage medium for extracting intersection lines of 3D models based on color coding and texture mapping.

By using color encoding and texture mapping, the 3D model is parameterized to the 2D parameter domain and rendered using GPU. This solves the problems of floating-point operation errors and high computational complexity in traditional methods, and achieves efficient and stable intersection line extraction and topological continuity. It is applicable to intersection line calculation of various 3D models.

CN122492987APending Publication Date: 2026-07-31DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN UNIV OF TECH
Filing Date
2026-05-19
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Traditional methods for calculating intersection lines in 3D models suffer from defects such as floating-point operation errors, high computational complexity, and intersection line topological breaks, making it difficult to achieve real-time or interactive performance. Furthermore, existing GPU-assisted methods lack an accurate reverse mapping mechanism from image space to 3D space, limiting the accuracy of intersection line extraction.

Method used

A method based on color encoding and texture mapping is adopted to parameterize the 3D model into the 2D parameter domain, generate color-coded textures and use GPU for off-screen rendering. Candidate pixels for intersection lines are detected by pixel-level color analysis and decoded into intersection lines in 3D space.

Benefits of technology

It achieves efficient and stable intersection line extraction, avoids the instability of floating-point operations, and ensures natural and continuous intersection line topology. It has extremely high computational efficiency, is suitable for various 3D models, and has controllable accuracy. It is applicable to CAD Boolean operations, assembly interference detection, collision analysis, and 3D visualization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492987A_ABST
    Figure CN122492987A_ABST
Patent Text Reader

Abstract

This invention provides a method, system, and storage medium for extracting intersection lines from 3D models based on color encoding and texture mapping. The method involves parametric mapping of the 3D model to establish a correspondence between parametric coordinates and 3D spatial coordinates; generating a color-coded texture map so that different positions within the parameter domain correspond to different color values; mapping the color-coded texture map as a texture onto the model surface and performing off-screen rendering to obtain a color-rendered image; performing pixel-level color difference analysis on the rendered image to detect color transition regions and identify candidate pixels for intersection lines; decoding the color values ​​of the intersection line pixels into parametric coordinates, and then converting them into 3D spatial coordinates according to the aforementioned correspondence to generate 3D intersection lines. This invention transforms the 3D geometric intersection problem into an image space color difference detection problem, utilizing the parallel processing capabilities of graphics processors to avoid numerical instability and topological breakage problems in traditional geometric algorithms, enabling efficient and stable extraction of continuous intersection lines from complex models.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of three-dimensional model geometry processing and computer graphics technology, and in particular to a method, system and storage medium for extracting intersection lines of three-dimensional models based on color encoding and texture mapping. Background Technology

[0002] Intersection Computation of 3D Models is a core technology in fields such as Computer-Aided Design (CAD), Engineering Simulation (CAE), Computer Graphics, Virtual Reality, and 3D Printing. Its purpose is to determine the location and topological structure of the intersection of two or more 3D surface or mesh models in space, providing fundamental geometric information for tasks such as Boolean operations, assembly interference detection, collision analysis, geometric reconstruction, and visualization rendering.

[0003] Traditional methods for calculating intersection lines are mainly divided into two categories: triangle-triangle intersection detection methods based on geometric analysis and iterative intersection methods based on parametric surfaces.

[0004] For triangular mesh models, a common approach is to establish a spatial acceleration structure (such as BVH, AABB trees, or kd-trees) to filter potentially intersecting triangle pairs, and then perform triangle-triangle intersection tests one by one. This method requires solving for the intersection points of line segments and planes, and determining the intersecting line segments by judging whether the intersection points are simultaneously located inside two triangles. Although theoretically it can achieve high accuracy, it has significant drawbacks in engineering practice: First, floating-point operation errors and degradation cases (coplanar, shared edges, contact but not penetration) often lead to topological breaks in the intersection lines, requiring complex post-processing repairs; second, the computational complexity increases superlinearly with the number of triangles, making it difficult to achieve real-time or interactive performance for complex models with millions of faces; third, splicing intersection lines is difficult, requiring the design of complex topology reconstruction algorithms to eliminate redundancy and breakpoints.

[0005] For parametric surfaces (such as Bézier surfaces and NURBS surfaces), intersection calculations typically involve solving nonlinear surface equations through recursive trimming or parametric domain subdivision. This method suffers from poor numerical stability, is prone to convergence failure in complex intersection cases such as tangents and branches, and is computationally time-consuming.

[0006] In recent years, with the rapid development of parallel computing capabilities of graphics processing units (GPUs), researchers have begun to attempt to transform geometric computation problems into color or depth comparison problems in image space, utilizing the rasterization and pixel parallelism mechanisms of GPUs to achieve acceleration. However, most existing GPU-assisted methods lack an accurate reverse mapping mechanism from image space to 3D space, the accuracy of intersection line extraction is limited by the accuracy of the depth buffer, and it is difficult to guarantee the continuity and integrity of the intersection lines. Summary of the Invention

[0007] To address the aforementioned technical problems, this invention proposes a method, system, and storage medium for extracting intersection lines of a 3D model based on color encoding and texture mapping.

[0008] According to one aspect of the present invention, a method for extracting intersection lines of a three-dimensional model based on color encoding and texture mapping is provided, comprising: The input 3D model is parametrically mapped to a regular 2D parameter domain, and the correspondence between parameter coordinates and 3D spatial coordinates is established. Generate a color-coded texture map with a fixed resolution, and assign a unique color value to each position in the parameter domain so that the color corresponds one-to-one with the position on the model surface; The color-coded texture is mapped onto the parameterized model surface as a texture, and off-screen rendering is performed using a graphics processor to obtain a rendered image that reflects the color distribution on the model surface. Pixel-level color analysis is performed on the rendered image to detect pixel regions in the image where color changes abruptly, and these regions are identified as candidate pixels for intersection lines of different models in the projection space. The color values ​​of the detected intersection candidate pixels are decoded into corresponding parameter coordinates according to the reverse mapping of the color encoding. Based on the correspondence between the parameter coordinates and the three-dimensional space coordinates, the decoded parameter coordinates are converted into points in the three-dimensional space, thereby generating the intersection lines of the three-dimensional model.

[0009] According to one embodiment of the present invention, the parametric mapping uses discrete harmonic mapping to map the surface of the three-dimensional model to the unit square parameter domain, and fixes the model boundary vertices on the four boundaries of the unit square in topological order, thereby obtaining a non-overlapping and structurally stable parametric unfolding.

[0010] According to one embodiment of the present invention, generating a color-coded texture includes: dividing the parameter domain into a pixel grid, encoding using different component combinations of the RGB three color channels, so that each pixel grid point obtains a unique RGB triplet, and forming a strict bijective relationship between color and position within the parameter domain.

[0011] According to one embodiment of the present invention, the generation of color-coded texture further includes: dividing the parameter domain into multiple pixel blocks, assigning different values ​​to different pixel blocks in the red channel, and assigning different values ​​to the green and blue channels in the same pixel block according to the row and column coordinates of the pixels, thereby constructing a one-to-one correspondence between color and parameter coordinates.

[0012] According to one embodiment of the present invention, the off-screen rendering includes: creating an off-screen frame buffer object in a graphics processor, mapping the color-coded texture to a parameterized plane using nearest-neighbor sampling, and disabling texture interpolation to ensure that the color of each rendered pixel strictly corresponds to the original color value in the parameter domain.

[0013] According to one embodiment of the present invention, the detection of pixel regions in the image where color changes abruptly includes: using the parallel computing architecture of the graphics processor, allocating an independent computing thread to each pixel in the rendered image, calculating the color difference between each pixel and its adjacent pixels in parallel, and marking the pixel pair as intersection candidate pixels when the color difference does not match the standard deviation determined by the color coding scheme.

[0014] According to one embodiment of the present invention, the step of converting the decoded parameter coordinates into points in three-dimensional space includes: positioning the decoded parameter coordinates within the corresponding triangle of the parameterized triangular mesh, calculating the centroid coordinates of the parameter point relative to the vertex of the triangle, and then using the affine invariance of the parameterized mapping, directly applying the centroid coordinates to the corresponding three-dimensional space vertex coordinates, obtaining the three-dimensional space position of the intersection point through linear interpolation; and then performing connectivity analysis on the obtained three-dimensional point set to generate a continuous three-dimensional intersection curve.

[0015] According to another aspect of the present invention, a three-dimensional model intersection line extraction system based on color encoding and texture mapping is provided, comprising: The parameterization module is used to perform parameterized mapping on the 3D model and establish the correspondence between parameter coordinates and 3D spatial coordinates. The color encoding generation module is used to generate color-encoded textures, so that different positions within the parameter field correspond to different color values. The rendering module is used to map color-coded textures onto the model surface and perform off-screen rendering using a graphics processor to obtain a rendered image. The intersection detection module is used to perform color difference analysis on the rendered image and detect color change regions to identify intersection pixels; The coordinate restoration module is used to decode the color of the intersection pixel into parametric coordinates and convert them into three-dimensional spatial coordinates to generate a three-dimensional intersection line.

[0016] According to one embodiment of the present invention, the rendering module is configured to render using nearest neighbor sampling and off-screen frame buffer objects; the intersection detection module is configured to use a parallel computing architecture to calculate the color difference between each pixel and its neighboring pixels, and filter out candidate pixels for intersection.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the three-dimensional model intersection extraction method described in any of the preceding claims.

[0018] Compared with the prior art, the present invention has the following beneficial effects: Using color difference information visualized by the GPU to guide geometric intersection calculation is efficient, stable, and reliable: Traditional methods rely on floating-point geometric operations, which are susceptible to numerical errors, leading to broken intersection lines or topological errors. This invention maps geometric positions to discrete RGB integer values ​​through color encoding, and intersection line detection is based on logical judgments of pixel colors, completely avoiding the instability of floating-point operations, resulting in naturally continuous intersection line topology.

[0019] By fully utilizing the parallel computing capabilities of GPUs, the processing efficiency is extremely high: parameterization, color encoding, rendering, and pixel analysis can all be executed in parallel. In particular, in the intersection detection step, the massively parallel architecture of CUDA with one thread per pixel reduces the serial complexity of O(N²) to the macroscopic level of O(1), enabling real-time processing even for high-resolution images with tens of millions of pixels. For complex models with millions of faces, this invention can complete intersection extraction within milliseconds to seconds, far exceeding traditional methods.

[0020] The intersection lines are continuous and complete, requiring no post-processing repair: Since the intersection line pixels in the rendered image naturally form a continuous region, the complete intersection line curve can be directly obtained through connectivity analysis, avoiding the topology stitching and redundancy elimination steps in traditional methods.

[0021] Wide applicability and compatibility with various 3D models: This invention is applicable to both triangular mesh models and parametric surface models, as long as the model can be parameterized to a rectangular domain (such as a topological disk). Multiple models can be processed separately, and for large models, accuracy and efficiency can be balanced by adjusting the color encoding resolution.

[0022] Simple to implement and with controllable precision: The methodology is clear, based on existing graphics standards and GPU programming models, and easy to implement in engineering. Intersection accuracy can be improved by increasing the resolution of the color-coded texture (e.g., 4096×4096) while maintaining computational efficiency.

[0023] In summary, this invention provides a new, efficient, stable, and easy-to-implement scheme for intersection line calculation in applications such as CAD Boolean operations, assembly interference detection, collision analysis, mesh repair, and 3D visualization. Attached Figure Description

[0024] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not limitation, and like or corresponding reference numerals denote like or corresponding parts wherein: Figure 1The flowchart illustrates the implementation of the three-dimensional model intersection line extraction method based on color encoding and texture mapping provided in this embodiment of the invention. Figure 2 This is a schematic diagram of a two-dimensional parametric plane obtained by harmonic mapping of a topological disk mesh in an embodiment of the present invention; Figure 3 This is a schematic diagram of the color-coded texture used in the embodiments of the present invention; Figure 4 This is a schematic diagram illustrating the visualization result of mapping color-coded textures onto a three-dimensional surface in an embodiment of the present invention; Figure 5 This is a schematic diagram of the detected and generated three-dimensional intersection results in an embodiment of the present invention. Detailed Implementation

[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0026] It should be understood that the terms "first," "second," "third," and "fourth," etc., in the claims, specification, and drawings of this invention are used to distinguish different objects, not to describe a specific order. "First," "second," "third," and "fourth," etc., also do not necessarily mean only one, but can also mean multiple. The terms "comprising" and "including" used in the specification and claims of this invention indicate the presence of the described features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof.

[0027] It should also be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this specification and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.

[0028] As used in this specification and claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0029] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0030] This embodiment provides a method for extracting intersection lines of a 3D model based on color encoding and texture mapping. The core idea of ​​this method is to transform the 3D geometric intersection problem into a color difference detection problem in a 2D image space, and to achieve efficient and stable intersection line extraction by utilizing the parallel processing capabilities of a graphics processor. Figure 1 As shown, the method includes the following core operations.

[0031] Parametric mapping. The input 3D model is parametrically mapped to a regular 2D parametric domain, establishing the correspondence between parametric coordinates and 3D spatial coordinates. Specifically, one or more 3D triangular mesh models (e.g., a sphere and a cube) are input. First, the model undergoes normalization and topology cleanup, eliminating overlapping surfaces, isolated vertices, and non-manifold edges, ensuring the model is a manifold surface (topological disk) with a single closed boundary. Then, a parametric method is used to map the model surface to a unit square [0,1]×[0,1] parametric domain.

[0032] In this embodiment, the discrete harmonic mapping method is preferably used. Discrete harmonic mapping is achieved by minimizing the following energy function:

[0033] Where E is the harmonic energy value that needs to be minimized; Represents the edge set of the grid; The harmonic weight coefficients are based on edge length or cosine weights. , and( , Let be the coordinates of vertices i and j in the parameter domain, respectively. Boundary vertices are uniformly fixed on the four boundaries of the unit square in topological order. Solving for the minimum energy value yields the parameter coordinates (u, v) of the internal vertices, ensuring that the triangle shape in the parameter domain maintains the angular characteristics of the original 3D mesh as much as possible, without folding or overlapping. This step establishes a one-to-one correspondence between parameter coordinates and 3D vertex coordinates, and the 3D spatial position of any parameter point can subsequently be obtained by interpolating the centroid inside the triangle. Figure 2 The parameterized two-dimensional planar mesh is shown.

[0034] Color-coded texture generation. A fixed-resolution color-coded texture is generated, assigning a unique color value to each location in the parameter domain, ensuring a one-to-one correspondence between color and location on the model surface. The resolution of the color-coded texture is set to N×N, for example, N=1024. The parameter domain is uniformly divided into a 1024×1024 pixel grid. Encoding is performed using different combinations of the RGB color channels, ensuring each pixel grid point receives a unique RGB triplet, and establishing a strict bijective relationship between color and location within the parameter domain.

[0035] This embodiment employs a block encoding strategy: the parameter domain is divided into multiple pixel blocks (e.g., each pixel block is 255×255 in size), and different pixel blocks are assigned different values ​​on the red channel. Specifically, if the texture feature R value is set to x, then the R value of the nth pixel block is x+τ(n-1), where τ is the texture feature value (e.g., τ=16). Within the same pixel block, different values ​​are assigned to the green and blue channels based on the pixel's row and column coordinates: the green channel G takes the row offset within the block, and the blue channel B takes the column offset within the block. In this way, the red channel identifies the block number to which the pixel belongs, and the green and blue channels record the vertical and horizontal offsets within the block, thereby ensuring that the color codes of any two points in the parameter domain are always different. Through the above encoding strategy, a unique color mapping function g:(u,v)→(R,G,B) is constructed, and its inverse mapping g -1 It can also exist stably, providing a reliable foundation for subsequent parameter decoding. The RGB encoding is written into a bitmap file (.bmp) according to the format of a two-dimensional image texture, resulting in a color-coded texture that can be directly read by the GPU, such as... Figure 3 As shown.

[0036] Off-screen rendering. Color-coded textures are mapped onto the parametric model surface, and the graphics processor is used for off-screen rendering to obtain a rendered image that reflects the color distribution on the model surface.

[0037] Create an off-screen framebuffer object (FBO) in the graphics processor. Map the color-coded texture to the parametric plane using nearest-neighbor sampling, and disable texture interpolation (set to GL_NEAREST) ​​to ensure that the color of each rendered pixel strictly corresponds to the original color value in the parameter domain, avoiding color mixing caused by interpolation. Set up an orthographic camera so that the parametric plane completely covers the viewport. Then perform rendering, reading the pixel data from the color buffer in the FBO and saving it as the rendered image. Figure 4 The visualization shows the result of mapping the color-coded texture onto a 3D surface.

[0038] Intersection pixel detection. A pixel-by-pixel color analysis is performed on the rendered results to detect regions of abrupt color changes in the image, in order to identify the intersection pixels of different models in the projection space; this includes the following sub-steps: To efficiently identify the intersection regions of different models in the image space, the obtained color-rendered image is uploaded to the GPU memory, and an independent thread is allocated to each pixel in the image under the CUDA framework, so that the entire image pixel grid is processed in parallel in a SIMT manner.

[0039] Each thread reads the color value at the position coordinates (x, y) of its corresponding pixel, denoted as

[0040] in These represent the red, green, and blue channel values ​​of the pixel, respectively. Simultaneously, each thread reads the neighboring pixels of this pixel. And they are not all zero at the same time. That is, a neighboring pixel can be the right pixel (x+1, y), the bottom pixel (x, y+1), or the bottom right pixel (x+1, y+1). Let the color components of the neighboring pixels be ( , , ).

[0041] The thread calculates the color difference between the current pixel and its neighboring pixels on the GPU using the following formula:

[0042] In the formula: The Euclidean distance represents the color difference between the current pixel and its neighboring pixels; , , These are the red, green, and blue channel values ​​for the current pixel; , , This represents the channel value corresponding to the neighboring pixels; The square root of the square root calculates the difference between the three RGB channels.

[0043] It should be noted that in the color encoding strategy of this invention, color differences between different models or different pixel blocks are mainly distinguished by the red channel (different blocks are assigned different red channel values, while the green and blue channels are only used for intra-block offsets). Therefore, when detecting pixel pairs from different models, the calculation can be simplified by comparing only the difference in the red channel. In this case, the color difference can be simplified to: ,in and These are the red channel values ​​for the current pixel and its neighboring pixels, respectively. The simplified calculation can still effectively identify color transitions, but with less computational complexity. Those skilled in the art can choose to use the full RGB Euclidean distance or the simplified red absolute difference, depending on actual accuracy and performance requirements.

[0044] This formula accurately characterizes the boundary differences between different models in the parameter domain and maps color abrupt changes to numerically significant color gradients. Thanks to CUDA's parallel execution mechanism, the above calculations can be completed on the entire image within milliseconds.

[0045] When color difference Not equal to the feature value determined by the color coding scheme At that time, that is

[0046] in, This represents the red channel increment between adjacent pixel blocks in the color coding scheme (e.g., τ=16 in this embodiment). It is a natural number (i.e., a non-negative integer).

[0047] Because if two pixels belong to the same color coding block or adjacent coding blocks of the same model, their color difference is usually equal to... Multiples of integers. Conversely, if If this relationship is not satisfied, it means that the two pixels come from different models (or non-adjacent coding regions in the same model), that is, they are located on opposite sides of the intersection line.

[0048] Therefore, it is considered that this pixel and its neighboring pixels represent adjacent regions of two different models in the projection space, thus forming a pair of candidate pixels for intersection. The pixel pair is stored in the global output buffer via CUDA atomic writes, ensuring that no write conflicts or overwriting occur in a highly parallel execution environment.

[0049] 3D coordinate reconstruction. The color values ​​of the detected intersection pixels are decoded back to their corresponding parameter coordinates, and the 3D coordinates of the intersection points are recovered based on the mapping relationship between the parameter coordinates and 3D spatial coordinates, thereby generating the intersection point set or continuous curve of the 3D model; including the following sub-steps.

[0050] According to the encoding rules, the RGB value of the pixel is parsed into two-dimensional parametric coordinates. A triangle containing the two-dimensional parametric coordinates is found on the parametric plane, and the centroid coordinates of the parametric coordinates within the triangle are calculated.

[0051] Specifically, the RGB color values ​​of the candidate pixel pairs obtained from the intersection pixel detection are analyzed. Based on the obtained candidate pixel pairs, they are denoted as follows:

[0052] in, , These represent the color values ​​of the two candidate pixels at the intersection line; For pixels The red, green, and blue channel values; For pixels The red, green, and blue channel values.

[0053] This method performs a complete inverse parameter decomposition and 3D reconstruction process for each pair of color pixels. First, a color-coded mapping is generated based on the color-coded texture. Through the reverse mapping function , The two color values ​​are decoded to their corresponding coordinates in the parameter domain. Where: This represents a forward mapping from parameter coordinates to RGB colors; This represents the reverse mapping from RGB color to parameter coordinates; and These are the parameter coordinates obtained from decoding two pixels.

[0054] Subsequently, based on the parameter domain triangular network structure obtained from the parameterized mapping, the parameter points are determined respectively. and The vertex of the triangle containing the parametric plane is denoted as .

[0055] in: Containing point The coordinates of the three vertices of the triangle in the parameter domain; Containing point The coordinates of the three vertices of the triangle in the parameter domain.

[0056] Calculate the centroid coordinates of the two parameter points relative to the triangle:

[0057] and satisfy

[0058] in: , , For point The centroid coordinate components (weights) relative to the three vertices of the triangle; , , For point The centroid coordinate components relative to the three vertices of the triangle in which it is located.

[0059] The parametric coordinates of the triangle vertices are converted into three-dimensional spatial coordinates by establishing a mapping relationship through harmonic mapping, and the position of the two-dimensional parametric coordinates in three-dimensional space is calculated by utilizing the affine invariance of harmonic mapping.

[0060] The obtained barycentric weights are applied to the corresponding 3D vertex coordinates, and the position of the point in 3D space is calculated. Utilizing the affine invariance of harmonic mapping, the barycentric weights remain consistent in the parameter domain and 3D space, and therefore can be directly used for 3D interpolation. Let the 3D vertex coordinates be... ,in Represents a vertex in three-dimensional space. Let its coordinates be given.

[0061] The three-dimensional positions corresponding to the two parameter points can be given by the following linear combinations:

[0062] in: For parameter points The corresponding three-dimensional spatial coordinates; For parameter points The corresponding three-dimensional spatial coordinates; , , These are the three-dimensional coordinates of the three vertices of the corresponding triangle (for example, for point...). , , , It refers to the three-dimensional coordinates of the three vertices of the triangle in which it is located.

[0063] To eliminate non-realistic intersection points caused by color noise, pixel resolution limitations, or parameter mapping errors, this invention performs distance determination on pairs of 3D points after restoring the 3D coordinates. When the Euclidean distance between two points satisfies... This means that the pixel pair can be considered to belong to the same real intersection region. The intersection point is considered valid if its average value is used; if the distance exceeds a threshold, it is considered noise or a non-genuine intersection feature and is discarded. Wherein: Point With point The Euclidean distance between them; γ is a preset distance threshold, for example, it can be 1% of the side length of the model bounding box (if the model bounding box is a cube and the side length is L, then γ=0.01L).

[0064] Connectivity analysis is performed on the obtained three-dimensional point set, and continuous three-dimensional intersection curves are constructed based on the spatial adjacency relationships between the points.

[0065] Through the aforementioned pairwise decoding, triangle positioning, centroid interpolation, and distance filtering processes, this step reliably recovers pixel-level intersection candidate information into a continuous set of 3D intersection points. Finally, based on the spatial adjacency relationships between the point sets (e.g., using Kruskal's minimum spanning tree algorithm or region growing algorithm), a continuous 3D intersection curve is constructed, such as... Figure 5 As shown. Alternatively, based on the triangular facet pair information where the intersection point pair is located, geometric intersection is performed on the triangular facet pair to calculate the precise intersection line segment, and then the intersection line segments are connected to form a continuous three-dimensional intersection curve.

[0066] This embodiment provides a 3D model intersection line extraction system based on color encoding and texture mapping to implement the above method. The system includes: Parametric Module: This module is used to parametrically map the 3D model, establishing the correspondence between parametric coordinates and 3D spatial coordinates. It can employ a discrete harmonic mapping algorithm to map the model surface to a unit square parametric domain and output the parametric mesh data.

[0067] Color Encoding Generation Module: This module generates color-coded textures, ensuring that different locations within the parameter field correspond to different color values. It divides the parameter field into a pixel grid according to a preset resolution, uses RGB channels for block encoding, and generates a bitmap texture file.

[0068] Rendering module: This module maps color-coded textures onto the model surface and performs off-screen rendering using the graphics processor to obtain the rendered image. It is configured to use nearest-neighbor sampling and off-screen framebuffer objects for rendering, disabling texture interpolation to ensure accurate color correspondences.

[0069] Intersection Detection Module: This module performs color difference analysis on the rendered image, detecting regions of color abrupt changes to identify intersection pixels. It is configured to allocate a thread to each pixel using a parallel computing architecture (such as CUDA, OpenCL, or ComputeShader) to compute the color difference between the pixel and its neighbors in parallel, thus filtering out candidate intersection pixels.

[0070] Coordinate Restoration Module: This module decodes the colors of the intersection pixels into parametric coordinates and converts them into 3D spatial coordinates to generate a 3D intersection line. It outputs a continuous intersection curve through barycentric coordinate interpolation and connectivity analysis.

[0071] The modules mentioned above can be deployed in software form on general-purpose computing devices, or integrated in hardware form (such as FPGA, ASIC) into graphics processing systems.

[0072] This embodiment provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program implements the three-dimensional model intersection line extraction method described in any of the above method embodiments. The storage medium includes, but is not limited to, ROM, RAM, magnetic disk, optical disk, solid-state drive (SSD), USB flash drive, etc. When the program in the storage medium is executed by one or more processors, the electronic device performs the following operations: parametric mapping of the three-dimensional model; generation of color-coded textures; execution of GPU off-screen rendering; detection of pixels with color abrupt changes; and decoding and reconstruction of the three-dimensional intersection lines.

[0073] To more clearly illustrate the technical solution of the present invention, a complete numerical calculation example is provided below.

[0074] This case simulates the intersection of a sphere (A) and a cube (B), demonstrating the complete numerical calculation process from parameterization to 3D coordinate reconstruction, with all data based on actual geometric relationships.

[0075] Given conditions: Sphere A: Center (0,0,0), radius R=1.0.

[0076] Cube B: Center (0,0,0.5), side length L=1.5, i.e., range x∈[-0.75,0.75], y∈[-0.75,0.75], z∈[0.125,0.875].

[0077] When the two intersect, the line of intersection is an approximation of a circle in space.

[0078] Step 1: Parametric mapping (completed offline; mapping result for a certain triangle is given below) Consider a triangle on the surface of a sphere, with the following 3D vertex coordinates: V1 = (0.58, 0.58, 0.58) (On a sphere, 0.58² + 0.58² + 0.58² = 1.009, approximately 1) V2=(0.58,0.58,-0.58) V3=(0.58,-0.58,0.58) Through discrete harmonic mapping, these three vertices are mapped to coordinates (unit square) in the parameter domain: P1=(0.6,0.7) P2=(0.6,0.8) P3=(0.5,0.7) Step 2: Color-coded texture generation Resolution N=1024, pixel block size 255×255, τ=16. Calculate the pixel coordinates corresponding to the parameter point (0.6, 0.7): x_pixel = floor(0.6 × 1024) = 614 y_pixel=floor(0.7×1024)=716 Block indices start from 0: Block 0 corresponds to pixel columns 0-254, Block 1 corresponds to 255-509, and Block 2 corresponds to 510-764. Therefore, the current pixel is located at block index 2, corresponding to block number n=3 (i.e., the 3rd pixel block). Intra-block offset: i = 614 - 2 × 255 = 104 j = 716 - 2 × 255 = 206 Color value (calculated according to the defined formula R=x+τ×(n-1): R = 16 + 16 × (3 - 1) = 16 + 32 = 48 G=i=104 B=j=206 Therefore, C(x,y)=(48,104,206). Similarly, the colors of the other points within the triangle can be calculated.

[0079] Step 3: Off-screen rendering Assuming that after rendering, a pair of candidate pixels are obtained at the intersection, one of which has a color of (48, 104, 206) and is decoded to (u=0.6, v=0.7).

[0080] Step 4: Intersection Pixel Detection Calculate the color difference between this pixel and its neighboring pixels. Assume the neighboring pixel is a point on the cube with color (112, 200, 50) (encoded from the cube's parameter domain). Calculate:

[0081] Since τ=16 and 194.3 is not an integer multiple of 16, it is determined to be a candidate for the intersection line.

[0082] Step 5: 3D coordinate reconstruction 5.1 Decoding parameter coordinates: It is known that (48, 104, 206) corresponds to (u=0.6, v=0.7), which has been obtained.

[0083] 5.2 Locating the Triangle: The point falls within the triangle formed by P1, P2, and P3. Solve the system of equations for the centroid coordinates:

[0084] From the first form: Substitute ,but .

[0085] Second move: .

[0086] Obtain the coordinates of the centroid .

[0087] 5.3 Calculating 3D Points: Utilizing Affine Invariance .

[0088] 5.4 Similarly, process another candidate pixel (from the cube), assuming we get Q = (0.57, 0.57, 0.59). Calculate the Euclidean distance: If the threshold γ = 0.05 (the average side length of the model is about 0.1 mm, so we take 0.01 times it), then if the value is less than the threshold, the effective intersection points are the average value (0.575, 0.575, 0.585).

[0089] 5.5 After collecting all valid intersections, use connectivity analysis (e.g., connecting based on pixel neighborhood relationships) to generate a continuous curve.

[0090] Results verification: The point (0.575, 0.575, 0.585) satisfies the equation of a sphere. Furthermore, z ≈ 0.585, which falls within the range of 0.125 to 0.875 for the cube; x and y are both 0.575, with absolute values ​​less than 0.75, indicating the point is inside the cube. Therefore, the point is indeed located on the intersection line.

[0091] It should be noted that the intersection point selected in this calculation example happens to be a vertex of the triangle, which simplifies the calculation of the centroid coordinates. In practical applications, the intersection line is usually located inside the triangle, and the centroid coordinates are not zero, but the principle of affine invariance is exactly the same. This example does not affect the understanding of the essence of the technical solution.

[0092] The following section elaborates on several application scenarios based on the core steps of this invention (parametric mapping, color encoding, off-screen rendering, intersection pixel detection, and 3D coordinate restoration).

[0093] Example 1: Boolean difference operation of engine block and piston in industrial CAD In automotive engine design, Boolean difference operations are required between the cylinder block model and the piston model to generate the combustion chamber. The cylinder block model contains approximately 2 million triangular faces, while the piston model contains approximately 800,000 triangular faces. Traditional geometric intersection methods often result in broken intersection lines due to floating-point errors, and the calculation time exceeds 10 seconds.

[0094] Detailed process of applying this invention: 1. Parametric Mapping: Perform normal-uniform topology cleanup on both the cylinder and piston models. Since both are topological disks (single-boundary manifolds), a discrete harmonic mapping is used to uniformly fix the boundary vertices on the four boundaries of the unit square [0,1]×[0,1] in topological order. Solve for the energy function. Find the minimum value to obtain the coordinates (u, v) of each vertex in the parameter domain. Establish a mapping table from parameter coordinates to 3D coordinates (correspondence between each triangle vertex).

[0095] 2. Color-coded Texture Generation: The resolution is set to N=4096 (high precision), dividing the parameter domain into a 4096×4096 pixel grid. Block encoding is used: each pixel block is 255×255 pixels, with a red channel increment τ=16. Cylinder models are assigned block numbers starting from 0, and piston models from 1000, ensuring no color space overlap. The RGB value of each pixel is uniquely mapped to its parameter coordinates. A bitmap file (.bmp) is generated and loaded as a texture onto the GPU.

[0096] 3. Off-screen rendering: Create an off-screen framebuffer object (FBO) in the GPU, map the color-coded texture to the parametric plane using nearest-neighbor sampling, and disable texture interpolation (GL_NEAREST). Set the orthographic camera viewport to 4096×4096. Render the cylinder and piston separately, but overlay them onto the same framebuffer (through different rendering layers or blending modes) to obtain a single rendered image containing both color codes.

[0097] 4. Intersection Pixel Detection: Upload the rendered image to CUDA memory and start 4096×4096 threads. Each thread reads pixels. and its right or lower neighbor pixels Calculate the color difference. For most pixels, ΔC is equal to 0 or an integer multiple of 16 (within the same model or adjacent blocks). However, in the region where the cylinder and piston intersect, the color jumps from the cylinder's encoding (lower red channel) to the piston's encoding (higher red channel), and ΔC is not equal to an integer multiple of 16. These pixel pairs are marked as intersection candidates and stored in the global buffer.

[0098] 5. 3D Coordinate Reconstruction: For each candidate pixel pair of intersection lines, decode to obtain the parameter coordinates (u, v). Locate the corresponding triangle based on the parameter domain triangular mesh, and solve the centroid coordinate system equations to obtain (u, v). , , Using the affine invariance of harmonic mapping, the barycentric coordinates are applied to the 3D vertex coordinates, and linear interpolation is used to obtain the 3D point P. The Euclidean distance is calculated for each pair of points; if it is less than 0.5 mm (the average side length of the cylinder model is approximately 1 mm, so γ = 0.5 mm), it is considered a valid intersection. All valid intersection points are collected, and a continuous 3D intersection curve is constructed using Kruskal's minimum spanning tree algorithm.

[0099] Results: The entire processing took approximately 0.45 seconds on an NVIDIA RTX 4090 GPU (including 0.1 seconds for rendering, 0.05 seconds for CUDA detection, and 0.3 seconds for coordinate restoration). The intersection lines were continuous and unbroken, making it directly applicable for face segmentation in Boolean operations. Traditional CPU methods (accelerated using AABB trees) required 11 seconds and involved multiple patching steps.

[0100] Example 2: Rapid generation of the intersection line between the model and the slicing plane in 3D printing Scenario Description: 3D printing slicing software needs to slice a model (e.g., a hollow vase containing 500,000 faces) into layers with a thickness of 0.1mm, generating approximately 2000 contour lines. Traditional methods calculate the intersection lines between the model and the plane layer by layer, which takes several minutes.

[0101] Detailed process of applying this invention: 1. Parametric Mapping: The vase model is a topological disk (opening upwards). Its surface is parameterized to a unit square [0,1]×[0,1]. Since the model's height direction (z-axis) corresponds to the v coordinate in the parameter domain, v=0 is mapped to the bottom of the vase, and v=1 is mapped to the mouth of the vase. A mapping between parametric coordinates and 3D coordinates is established.

[0102] 2. Color-coded Texture Generation: The model itself generates a color-coded texture with a resolution of 1024×1024. Block encoding (red channel increment τ=16) is used, giving each pixel a unique RGB color value, ensuring that every point on the model surface can be uniquely identified by color. Slice planes are not parameterized but treated as independent geometric shapes, assigned a pure white texture (R=255, G=255, B=255). All slice layers share the same white texture, but each slice layer is located at a different height in 3D space.

[0103] 3. Off-screen rendering: Utilizes GPU instantiation technology. For each slice layer (z-height), an orthographic camera is set up with its view plane parallel to the xy plane, and the camera position facing the model at the z-height. Rendering instructions for 2000 slice planes are submitted all at once, with each slice plane as a separate instance. In the fragment shader, the position of the white plane is dynamically adjusted based on the instance ID (i.e., layer number). Color-coded textures are used on the model surface. Depth testing is disabled during rendering, or a stencil buffer is used, causing a color transition (color → white) at the intersection of the model and the slice plane. The rendering result is saved as 2000 images (or a single texture array).

[0104] 4. Intersection Pixel Detection: CUDA detection is performed in parallel on all images. For each image, 1024×1024 threads are started to find the boundaries between pixels whose color is not white and white pixels. Specifically, ΔC is calculated between each pixel and its neighboring pixels. If ΔC is significantly greater than 0 and the white component is dominant, it is marked as a candidate intersection line. Since white is the only feature color (R=G=B=255), the detection rule can be simplified to: if the current pixel is colored and its neighboring pixels are white, or vice versa, it is determined to be an intersection line pixel.

[0105] 5. 3D Coordinate Reconstruction: Decode the color pixels to obtain the parameter coordinates (u,v), and then obtain the 3D point (x,y,z) through the inverse of the parameterized mapping (given the 3D coordinate mapping between u,v and the model). Since the slicing plane is manually defined, the parameter coordinates corresponding to the white pixels directly correspond to the slice height z (which can be calculated through the instance ID). Connect the 3D coordinates of the points on the intersection lines detected by each slice layer in sequence to output a closed contour line.

[0106] Results: Traditional layer-by-layer calculation takes about 3 minutes, while this invention utilizes GPU parallel rendering and pixel detection, with a total time of about 1.2 seconds (including 0.8 seconds of rendering, 0.2 seconds of detection, and 0.2 seconds of restoration), which is more than 100 times faster. Moreover, all contour lines are continuous and no post-processing is required.

[0107] Example 3: Calculation of the interface between the liver and tumor in medical images Scenario Description: In planning liver tumor resection surgery, it is necessary to obtain the interface between the liver and the tumor from the CT 3D reconstruction model to determine whether the tumor has invaded the liver capsule. The liver model has approximately 300,000 polygons, and the tumor model has approximately 50,000 polygons. Both meshes often contain a large number of non-manifold edges and degenerate triangles due to scanning noise, making traditional geometric methods prone to failure.

[0108] Detailed process of applying this invention: 1. Parametric Mapping: Topological cleanup is performed on the liver and tumor models separately, but small holes or non-manifold edges are allowed (this invention is insensitive to mesh quality). Discrete harmonic mapping is used to map both to their respective unit square parameter domains. Since the liver and tumor are independent models, they can be parameterized separately without guaranteeing the continuity of the parameter domain.

[0109] 2. Color-coded texture generation: Resolution N=2048. Block encoding, red channel increment τ=16. The liver model is assigned block numbers from 0 to 500, and the tumor model is assigned block numbers from 1000 to 1500, ensuring no color space overlap. Two independent color-coded textures are generated.

[0110] 3. Off-screen rendering: The liver and tumor are rendered sequentially within the same off-screen framebuffer object (or using multiple render targets). Because the texture coordinates of the two models are independent, they occupy different positions in the image during rendering. At the interface, the colors of the liver and tumor will be adjacent or overlap. By using the correct camera perspective (e.g., projecting from directly in front), the overlapping area of ​​the liver and tumor's projections in image space is precisely aligned with the actual contact surface in 3D space.

[0111] 4. Intersection Pixel Detection: Upload the rendered image to CUDA. Each thread calculates the ΔC between a pixel and its neighborhood. At locations where liver and tumor colors are adjacent, ΔC is typically not a multiple of 16 because these colors come from different coded blocks (with significant block number differences). Detect all transition pixel pairs.

[0112] 5. 3D Coordinate Reconstruction: For each candidate pixel pair of intersection lines, two parametric coordinates are decoded, belonging to the parameter domains of the liver and tumor respectively. The corresponding triangles are located, and the centroid coordinates are calculated. Affine invariance is used to obtain the 3D points P_liver and P_tumor. The distance between them is calculated; if it is less than a threshold (e.g., 1mm, with an average side length of 2mm in the model), the midpoint is taken as the point on the intersection interface. All points are collected, and a region growing algorithm is used to construct continuous curved intersection lines (actually spatial curves). Projecting the intersection lines back onto the liver surface yields the tumor invasion boundary.

[0113] Results: Even with non-manifold edges in the mesh, this invention can still stably extract continuous intersections in approximately 0.8 seconds. Traditional geometric methods suffer from algorithm crashes or multiple breaks due to degenerate triangles, requiring repairs to take over 5 minutes.

[0114] Example 4: Dynamic Collision Detection in Virtual Simulation and Game Development Scenario Description: In real-time gameplay, it's necessary to quickly determine the instant a bullet (complex shape, approximately 20,000 faces) hits an armored vehicle (approximately 50,000 faces) and extract the contact boundary to trigger an explosion effect. Traditional physics engines use bounding box coarse screening followed by precise triangle intersection, which incurs significant overhead for complex shapes and may miss some detections due to floating-point errors.

[0115] Detailed process of applying this invention: 1. Parametric Mapping (Offline Preprocessing): During the game resource loading phase, parametric mapping is performed on the bullet model and the armored vehicle model respectively. Normal unification and topology cleanup are performed on each model. Discrete harmonic mapping is used to map the model surface to a unit square [0,1]×[0,1] parameter domain, establishing the correspondence between parameter coordinates and 3D spatial coordinates. This step is performed only once, and the result is stored as model resource.

[0116] 2. Color-coded Texture Generation (Offline Preprocessing): Generate a fixed-resolution color-coded texture for each model. Set the resolution N=1024×1024, and divide the parameter domain into a pixel grid. Employ a block encoding strategy: divide the parameter domain into 255×255 pixel blocks, with a red channel increment τ=16, and assign a unique RGB color value to each pixel. Use different starting numbers for the color blocks for the bullet model and the armored vehicle model (e.g., bullets start from block 0, and armored vehicles start from block 1000) to ensure that their color encoding does not overlap. Generate a bitmap file (.bmp) and store it along with the model as a texture resource.

[0117] 3. Off-screen rendering (per frame at runtime): In each frame of the game, if the AABB coarse filter detects an intersection between the bullet and the armored vehicle's bounding box, precise intersection line extraction is triggered. An off-screen framebuffer object (FBO) with a resolution of 1024×1024 is created. The color-coded textures of the bullet and the armored vehicle are mapped to their respective parametric planes, and off-screen rendering is performed using the GPU. Both are superimposed onto the same framebuffer to obtain a rendered image containing both color codes. Since the two models may intersect in 3D space, the intersection area in the rendered image will show both colors simultaneously.

[0118] 4. Intersection Pixel Detection (per frame during runtime): The rendered image is uploaded to CUDA memory, and 1024×1024 threads are started. Each thread calculates the color difference between the current pixel and its neighboring pixels. When ΔC ≠ k·16 (where k is a natural number), it is marked as a candidate pixel pair for intersection. Since the color codes for bullets and armored vehicles come from different blocks, their difference is usually not an integer multiple of 16. The detection process can be completed within 0.5ms.

[0119] 5. 3D Coordinate Reconstruction (per frame during runtime): For each candidate pixel pair of intersection lines, decode the parametric coordinates (u, v). Locate the parametric domain triangle, calculate the centroid coordinates, and use the affine invariance of harmonic mapping to obtain the 3D spatial points P_bullet and P_vehicle. For paired points, if the Euclidean distance is less than the threshold γ (e.g., 1% of the average side length of the model), it is considered a valid intersection point. All valid intersection points are used as effect trigger positions to generate explosion particle effects or sound effects.

[0120] Results: The total collision detection time per frame is less than 1ms (including 0.3ms rendering, 0.2ms CUDA detection, and 0.4ms coordinate restoration), far faster than traditional precise intersection methods (5-10ms). Since all calculations are based on integer color comparisons, there are no floating-point errors, ensuring no small contact surfaces are missed in high-speed collisions. Special effects trigger accurately, resulting in a smooth player experience.

[0121] Example 5: Batch component interference detection in Building Information Modeling (BIM).

[0122] Scenario Description: In a large BIM model (e.g., a 30-story office building), there are approximately 5,000 independent components (beams, columns, pipes, ventilation ducts, etc.). All interfering component pairs need to be inspected to avoid construction conflicts. Traditional pairwise inspection has a complexity of O(N²), which is approximately 12.5 million pairs. Even if each pair is inspected within 1ms, it would still take 3.5 hours.

[0123] Detailed process of applying this invention: 1. Parametric Mapping: Each component is parametrically mapped individually. Since many components have simple shapes (cubes, cylinders), a fast parametric method (such as planar mapping) can be used. The parameter domains of all components are mapped to their respective unit squares, but there is no association between the parameter domains.

[0124] 2. Color-coded Texture Generation: A unique color code is assigned to each component. Using RGB three channels (24 bits), approximately 16 million different components can be distinguished. Specifically, the component ID is encoded into the color: R=(ID>>16)&0xFF, G=(ID>>8)&0xFF, B=ID&0xFF. For each component, a color-coded texture is generated, where the color of each pixel in the texture is equal to the component's unique ID color (rather than block encoding). This is a simplified scheme because the color is consistent within each component, but different components have different colors.

[0125] 3. Off-screen rendering: Render all components into a single image at once. Set an orthographic camera to cover the entire building area. Due to the large number of components, ensure the rendering order does not affect the result (disable depth testing or use color separation rendering). Each component uses its color ID texture during rendering. In the final rendered image, the color of each pixel represents the component ID corresponding to that pixel.

[0126] 4. Intersection Pixel Detection: Upload the rendered image to CUDA. Each thread checks if the current pixel has the same color as its neighboring pixels. If they are different (i.e., ΔC≠0), it means that the two pixels belong to different components, are adjacent in projection space, and that these two components may intersect or be very close in 3D space. Record the color pair (ID1, ID2) and the pixel position.

[0127] 5. 3D Coordinate Reconstruction: For each pair of different component IDs, there may be multiple intersecting pixels. However, since each component has a single color, decoding the parameter coordinates does not directly yield (u,v). Instead, it requires looking up the corresponding parameter coordinates on the component based on the pixel position. This necessitates maintaining a mapping table from pixel coordinates to component parameter domains (or writing to an additional buffer during rendering). A simpler method: When a color transition is detected, simultaneously record the pixel coordinates and depth, then obtain the points in 3D space through inverse projection transformation. Clustering these points allows determination of the interference location and the interference component pairs.

[0128] Results: Rendering time is independent of the number of components (only related to image resolution, e.g., 4096×4096), CUDA detection time is approximately 0.1 seconds, and post-processing clustering time is approximately 0.5 seconds. The total time is less than 1 second, enabling real-time detection of all interferences between 5000 components. Traditional methods require several hours.

[0129] Example 6: Boundary perception between vehicles and obstacles in autonomous driving Scenario Description: Autonomous vehicles need to perceive the safety boundaries of surrounding obstacles (other vehicles, pedestrians, roadblocks) and their own vehicles in real time, especially when meeting oncoming traffic or parking on narrow roads. Traditional methods rely on LiDAR point cloud processing or deep neural networks, which are computationally intensive and not accurate enough for edge details.

[0130] Detailed process of applying this invention: 1. Model Preparation: The vehicle model (precise 3D mesh, approximately 100,000 faces) is offline for parametric mapping and color-coded texture generation, with a resolution of 1024×1024. The obstacle model (reconstructed in real time via visual SLAM or predefined categories) is dynamically mapped parametrically (due to the simple shapes of the obstacles, fast planar mapping can be used).

[0131] 2. Color-coded Texture Generation (Online): The vehicle uses a fixed color code (e.g., red channel = 0, green and blue are coded in blocks). Each obstacle is assigned a temporary color ID (distinguished by the high bits of the blue channel), and the obstacle's own surface color is consistent (e.g., blue channel = obstacle ID). A single-color texture is quickly generated for each obstacle.

[0132] 3. Off-screen rendering: Create an FBO in the vehicle's GPU at a resolution of 1024×1024. Render the vehicle and all obstacles into the same image from a top-down (or surround-view) perspective. The vehicle is rendered using its tiled color texture, while obstacles use a single-color texture. Disabling depth testing makes all objects visible.

[0133] 4. Intersection Pixel Detection: A CUDA thread is started to calculate the ΔC between each pixel and its neighborhood in parallel. At points where the vehicle is in contact with or near an obstacle, a significant color transition occurs (vehicle's color vs. obstacle's single color). All candidate pixel pairs for intersections are detected.

[0134] 5. 3D coordinate reconstruction: Decode the parameter coordinates from the pixels on the side of the vehicle. Then, the contact points on the vehicle are calculated by interpolating the center of gravity coordinates. (Through barycentric coordinate interpolation). Decode the pixels on the obstacle side to obtain parameter coordinates. (If the obstacle is a single color, a 3D point needs to be calculated based on the pixel position and depth). Calculate the distance between two 3D points; if it is less than a safety threshold (e.g., 10cm), it is identified as a collision risk point. Mark all risk points on the vehicle model to trigger warnings or automatic braking.

[0135] 6. Real-time optimization: Since autonomous driving requires a frame rate >30Hz, this invention can be executed in a pipelined manner on the GPU: coordinate restoration of the previous frame and rendering of the current frame are performed in parallel. The threshold can be dynamically adjusted according to vehicle speed (increasing the safety distance at high speeds).

[0136] Results: On the NVIDIA Orin platform, processing 10 obstacles took approximately 2ms in total (0.5ms rendering, 0.3ms detection, and 1.2ms reconstruction), significantly faster than LiDAR point cloud processing (approximately 20ms). Furthermore, the edge detection accuracy for near-field obstacles reached centimeter level, outperforming purely vision-based solutions.

[0137] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for extracting intersection lines of a 3D model based on color encoding and texture mapping, characterized in that, include: The input 3D model is parametrically mapped to a regular 2D parameter domain, and the correspondence between parameter coordinates and 3D spatial coordinates is established. Generate a color-coded texture map with a fixed resolution, and assign a unique color value to each position in the parameter domain so that the color corresponds one-to-one with the position on the model surface; The color-coded texture is mapped onto the parameterized model surface as a texture, and off-screen rendering is performed using a graphics processor to obtain a rendered image that reflects the color distribution on the model surface. Pixel-level color analysis is performed on the rendered image to detect pixel regions in the image where color changes abruptly, and these regions are identified as candidate pixels for intersection lines of different models in the projection space. The color values ​​of the detected intersection candidate pixels are decoded into corresponding parameter coordinates according to the reverse mapping of the color encoding. Based on the correspondence between the parameter coordinates and the three-dimensional space coordinates, the decoded parameter coordinates are converted into points in the three-dimensional space, thereby generating the intersection lines of the three-dimensional model.

2. The method according to claim 1, characterized in that, The parametric mapping uses discrete harmonic mapping to map the surface of the 3D model to the unit square parameter domain, and fixes the model boundary vertices on the four boundaries of the unit square in topological order, thereby obtaining a non-overlapping and structurally stable parametric unfolding.

3. The method according to claim 1, characterized in that, The process of generating a fixed-resolution color-coded texture includes: dividing the parameter domain into a pixel grid, encoding using different component combinations of the RGB three color channels, so that each pixel grid point obtains a unique RGB triplet, and forming a strict bijective relationship between color and position within the parameter domain.

4. The method according to claim 3, characterized in that, The method for generating a fixed-resolution color-coded texture also includes: dividing the parameter domain into multiple pixel blocks, assigning different values ​​to different pixel blocks in the red channel, and assigning different values ​​to the green and blue channels in the same pixel block according to the row and column coordinates of the pixels, thereby constructing a one-to-one correspondence between color and parameter coordinates.

5. The method according to claim 1, characterized in that, The off-screen rendering includes: creating an off-screen frame buffer object in the graphics processor, mapping the color-coded texture to the parameterized plane using nearest-neighbor sampling, and disabling texture interpolation to ensure that the color of each rendered pixel strictly corresponds to the original color value in the parameter domain.

6. The method according to claim 1, characterized in that, The pixel regions in the detected image where color changes abruptly include: using the parallel computing architecture of the graphics processor, allocating an independent computing thread to each pixel in the rendered image, calculating the color difference between each pixel and its adjacent pixels in parallel, and marking the pixel pair as intersection candidate pixels when the color difference does not match the standard deviation determined by the color coding scheme.

7. The method according to claim 1, characterized in that, The process of converting the decoded parameter coordinates into points in three-dimensional space includes: positioning the decoded parameter coordinates within the corresponding triangles of the parameterized triangular mesh; calculating the centroid coordinates of the parameter point relative to the vertex of the triangle; then, utilizing the affine invariance of the parameterized mapping, directly applying the centroid coordinates to the corresponding three-dimensional vertex coordinates; obtaining the three-dimensional spatial position of the intersection point through linear interpolation; and finally, performing connectivity analysis on the obtained three-dimensional point set to generate a continuous three-dimensional intersection curve.

8. A system for extracting intersection lines of a 3D model based on color encoding and texture mapping, characterized in that, include: The parameterization module is used to perform parameterized mapping on the 3D model and establish the correspondence between parameter coordinates and 3D spatial coordinates. The color encoding generation module is used to generate color-encoded textures, so that different positions within the parameter field correspond to different color values. The rendering module is used to map color-coded textures onto the model surface and perform off-screen rendering using a graphics processor to obtain a rendered image. The intersection detection module is used to perform color difference analysis on the rendered image and detect color change regions to identify intersection pixels; The coordinate restoration module is used to decode the color of the intersection pixel into parametric coordinates and convert them into three-dimensional spatial coordinates to generate a three-dimensional intersection line.

9. The system according to claim 8, characterized in that, The rendering module is configured to use nearest neighbor sampling and off-screen frame buffer objects for rendering; the intersection detection module is configured to use a parallel computing architecture to calculate the color difference between each pixel and its neighboring pixels and filter out candidate pixels for intersection.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the three-dimensional model intersection extraction method as described in any one of claims 1 to 7.