CN107885912A - A kind of Fast Collision Detection Algorithm of magnanimity underground utilities - Google Patents

A kind of Fast Collision Detection Algorithm of magnanimity underground utilities Download PDF

Info

Publication number
CN107885912A
CN107885912A CN201711004000.9A CN201711004000A CN107885912A CN 107885912 A CN107885912 A CN 107885912A CN 201711004000 A CN201711004000 A CN 201711004000A CN 107885912 A CN107885912 A CN 107885912A
Authority
CN
China
Prior art keywords
pipeline
mrow
grid
msub
collision detection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711004000.9A
Other languages
Chinese (zh)
Other versions
CN107885912B (en
Inventor
周培龙
沈迎志
高健
蔡红
沈美岑
王方正
牛霆葳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Interstellar Space (tianjin) Technology Development Co Ltd
Original Assignee
Interstellar Space (tianjin) Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Interstellar Space (tianjin) Technology Development Co Ltd filed Critical Interstellar Space (tianjin) Technology Development Co Ltd
Priority to CN201711004000.9A priority Critical patent/CN107885912B/en
Publication of CN107885912A publication Critical patent/CN107885912A/en
Application granted granted Critical
Publication of CN107885912B publication Critical patent/CN107885912B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • G06F30/18Network design, e.g. design based on topological or interconnect aspects of utility systems, piping, heating ventilation air conditioning [HVAC] or cabling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2113/00Details relating to the application field
    • G06F2113/14Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/21Collision detection, intersection

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Geometry (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Graphics (AREA)
  • Software Systems (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, it is related to subsurface three-dimensional spatial data handling field, comprises the following steps:Intake pipeline data, body Model is generated for pipeline data;The division of pipe space grid;Construct collision detection task groups;Perform collision detection task;Collision detection task groups are traveled through, the collision result of the pipeline in each collision detection task groups with identical ID is merged, obtains the collision detection result of all pipelines in gamut.The present invention superiority be:According to information such as pipeline calibers, the body Models such as cylinder, cuboid are created for pipeline, reduce the complexity and data volume for creating the threedimensional models such as triangle grid model, relative to the method based on analytic geometry, in the case where not reducing the collision detection degree of accuracy, the computation complexity of collision detection is reduced.A large amount of distant obvious pipeline collision detections that collision is not present are removed using the method for establishing spatial grid, improve detection efficiency.

Description

A kind of Fast Collision Detection Algorithm of magnanimity underground utilities
Technical field
The present invention relates to subsurface three-dimensional spatial data handling field, more particularly to one kind is according to information such as pipeline calibers Pipeline creates the body Models such as cylinder, cuboid, on the one hand reduces the complexity for creating the threedimensional models such as triangle grid model With data volume, on the other hand relative to the method based on analytic geometry, in the case where not reducing the collision detection degree of accuracy, reduce The Fast Collision Detection Algorithms of the magnanimity underground utilities of the computation complexity of collision detection.
Background technology
City Buried Pipeline facility carries the vital task for maintaining city normal operation, but all kinds of underground utilities are buried It is intricate, thus find out the important informations such as the position of all kinds of underground utilities, attribute just turn into be related in all kinds of pipe engineerings One vital task.And when being pooled to per a kind of special pipelines on a drawing, just inevitably occur to synthesis The inspection problem of pipeline clash logic.Intersection-type collision for finding to exist in design drawing different structure generation in advance etc. is asked Topic, allows project planner's revisions on drawings before construction, with the progress for the engineering that avoids delay.With the high speed of economic society Development, Urbanization in China development have been enter into rapid growth period, and urban pipe network management work also has made great progress, but Due to history and the various reasons of reality, pressure management area still lags behind urban construction and development level, is objectively occurring so Situation:
(1) the number increase of various pipe network equipments, species are various, crisscross, cause daily management mission increasingly complicated, Many accident potential and operation risk are also increased simultaneously, the safe operation to pipe network brings stern challenge.
(2) as various data and the detection data of reconnoitring sharply increase, the management and maintenance to various pipeline data become More
Come more complicated, but traditional pressure management area means have the problem of a lot, as Back ground Information is not complete, data preserve Mode is backward, preserving precision, not high, data acquisition is low with renewal efficiency, information retrieval is inconvenient, day emergency episode is handled not in time Deng bringing inconvenience to manager and designer.
(3) in pipe network system, underground utilities occupy greatly, and its disguised and buried depth sets the rule to whole system Draw, design brings very big difficulty with management so that it is increasingly urgent to establish integrated pipe network information system.
The content of the invention
The embodiment of the present invention provides a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, and the inventive method solves root According to information such as pipeline calibers, the body Models such as cylinder, cuboid are created for pipeline, on the one hand reduce establishment triangle grid model Deng the complexity and data volume of threedimensional model, on the other hand relative to the method based on analytic geometry, collision detection is not being reduced In the case of the degree of accuracy, the computation complexity of collision detection is reduced.A large amount of distances are removed using the method for establishing spatial grid The obvious pipeline collision detection that collision is not present farther out, improves detection efficiency.One kind has been used to be cooperateed with based on CPU with GPU The method of calculating accelerates the pipeline collision detection task largely with identical operation process, so as to improve whole detection speed.
The embodiment of the present invention provides a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, and wherein this method includes as follows Step:
Intake pipeline data, body Model is generated for pipeline data:According to the pipeline data format of setting, the region model of setting Enclose, pipeline information is obtained from pipeline data file;It is that pipeline generates corresponding body Model according to pipeline information, and is body Model Calculate enclosure body;Count all pipeline enclosure body information;
The division of pipe space grid:Pipe space grid dimensional information is calculated, and utilizes pipeline body Model enclosure body letter Breath fills pipeline into spatial grid;Obtain the pipeline grid set in the range of designated area;
Construct collision detection task groups:Each pipeline grid to formulate in regional extent builds collision detection task-set Close, obtain all pending Detection task groups;
Perform collision detection task groups:Detect running environment and situation is supported to unified calculation equipment framework, if operation ring Unified Device framework is supported in border, then performs collision detection task by the way of central processing unit, graphics processor collaboration processing; If running environment is not supported to unifiedly calculate equipment framework, the parallel computation based on memory sharing is utilized in central processing unit Mode accelerates to perform collision detection task;
Merge collision detection result:Collision detection task groups are traveled through, will there is identical ID in each collision detection task groups The collision result of pipeline merge, obtain the collision detection result of all pipelines in gamut.
A kind of Fast Collision Detection Algorithm of magnanimity underground utilities, wherein the intake pipeline data, give birth to for pipeline data Comprise the following steps into body Model:
Obtain pipeline information:According to the pipeline data format of setting, pipeline information is obtained from pipeline data file;
Generate pipeline body Model:It is that pipeline generates according to the pipeline starting point coordinate of acquisition, termination point coordinates, caliber information Corresponding body Model:If caliber information is radius, cylinder body Model is generated for pipeline;If caliber information multiplies for the length of side Product, then generate cuboid body Model for pipeline;
Generate pipeline enclosure body:It is that pipeline generates according to the pipeline starting point coordinate of acquisition, termination point coordinates, caliber information Enclosure body;
Its calculation formula is:
Wherein:
X is pipeline coordinate X-axis component;Y is pipeline coordinate Y-axis component;Z is pipeline coordinate z-component;Subscript start generations Table pipeline starting point coordinate;Subscript end represents pipeline and terminates point coordinates;MIN is acquisition smaller value method;MAX is larger to obtain Value method;MAX { GJ } is to obtain the higher value in caliber, if caliber is radius, higher value is radius, if caliber is side Long product, then higher value is the higher value in the length of side;
Pipeline body Model enclosure body is calculated by formula:
Wherein:Xmin is enclosure body in X-direction minimum value;Xmax is enclosure body in X-direction maximum;Ymin is bag Containment body is in Y direction minimum value;Ymax is enclosure body in Y direction maximum;Zmin is enclosure body in Z-direction minimum value; Zmax is enclosure body in Z-direction maximum;
Count pipeline information:Pipeline enclosure body information is counted, all pipelines is obtained and takes up space scope.
A kind of Fast Collision Detection Algorithm of magnanimity underground utilities, wherein the division of the pipe space grid is including as follows Step:
Calculate spatial grid yardstick:Using pipeline information spatial grid yardstick is calculated according to formula;
Its formula is
Wherein:
Li is the i-th length of pipeline;GJi is the i-th pipeline pipe diameter size;N is pipeline number;
Calculated by formula:
Lx is spatial grid in X-direction scale size;Ly is spatial grid in Y direction scale size;Lz is space Grid is in Z-direction size;
Calculate pipeline starting mesh index:Using pipeline enclosure body information calculate pipeline take up space grid starting index, Its formula is:
Wherein:
Xmin is pipeline model minimum value in X-axis;Ymin is pipeline model minimum value in Y-axis;Zmin is pipeline mould Type minimum value on Z axis;Xmax is pipeline model maximum in X-axis;Ymax is pipeline model maximum in Y-axis;Zmax For pipeline model on Z axis maximum;Xo is pipeline grid starting point X-axis coordinate;Yo is pipeline grid starting point Y-axis coordinate; Zo is pipeline grid starting point Z axis coordinate;Lx is that pipeline grid plays X-direction size;Ly is that pipeline grid Y direction is big It is small;Lz is that pipeline grid plays Z-direction size;Calculated by formula:
Startx is that pipeline model bounding box occupies pipeline grid X-direction starting index;Endx surrounds for pipeline model Box occupies pipeline grid X-direction and terminates index;Starty is that pipeline model bounding box occupies pipeline grid Y direction starting rope Draw;Endy is that pipeline model bounding box occupies pipeline grid Y direction termination index;Startz is that pipeline model bounding box occupies Pipeline grid Z-direction starting index;Endz is that pipeline model bounding box occupies pipeline grid Z-direction termination index;
Travel through starting mesh index:The spatial grid starting index calculated in traversal formula (3), according to Grid Index meter Grid enclosure body is calculated, and collision detection is carried out with pipeline body Model:Judge that pipeline body Model is formed with grid enclosure body to intersect, The spatial grid Grid Index is then calculated by formula, and pipeline is filled into the set with identical Grid Index;Judge Pipeline body Model and grid enclosure body are non-intersect, then travel through spatial grid index;
Its formula is:
Grid=Gridz< < 48+Gridy< < 24+Gridx (4)
Wherein:
Gridz is Z-direction Grid Index;Gridy is Y direction Grid Index;Gridx is X-direction Grid Index;
Calculated by formula:Grid is the Grid Index of spatial grid;
Obtain pipeline grid set:All pipelines to be detected are handled successively, obtained in the range of designated area Pipeline grid set.
A kind of Fast Collision Detection Algorithm of magnanimity underground utilities, wherein the construction collision detection task groups are including as follows Step:
Create collision detection task groups:Single grid is obtained from the pipeline grid set in the range of designated area, is built The detection collision task groups of the single grid;
Build collision detection task:Two pipelines being not communicated with are taken out from pipeline grid, build collision detection task pair As, and task is added in task groups;
Obtain collision detection task groups set:Collision detection task groups are built to formulate all grid of regional extent, are obtained Obtain all pending Detection task group set.
A kind of Fast Collision Detection Algorithm of magnanimity underground utilities, wherein the execution collision detection task includes following step Suddenly:
Initialize running environment:Detect support of the graphics processor equipment to unified calculation equipment framework in running environment Situation;Judge whether to support unified calculation equipment framework, judge to support then to start unified calculation equipment schema object;Judgement is not propped up Hold, then host side accelerates to perform collision detection task groups using the parallel computation based on shared drive.
Transmit collision detection task groups set:The distributing equipment end video memory in graphics processor equipment, by task groups set Transmit into the video memory of equipment end;
Equipment end performs collision detection task:Start kernel objects, performing collision detection in graphics processor equipment end appoints Business;
Obtain collision detection result:Distribute main frame end memory, and the collision detection that will be performed in graphics processor equipment end As a result transmit into main frame end memory;
Empty data:Empty the video memory distributed in graphics processor equipment end;
Host side performs collision detection task:Judge performing environment, be determined as that performing environment is not supported to unifiedly calculate equipment Framework, then accelerate execution collision detection task groups using the parallel computation based on shared drive in host side.
A kind of Fast Collision Detection Algorithm of magnanimity underground utilities, include wherein the equipment end performs collision detection task Following steps:
Thread block obtains task group objects:The each thread block of image processor equipment end is according to thread block call number from task The collision detection task groups of manipulative indexing number are obtained in group set;
No. 0 thread calculates iterations:No. 0 index thread, is counted according to formula (5) in image processor equipment end thread block The iterations of each thread execution task is calculated,
Wherein calculation formula is:
Num=(taskSize+blockDim.x-1)/blockDim.x (5)
Wherein:
TaskSize is the number of tasks in each task block;BlockDim.x is the Thread Count possessed in each thread block;
Calculated and obtained by formula:
Num is the number of tasks that each thread need to calculate;
All thread synchronizations in thread block:All threads in image processor equipment end thread block are synchronized into processing, Each thread is set to obtain correct iterations;
Thread block thread calculating task indexes:Each thread is according to formula (6) in image processor equipment end thread block Calculate processing task index;
Its formula is:
TaskIdx=blockDim.x × proIdx+threadIdx.x (6)
Wherein:
BlockDim.x is the Thread Count possessed in thread block;ProIdx is the number of tasks that current thread has been handled; ThreadIdx.x indexes for current thread;
Calculated and obtained by formula:
TaskIdx is the task index of current thread processing;
Thread block thread performs collision detection:Each thread in image processor equipment end thread block is to Detection task In two pipelines carry out collision detection.
A kind of Fast Collision Detection Algorithm of magnanimity underground utilities, wherein the thread block thread performs collision detection bag Include following steps:
Bounding Box body filters:Judge whether the enclosure body of two pipelines intersects;If it is determined that enclosure body is non-intersect, then Judge that collision is not present in two pipelines;If Bounding Box body phase is handed over, collision detection is carried out according to pipeline body Model;
Cylinder body Model and cylinder body Model collision detection:Calculate the most short distance between two its center axis From, and judge whether beeline is more than two cylinder body Model radius sums;If beeline is more than radius sum, Judge that collision is not present in two cylinder body Models;If beeline is less than radius sum, two cylinder body moulds are judged Collision be present in type;
Cuboid body Model detects with cuboid model collision:Judge successively two cuboid body Models each face whether In the presence of collision;If collision is not present between rectangular dignity, judge that collision is not present in two cuboid body Models;It is if rectangular Collision between dignity be present, then judge that two cuboid body Models have collision;
Cuboid body Model and cylinder body Model collision detection:Calculate successively between each face of cuboid and cylinder Beeline, if beeline is more than cylinder radius, judge not deposit between cuboid body Model and cylinder body Model Colliding;If beeline is less than cylinder radius, judges to exist between cuboid body Model and cylinder body Model and touch Hit;
Write collision detection result:According to the collision detection result of pipeline body Model, pipeline collision detection result is write and touched Hit in Detection task.
A kind of Fast Collision Detection Algorithm of magnanimity underground utilities, wherein:The pipeline information includes:Pipeline is numbered, pipe Footpath, pipeline starting point coordinate, pipeline terminate point coordinates;The collision task groups include:Task group index, grid block index, appoints Business set.
As can be seen here:
The Fast Collision Detection Algorithm of magnanimity underground utilities in the embodiment of the present invention:Solve and believed according to pipeline caliber etc. Breath, the body Models such as cylinder, cuboid are created for pipeline, on the one hand reduces and creates answering for the threedimensional models such as triangle grid model Miscellaneous degree and data volume, on the other hand relative to the method based on analytic geometry, in the case where not reducing the collision detection degree of accuracy, Reduce the computation complexity of collision detection.Substantially it is not present using the method removal for establishing spatial grid is a large amount of distant The pipeline collision detection of collision, improves detection efficiency.A kind of method based on CPU and GPU cooperated computings has been used to accelerate big Measurer has the pipeline collision detection task of identical operation process, so as to improve whole detection speed.
Brief description of the drawings
Fig. 1 is the overall flow signal of the Fast Collision Detection Algorithm for the magnanimity underground utilities that embodiments of the invention provide Figure;
Input pipe line number in the Fast Collision Detection Algorithm for the magnanimity underground utilities that Fig. 2 provides for embodiments of the invention According to for the schematic flow sheet of pipeline data generation body Model step;
Pipe space grid in the Fast Collision Detection Algorithm for the magnanimity underground utilities that Fig. 3 provides for embodiments of the invention Partiting step schematic flow sheet;
Fig. 4 is to construct collision detection in the Fast Collision Detection Algorithm for the magnanimity underground utilities that embodiments of the invention provide The schematic flow sheet of task groups step;
Fig. 5 is to perform collision detection in the Fast Collision Detection Algorithm for the magnanimity underground utilities that embodiments of the invention provide The schematic flow sheet of task groups step;
Equipment end is performed and touched in the Fast Collision Detection Algorithm for the magnanimity underground utilities that Fig. 6 provides for embodiments of the invention Hit the schematic flow sheet of Detection task step;
Fig. 7 is the Fast Collision Detection Algorithm thread block thread for the magnanimity underground utilities that embodiments of the invention provide Perform the schematic flow sheet of collision detection step.
Embodiment
In order that those skilled in the art more fully understand the present invention program, below in conjunction with accompanying drawing and specific implementation Example describes the present invention in detail, and illustrative examples of the invention and explanation are used for explaining the present invention herein, but are not intended as Limitation of the invention.
Embodiment 1:Fig. 1 is the flow signal of the Fast Collision Detection Algorithm for the magnanimity underground utilities that the present embodiment provides Figure, as shown in figure 1, a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, this method comprise the following steps:
Intake pipeline data, body Model is generated for pipeline data:According to the pipeline data format of setting, the region model of setting Enclose, pipeline information is obtained from pipeline data file;It is that pipeline generates corresponding body Model according to pipeline information, and is body Model Calculate enclosure body;Count all pipeline enclosure body information;
The division of pipe space grid:Pipe space grid dimensional information is calculated, and utilizes pipeline body Model enclosure body letter Breath fills pipeline into spatial grid;Obtain the pipeline grid set in the range of designated area;
Construct collision detection task groups:Each pipeline grid to formulate in regional extent builds collision detection task-set Close, obtain all pending Detection task groups;
Perform collision detection task groups:Detect running environment and situation is supported to unified calculation equipment framework, if operation ring Unified Device framework is supported in border, then performs collision detection task by the way of central processing unit, graphics processor collaboration processing; If running environment is not supported to unifiedly calculate equipment framework, the parallel computation based on shared drive is utilized in central processing unit Mode accelerates to perform collision detection task;
Merge collision detection result:Collision detection task groups are traveled through, will there is identical ID in each collision detection task groups The collision result of pipeline merge, obtain the collision detection result of all pipelines in gamut.
As shown in Fig. 2 a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, the intake pipeline data, are pipeline Data generation body Model comprises the following steps:
Obtain pipeline information:According to the pipeline data format of setting, pipeline information is obtained from pipeline data file;
Generate pipeline body Model:It is that pipeline generates according to the pipeline starting point coordinate of acquisition, termination point coordinates, caliber information Corresponding body Model:If caliber information is radius, cylinder body Model is generated for pipeline;If caliber information multiplies for the length of side Product, then generate cuboid body Model for pipeline;
Generate pipeline enclosure body:It is that pipeline generates according to the pipeline starting point coordinate of acquisition, termination point coordinates, caliber information Enclosure body;
Its calculation formula is:
Wherein:
X is pipeline coordinate X-axis component;Y is pipeline coordinate Y-axis component;Z is pipeline coordinate z-component;Subscript start generations Table pipeline starting point coordinate;Subscript end represents pipeline and terminates point coordinates;MIN is acquisition smaller value method;MAX is larger to obtain Value method;MAX { GJ } is to obtain the higher value in caliber, if caliber is radius, higher value is radius, if caliber is side Long product, then higher value is the higher value in the length of side;
Pipeline body Model enclosure body is calculated by formula:
Wherein:Xmin is enclosure body in X-direction minimum value;Xmax is enclosure body in X-direction maximum;Ymin is bag Containment body is in Y direction minimum value;Ymax is enclosure body in Y direction maximum;Zmin is enclosure body in Z-direction minimum value; Zmax is enclosure body in Z-direction maximum;
Count pipeline information:Pipeline enclosure body information is counted, all pipelines is obtained and takes up space scope.
As shown in figure 3, a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, the division bag of the pipe space grid Include following steps:
Calculate spatial grid yardstick:Using pipeline information spatial grid yardstick is calculated according to formula;
Its formula is
Wherein:
Li is the i-th length of pipeline;GJi is the i-th pipeline pipe diameter size;N is pipeline number;
Calculated by formula:
Lx is spatial grid in X-direction scale size;Ly is spatial grid in Y direction scale size;Lz is space Grid is in Z-direction size;
Calculate pipeline starting mesh index:Using pipeline enclosure body information calculate pipeline take up space grid starting index, Its formula is:
Wherein:
Xmin is pipeline model minimum value in X-axis;Ymin is pipeline model minimum value in Y-axis;Zmin is pipeline mould Type minimum value on Z axis;Xmax is pipeline model maximum in X-axis;Ymax is pipeline model maximum in Y-axis;Zmax For pipeline model on Z axis maximum;Xo is pipeline grid starting point X-axis coordinate;Yo is pipeline grid starting point Y-axis coordinate; Zo is pipeline grid starting point Z axis coordinate;Lx is that pipeline grid plays X-direction size;Ly is that pipeline grid Y direction is big It is small;Lz is that pipeline grid plays Z-direction size;Calculated by formula:
Startx is that pipeline model bounding box occupies pipeline grid X-direction starting index;Endx surrounds for pipeline model Box occupies pipeline grid X-direction and terminates index;Starty is that pipeline model bounding box occupies pipeline grid Y direction starting rope Draw;Endy is that pipeline model bounding box occupies pipeline grid Y direction termination index;Startz is that pipeline model bounding box occupies Pipeline grid Z-direction starting index;Endz is that pipeline model bounding box occupies pipeline grid Z-direction termination index;
Travel through starting mesh index:The spatial grid starting index calculated in traversal formula (3), according to Grid Index meter Grid enclosure body is calculated, and collision detection is carried out with pipeline body Model:Judge that pipeline body Model is formed with grid enclosure body to intersect, The spatial grid Grid Index is then calculated by formula, and pipeline is filled into the set with identical Grid Index;Judge Pipeline body Model and grid enclosure body are non-intersect, then travel through spatial grid index;
Its formula is:
Grid=Gridz< < 48+Gridy< < 24+Gridx (4)
Wherein:
Gridz is Z-direction Grid Index;Gridy is Y direction Grid Index;Gridx is X-direction Grid Index;
Calculated by formula:Grid is the Grid Index of spatial grid;
Obtain pipeline grid set:All pipelines to be detected are handled successively, obtained in the range of designated area Pipeline grid set.
As shown in figure 4, a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, the construction collision detection task groups bag Include following steps:
Create collision detection task groups:Single grid is obtained from the pipeline grid set in the range of designated area, is built The detection collision task groups of the single grid;
Build collision detection task:Two pipelines being not communicated with are taken out from pipeline grid, build collision detection task pair As, and task is added in task groups;
Obtain collision detection task groups set:Collision detection task groups are built to formulate all grid of regional extent, are obtained Obtain all pending Detection task group set.
As shown in figure 5, a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, the execution collision detection task groups bag Include following steps:
Initialize running environment:Detect support of the graphics processor equipment to unified calculation equipment framework in running environment Situation;Judge whether to support unified calculation equipment framework, judge to support then to start unified calculation equipment schema object;Judgement is not propped up Hold, then accelerate to perform collision detection task using the parallel computation mode based on memory sharing in central processing unit;
Transmit collision detection task groups set:The distributing equipment end video memory in graphics processor equipment, by task groups set Transmit into the video memory of equipment end;
Equipment end performs collision detection task:Start kernel objects, performing collision detection in graphics processor equipment end appoints Business;
Obtain collision detection result:Distribute main frame end memory, and the collision detection that will be performed in graphics processor equipment end As a result transmit into main frame end memory;
Empty data:Empty the video memory distributed in graphics processor equipment end;
Host side performs collision detection task:Judge performing environment, be determined as that performing environment is not supported to unifiedly calculate equipment Framework, then accelerate execution collision detection task groups using the parallel calculating method based on shared drive in host side.
As shown in fig. 6, a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, the equipment end performs collision detection and appointed Business comprises the following steps:
Thread block obtains task group objects:The each thread block of image processor equipment end is according to thread block call number from task The collision detection task groups of manipulative indexing number are obtained in group set;
No. 0 thread calculates iterations:No. 0 index thread, is counted according to formula (5) in image processor equipment end thread block The iterations of each thread execution task is calculated,
Wherein calculation formula is:
Num=(taskSize+blockDim.x-1)/blockDim.x (5)
Wherein:
TaskSize is the number of tasks in each task block;BlockDim.x is the Thread Count possessed in each thread block;
Calculated and obtained by formula:
Num is the number of tasks that each thread need to calculate;
All thread synchronizations in thread block:All threads in image processor equipment end thread block are synchronized into processing, Each thread is set to obtain correct iterations;
Thread block thread calculating task indexes:Each thread is according to formula (6) in image processor equipment end thread block Calculate processing task index;
Its formula is:
TaskIdx=blockDim.x × proIdx+threadIdx.x (6)
Wherein:
BlockDim.x is the Thread Count possessed in thread block;ProIdx is the number of tasks that current thread has been handled; ThreadIdx.x indexes for current thread;
Calculated and obtained by formula:
TaskIdx is the task index of current thread processing;
Thread block thread performs collision detection:Each thread in image processor equipment end thread block is to Detection task In two pipelines carry out collision detection.
As shown in fig. 7, a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, the thread block thread perform collision Detection comprises the following steps:
Bounding Box body filters:Judge whether the enclosure body of two pipelines intersects;If it is determined that enclosure body is non-intersect, then Judge that collision is not present in two pipelines;If Bounding Box body phase is handed over, collision detection is carried out according to pipeline body Model;
Cylinder body Model and cylinder body Model collision detection:Calculate the most short distance between two its center axis From, and judge whether beeline is more than two cylinder body Model radius sums;If beeline is more than radius sum, Judge that collision is not present in two cylinder body Models;If beeline is less than radius sum, two cylinder body moulds are judged Collision be present in type;
Cuboid body Model detects with cuboid model collision:Judge successively two cuboid body Models each face whether In the presence of collision;If collision is not present between rectangular dignity, judge that collision is not present in two cuboid body Models;It is if rectangular Collision between dignity be present, then judge that two cuboid body Models have collision;
Cuboid body Model and cylinder body Model collision detection:Calculate successively between each face of cuboid and cylinder Beeline, if beeline is more than cylinder radius, judge not deposit between cuboid body Model and cylinder body Model Colliding;If beeline is less than cylinder radius, judges to exist between cuboid body Model and cylinder body Model and touch Hit;
Write collision detection result:According to the collision detection result of pipeline body Model, pipeline collision detection result is write and touched Hit in Detection task.
It is embodied in case, the pipeline information includes:Pipeline is numbered, caliber, pipeline starting point coordinate, and pipeline terminates Point coordinates;The collision task groups include:Task group index, grid block index, set of tasks.
It is described below with a concrete case:
Magnanimity Underground Pipeline Data is carried out quickly using this method to elaborate with a specific implementation case below Collision detection.Magnanimity communication pipe line number evidence, power pipeline data, water-supply line data, flowing line can be realized using method The Fast Collision Detection of the pipeline data such as data, burning line data, heating pipeline data, industrial pipeline data.
Obtain the underground communication pipeline data in somewhere, power pipeline data, water-supply line data, flowing line data, The pipeline data such as burning line data, heating pipeline data, industrial pipeline data;According to the pipeline data format of setting, from pipe Pipeline information is obtained in line data file, wherein pipeline information includes:Pipeline numbering, caliber, pipeline starting point coordinate, pipeline are whole Stop coordinate;The body Model according to corresponding to the pipeline starting point coordinate of acquisition, termination point coordinates, caliber information are pipeline generation: If caliber information is radius, cylinder body Model is generated for pipeline, if caliber information is length of side product, is given birth to for pipeline Into cuboid body Model;It is that pipeline generates enclosure body according to the pipeline starting point coordinate of acquisition, termination point coordinates, caliber information, And count all pipeline enclosure body information.
All pipeline enclosure body information obtained according to statistics, spatial grid dimensional information is calculated, obtain pipe space lattice Net is in X-axis, Y-axis, the scale size of Z-direction;Utilize pipeline enclosure body and pipeline grid dimensional information, starting point coordinate meter Calculate pipeline crossover line grid start-stop call number;Traversal pipeline crosses over Grid Index, utilizes Grid Index and grid yardstick, starting Point coordinates obtains grid enclosure body, and carries out collision detection with pipeline body Model:If pipeline body Model and grid enclosure body phase Hand over, then the spatial grid index is calculated by formula, and pipeline is filled into the set with identical Grid Index;If pipe Wire body model is not desired to hand over grid enclosure body, then travels through spatial grid index;Said process is repeated, until by all pipelines Added in the grid of manipulative indexing, obtain carry out spatial grid division pipeline dataset close, so as to remove it is distant, The obvious situation that collision is not present, so as to improve detection efficiency.
From the grid set of division grid, single Grid square is obtained, and collision detection task groups are created for the grid Object;Then different ID two pipeline data are obtained from the grid set, are two pipeline data creations, one collision inspection Task object is surveyed, and is added in the collision detection task group objects of the grid;Said process is repeated, until being all grid Set creates collision detection task group objects, so as to obtain all pending collision detection task groups object sets.
Because the set of tasks in pending collision detection task groups object set and collision detection task groups has Same or similar operational process, therefore can be by improving the efficiency of collision detection parallel.Due to the spy of graphics processor Different framework, it provides new solution for many original insoluble problems, this method employ graphics processor with The method of central processing unit collaboration processing, collision detection efficiency is improved using the computation capability of graphics processor.Sentence first Determine support situation of the graphics processor to unified calculation equipment framework:If graphics processor supports unified calculation equipment framework, The mode of CPU, GPU collaboration processing is taken to accelerate collision detection process;If graphics processor is not supported to unifiedly calculate equipment framework, Collision detection process is then accelerated using the parallel calculating method based on shared drive at CPU ends.
During processing collision detection is cooperateed with based on CPU, GPU, central processing unit end initializes unified calculation first Equipment framework kernel objects;Then video memory object, and the collision detection task groups pair that will be got are distributed in graphics processor As set is transmitted into video memory;Finally start kernel objects, specific collision detection task is performed at graphics processor end;Treat institute After the completion of having collision detection tasks carrying, central processing unit obtains collision detection task testing result from graphics processor, and The collision result of pipeline with identical ID is merged, so as to obtain the collision situation of all pipelines.In graphics processor When end performs specific collision detection task, each thread block obtains the collision with identical ID from video memory by self ID and examined Survey task group objects;Then No. 0 thread is pressed according to task number in thread block number of threads and collision detection task group objects The pending Detection task number of each thread is calculated according to formula;Thread in thread block is synchronized, so as to each line Journey obtains the task number that oneself should be performed, then obtained according to the Thread Id of itself from task group objects corresponding to collide inspection Survey task simultaneously performs, and writes back testing result after the completion of execution.
During collision detection is handled based on the parallel calculating method of central processing unit shared drive, obtaining first can The number of threads used, and calculate the task groups object number that each thread should perform;Then corresponding to each thread performs Collision detection task, and testing result is write back.
Finally, will be fetched by the collision detection result accelerated parallel, and by the collision result of the pipeline with identical ID Merge, so as to obtain the correct collision detection result of all pipelines.
As can be seen here:The Fast Collision Detection Algorithm of magnanimity underground utilities in the embodiment of the present invention:Solve according to pipe The information such as spool footpath, the body Models such as cylinder, cuboid are created for pipeline, on the one hand reduces and creates triangle grid model etc. three The complexity and data volume of dimension module, on the other hand relative to the method based on analytic geometry, not reducing, collision detection is accurate In the case of degree, the computation complexity of collision detection is reduced.Removed using the method for establishing spatial grid a large amount of distant The obvious pipeline collision detection that collision is not present, improve detection efficiency.One kind has been used based on CPU and GPU cooperated computings Method accelerate largely have identical operation process pipeline collision detection tasks, so as to improve whole detection speed.
Although depicting the embodiment of the present invention by embodiment, it will be appreciated by the skilled addressee that the present invention has many Deformation and change are without departing from spirit of the invention, it is desirable to which appended claim includes these deformations and changed without departing from originally The spirit of invention.

Claims (8)

1. a kind of Fast Collision Detection Algorithm of magnanimity underground utilities, it is characterised in that this method comprises the following steps:
Intake pipeline data, body Model is generated for pipeline data:According to the pipeline data format of setting, setting regional extent, Pipeline information is obtained from pipeline data file;It is that pipeline generates corresponding body Model according to pipeline information, and is body Model meter Calculate enclosure body;Count all pipeline enclosure body information;
The division of pipe space grid:Pipe space grid dimensional information is calculated, and will using pipeline body Model enclosure body information Pipeline is filled into spatial grid;Obtain the pipeline grid set in the range of designated area;
Construct collision detection task groups:Each pipeline grid to formulate in regional extent builds collision detection set of tasks, obtains Obtain all pending Detection task groups;
Perform collision detection task:Detect running environment and situation is supported to unified calculation equipment framework, when running environment is supported to unite One equipment framework, collision detection task is performed by the way of central processing unit, graphics processor collaboration processing;Work as running environment Do not support to unifiedly calculate equipment framework, accelerate to perform using the parallel computation based on shared drive in central processing unit and collide inspection Survey task;
Merge collision detection result:Collision detection task groups are traveled through, will there is identical ID pipe in each collision detection task groups The collision result of line merges, and obtains the collision detection result of all pipelines in gamut.
2. the Fast Collision Detection Algorithm of a kind of magnanimity underground utilities according to claim 1, it is characterised in that described defeated Enter pipeline data, generating body Model for pipeline data comprises the following steps:
Obtain pipeline information:According to the pipeline data format of setting, pipeline information is obtained from pipeline data file;
Generate pipeline body Model:It is that pipeline generation is corresponding according to the pipeline starting point coordinate of acquisition, termination point coordinates, caliber information Body Model, judge caliber information be radius, then be pipeline generation cylinder body Model;Judge that caliber information is length of side product, Then cuboid body Model is generated for pipeline;
Generate pipeline enclosure body:It is that pipeline generation is surrounded according to the pipeline starting point coordinate of acquisition, termination point coordinates, caliber information Body;
Its calculation formula is:
<mrow> <mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mrow> <mi>X</mi> <mi>min</mi> <mo>=</mo> <mi>M</mi> <mi>I</mi> <mi>N</mi> <mrow> <mo>(</mo> <mi>X</mi> <mi>s</mi> <mi>t</mi> <mi>a</mi> <mi>r</mi> <mi>t</mi> <mo>,</mo> <mi>X</mi> <mi>e</mi> <mi>n</mi> <mi>d</mi> <mo>)</mo> </mrow> <mo>-</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mo>{</mo> <mi>G</mi> <mi>J</mi> <mo>}</mo> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>X</mi> <mi>max</mi> <mo>=</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mrow> <mo>(</mo> <mi>X</mi> <mi>s</mi> <mi>t</mi> <mi>a</mi> <mi>r</mi> <mi>t</mi> <mo>,</mo> <mi>X</mi> <mi>e</mi> <mi>n</mi> <mi>d</mi> <mo>)</mo> </mrow> <mo>+</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mo>{</mo> <mi>G</mi> <mi>J</mi> <mo>}</mo> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>Y</mi> <mi>min</mi> <mo>=</mo> <mi>M</mi> <mi>I</mi> <mi>N</mi> <mrow> <mo>(</mo> <mi>Y</mi> <mi>s</mi> <mi>t</mi> <mi>a</mi> <mi>r</mi> <mi>t</mi> <mo>,</mo> <mi>Y</mi> <mi>e</mi> <mi>n</mi> <mi>d</mi> <mo>)</mo> </mrow> <mo>-</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mo>{</mo> <mi>G</mi> <mi>J</mi> <mo>}</mo> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>Y</mi> <mi>max</mi> <mo>=</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mrow> <mo>(</mo> <mi>Y</mi> <mi>s</mi> <mi>t</mi> <mi>a</mi> <mi>r</mi> <mi>t</mi> <mo>,</mo> <mi>Y</mi> <mi>e</mi> <mi>n</mi> <mi>d</mi> <mo>)</mo> </mrow> <mo>+</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mo>{</mo> <mi>G</mi> <mi>J</mi> <mo>}</mo> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>Z</mi> <mi>min</mi> <mo>=</mo> <mi>M</mi> <mi>I</mi> <mi>N</mi> <mrow> <mo>(</mo> <mi>Z</mi> <mi>s</mi> <mi>t</mi> <mi>a</mi> <mi>r</mi> <mi>t</mi> <mo>,</mo> <mi>Z</mi> <mi>e</mi> <mi>n</mi> <mi>d</mi> <mo>)</mo> </mrow> <mo>-</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mo>{</mo> <mi>G</mi> <mi>J</mi> <mo>}</mo> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>Z</mi> <mi>max</mi> <mo>=</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mrow> <mo>(</mo> <mi>Z</mi> <mi>s</mi> <mi>t</mi> <mi>a</mi> <mi>r</mi> <mi>t</mi> <mo>,</mo> <mi>Z</mi> <mi>e</mi> <mi>n</mi> <mi>d</mi> <mo>)</mo> </mrow> <mo>+</mo> <mi>M</mi> <mi>A</mi> <mi>X</mi> <mo>{</mo> <mi>G</mi> <mi>J</mi> <mo>}</mo> </mrow> </mtd> </mtr> </mtable> </mfenced> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>1</mn> <mo>)</mo> </mrow> </mrow>
Wherein:
X is pipeline coordinate X-axis component;Y is pipeline coordinate Y-axis component;Z is pipeline coordinate z-component;Subscript start represents pipe Line starting point coordinate;Subscript end represents pipeline and terminates point coordinates;MIN is acquisition smaller value method;MAX is acquisition higher value side Method;MAX { GJ } is to obtain the higher value in caliber, if caliber is radius, higher value is radius, if caliber multiplies for the length of side Product, then higher value is the higher value in the length of side;
Pipeline body Model enclosure body is calculated by formula:
Wherein:Xmin is enclosure body in X-direction minimum value;Xmax is enclosure body in X-direction maximum;Ymin is enclosure body In Y direction minimum value;Ymax is enclosure body in Y direction maximum;Zmin is enclosure body in Z-direction minimum value;Zmax It is enclosure body in Z-direction maximum;
Count pipeline information:Pipeline enclosure body information is counted, all pipelines is obtained and takes up space scope.
A kind of 3. Fast Collision Detection Algorithm of magnanimity underground utilities according to claim 1, it is characterised in that the pipe The division of space of lines grid comprises the following steps:
Calculate spatial grid yardstick:Using pipeline information spatial grid yardstick is calculated according to formula;
Its formula is
<mrow> <mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mrow> <msub> <mi>L</mi> <mi>x</mi> </msub> <mo>=</mo> <mn>2</mn> <mo>&amp;times;</mo> <mfrac> <mrow> <munderover> <mo>&amp;Sigma;</mo> <mrow> <mi>i</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>n</mi> </munderover> <msub> <mi>L</mi> <mi>i</mi> </msub> </mrow> <mi>n</mi> </mfrac> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <msub> <mi>L</mi> <mi>y</mi> </msub> <mo>=</mo> <mn>2</mn> <mo>&amp;times;</mo> <mfrac> <mrow> <munderover> <mo>&amp;Sigma;</mo> <mrow> <mi>i</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>n</mi> </munderover> <msub> <mi>L</mi> <mi>i</mi> </msub> </mrow> <mi>n</mi> </mfrac> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <msub> <mi>L</mi> <mi>z</mi> </msub> <mo>=</mo> <mn>10</mn> <mo>&amp;times;</mo> <mfrac> <mrow> <munderover> <mo>&amp;Sigma;</mo> <mrow> <mi>i</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>n</mi> </munderover> <msub> <mi>GJ</mi> <mi>i</mi> </msub> </mrow> <mi>n</mi> </mfrac> </mrow> </mtd> </mtr> </mtable> </mfenced> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>2</mn> <mo>)</mo> </mrow> </mrow>
Wherein:
Li is the i-th length of pipeline;GJi is the i-th pipeline pipe diameter size;N is pipeline number;
Calculated by formula:
Lx is spatial grid in X-direction scale size;Ly is spatial grid in Y direction scale size;Lz is spatial grid In Z-direction size;
Calculate pipeline starting mesh index:Pipeline is calculated using pipeline enclosure body information to take up space grid starting index, it is public Formula is:
<mrow> <mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mrow> <msub> <mi>Start</mi> <mi>x</mi> </msub> <mo>=</mo> <mrow> <mo>(</mo> <msub> <mi>X</mi> <mrow> <mi>m</mi> <mi>i</mi> <mi>n</mi> </mrow> </msub> <mo>-</mo> <msub> <mi>X</mi> <mi>o</mi> </msub> <mo>)</mo> </mrow> <mo>/</mo> <msub> <mi>L</mi> <mi>x</mi> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <msub> <mi>End</mi> <mi>x</mi> </msub> <mo>=</mo> <mrow> <mo>(</mo> <msub> <mi>X</mi> <mrow> <mi>m</mi> <mi>a</mi> <mi>x</mi> </mrow> </msub> <mo>-</mo> <msub> <mi>X</mi> <mi>o</mi> </msub> <mo>)</mo> </mrow> <mo>/</mo> <msub> <mi>L</mi> <mi>x</mi> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <msub> <mi>Start</mi> <mi>y</mi> </msub> <mo>=</mo> <mrow> <mo>(</mo> <msub> <mi>Y</mi> <mi>min</mi> </msub> <mo>-</mo> <msub> <mi>Y</mi> <mi>o</mi> </msub> <mo>)</mo> </mrow> <mo>/</mo> <msub> <mi>L</mi> <mi>y</mi> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <msub> <mi>End</mi> <mi>y</mi> </msub> <mo>=</mo> <mrow> <mo>(</mo> <msub> <mi>Y</mi> <mi>max</mi> </msub> <mo>-</mo> <msub> <mi>Y</mi> <mi>o</mi> </msub> <mo>)</mo> </mrow> <mo>/</mo> <msub> <mi>L</mi> <mi>y</mi> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <msub> <mi>Start</mi> <mi>z</mi> </msub> <mo>=</mo> <mrow> <mo>(</mo> <msub> <mi>Z</mi> <mrow> <mi>m</mi> <mi>i</mi> <mi>n</mi> </mrow> </msub> <mo>-</mo> <msub> <mi>Z</mi> <mi>o</mi> </msub> <mo>)</mo> </mrow> <mo>/</mo> <msub> <mi>L</mi> <mi>z</mi> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <msub> <mi>End</mi> <mi>z</mi> </msub> <mo>=</mo> <mrow> <mo>(</mo> <msub> <mi>Z</mi> <mrow> <mi>m</mi> <mi>a</mi> <mi>x</mi> </mrow> </msub> <mo>-</mo> <msub> <mi>Z</mi> <mi>o</mi> </msub> <mo>)</mo> </mrow> <mo>/</mo> <msub> <mi>L</mi> <mi>z</mi> </msub> </mrow> </mtd> </mtr> </mtable> </mfenced> <mo>-</mo> <mo>-</mo> <mo>-</mo> <mrow> <mo>(</mo> <mn>3</mn> <mo>)</mo> </mrow> </mrow>
Wherein:
Xmin is pipeline model minimum value in X-axis;Ymin is pipeline model minimum value in Y-axis;Zmin is pipeline model in Z Minimum value on axle;Xmax is pipeline model maximum in X-axis;Ymax is pipeline model maximum in Y-axis;Zmax is pipeline Model maximum on Z axis;Xo is pipeline grid starting point X-axis coordinate;Yo is pipeline grid starting point Y-axis coordinate;Zo is pipe Line grid starting point Z axis coordinate;Lx is that pipeline grid plays X-direction size;Ly is that pipeline grid plays Y direction size;Lz is Pipeline grid plays Z-direction size;Calculated by formula:
Startx is that pipeline model bounding box occupies pipeline grid X-direction starting index;Endx is that pipeline model bounding box accounts for Terminate and index according to pipeline grid X-direction;Starty is that pipeline model bounding box occupies pipeline grid Y direction starting index; Endy is that pipeline model bounding box occupies pipeline grid Y direction termination index;Startz is that pipeline model bounding box occupies pipe Line grid Z-direction starting index;Endz is that pipeline model bounding box occupies pipeline grid Z-direction termination index;
Travel through starting mesh index:The spatial grid starting index calculated in traversal formula (3), is calculated according to Grid Index Grid enclosure body, and carry out collision detection with pipeline body Model:Judge that pipeline body Model is formed with grid enclosure body to intersect, then lead to Cross formula and calculate the spatial grid Grid Index, and pipeline is filled into the set with identical Grid Index;Judge pipeline Body Model and grid enclosure body are non-intersect, then travel through spatial grid index;
Its formula is:
Grid=Gridz< < 48+Gridy< < 24+Gridx (4)
Wherein:
Gridz is Z-direction Grid Index;Gridy is Y direction Grid Index;Gridx is X-direction Grid Index;
Calculated by formula:Grid is the Grid Index of spatial grid;
Obtain pipeline grid set:All pipelines to be detected are handled successively, obtain the pipeline in the range of designated area Grid set.
A kind of 4. Fast Collision Detection Algorithm of magnanimity underground utilities according to claim 1,3, it is characterised in that:It is described Construction collision detection task groups comprise the following steps:
Create collision detection task groups:Single grid is obtained from the pipeline grid set in the range of designated area, builds the list The detection collision task groups of one grid;
Build collision detection task:Two pipelines being not communicated with are taken out from pipeline grid, build collision detection task object, and Task is added in task groups;
Obtain collision detection task groups set:Collision detection task groups are built to formulate all grid of regional extent, obtain institute There is pending Detection task group set.
A kind of 5. Fast Collision Detection Algorithm of magnanimity underground utilities according to claim 1, it is characterised in that:It is described to hold Row collision detection appoints group to include following steps:
Initialize running environment:Detect support feelings of the graphics processor equipment in running environment to unified calculation equipment framework Condition;Judge whether to support unified calculation equipment framework, judge to support then to start unified calculation equipment schema object;Judgement is not propped up Hold, then accelerate execution collision detection task groups using the parallel computation based on shared drive in host side;
Transmit collision detection task groups set:The distributing equipment end video memory in graphics processor equipment, task groups set is transmitted Into the video memory of equipment end;
Equipment end performs collision detection task:Start kernel objects, collision detection task is performed in graphics processor equipment end;
Obtain collision detection result:Distribute main frame end memory, and the collision detection result that will be performed in graphics processor equipment end Transmit into main frame end memory;
Empty data:Empty the video memory distributed in graphics processor equipment end;
Host side performs collision detection task:Judge performing environment, be determined as that performing environment is not supported to unifiedly calculate equipment framework, Then accelerate execution collision detection task groups using the parallel computation based on shared drive in host side.
A kind of 6. Fast Collision Detection Algorithm of magnanimity underground utilities according to claim 1,5, it is characterised in that:It is described Equipment end performs collision detection task and comprised the following steps:
Thread block obtains task group objects:The each thread block of image processor equipment end is according to thread block call number from task groups collection The collision detection task groups of manipulative indexing number are obtained in conjunction;
No. 0 thread calculates iterations:No. 0 index thread, is calculated according to formula (5) in image processor equipment end thread block The iterations of each thread execution task,
Wherein calculation formula is:
Num=(taskSize+blockDim.x-1)/blockDim.x (5)
Wherein:
TaskSize is the task number in each task groups;BlockDim.x is the number of threads possessed in each thread block;
Calculated and obtained by formula:
Num is the task number that each thread need to calculate;
All thread synchronizations in thread block:All threads in image processor equipment end thread block are synchronized into processing, made every Individual thread obtains correct iterations;
Thread block thread calculating task indexes:Each thread calculates according to formula (6) in image processor equipment end thread block Go out processing task index;
Its formula is:
TaskIdx=blockDim.x × proIdx+threadIdx.x (6)
Wherein:
BlockDim.x is the Thread Count possessed in thread block;ProIdx is the number of tasks that current thread has been handled; ThreadIdx.x indexes for current thread;
Calculated and obtained by formula:
TaskIdx is the task index of current thread processing;
Thread block thread performs collision detection:Each thread in image processor equipment end thread block is in Detection task Two pipelines carry out collision detection.
A kind of 7. Fast Collision Detection Algorithm of magnanimity underground utilities according to claim 1,5,6, it is characterised in that:Institute Thread block thread execution collision detection is stated to comprise the following steps:
Bounding Box body filters:Judge whether the enclosure body of two pipelines intersects;Judge that enclosure body is non-intersect, then judge two Collision is not present in pipeline;Judge that Bounding Box body phase is handed over, then collision detection is carried out according to pipeline body Model;
Cylinder body Model and cylinder body Model collision detection:The beeline between two its center axis is calculated, And judge whether beeline is more than two cylinder body Model radius sums;Judge that beeline is more than radius sum, judge Collision is not present in two cylinder body Models;Judge that beeline is less than radius sum, then judge that two cylinder body Models are deposited Colliding;
Cuboid body Model detects with cuboid model collision:Judge that each face of two cuboid body Models whether there is successively Collision;To collision is not present between rectangular dignity, judge that collision is not present in two cuboid body Models;To being deposited between rectangular dignity Colliding, judging that two cuboid body Models have collision;
Cuboid body Model and cylinder body Model collision detection:The most short distance between each face of cuboid and cylinder is calculated successively From beeline is more than cylinder radius, judges collision is not present between cuboid body Model and cylinder body Model;Most short distance From less than cylinder radius, judge collision between cuboid body Model and cylinder body Model be present;
Write collision detection result:According to the collision detection result of pipeline body Model, pipeline collision detection result is write into collision inspection In survey task.
A kind of 8. Fast Collision Detection Algorithm of magnanimity underground utilities according to claim 1-7, it is characterised in that:Institute Stating pipeline information includes:Pipeline is numbered, caliber, pipeline starting point coordinate, and pipeline terminates point coordinates;The collision task groups bag Include:Task group index, grid block index, set of tasks.
CN201711004000.9A 2017-10-24 2017-10-24 Rapid collision detection method for mass underground pipelines Active CN107885912B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711004000.9A CN107885912B (en) 2017-10-24 2017-10-24 Rapid collision detection method for mass underground pipelines

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711004000.9A CN107885912B (en) 2017-10-24 2017-10-24 Rapid collision detection method for mass underground pipelines

Publications (2)

Publication Number Publication Date
CN107885912A true CN107885912A (en) 2018-04-06
CN107885912B CN107885912B (en) 2021-05-11

Family

ID=61782402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711004000.9A Active CN107885912B (en) 2017-10-24 2017-10-24 Rapid collision detection method for mass underground pipelines

Country Status (1)

Country Link
CN (1) CN107885912B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532720A (en) * 2019-09-04 2019-12-03 上海山南勘测设计有限公司 A kind of rapid automatized modeling method of Urban Buried Pipeline Network BIM
CN111784843A (en) * 2020-07-01 2020-10-16 上海电气集团股份有限公司 Three-dimensional display method and system for pipeline grid model
CN112231874A (en) * 2020-10-19 2021-01-15 中铁建华南建设有限公司 Method and device for establishing underground pipeline model, computer equipment and storage medium
CN117332481A (en) * 2023-10-09 2024-01-02 浙江挚典科技有限公司 Object characterization method and system for collision detection
CN117910072A (en) * 2023-12-30 2024-04-19 江苏大塔科技有限公司 Cesium-based pipe rack pipeline collision analysis method
CN117332481B (en) * 2023-10-09 2024-06-28 浙江挚典科技有限公司 Object characterization method and system for collision detection

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080129734A1 (en) * 2006-12-05 2008-06-05 Electronics And Telecommunications Research Institute Apparatus and method of ray-triangle collision detection for ray-tracing
CN105387274A (en) * 2015-11-24 2016-03-09 湖南大麓科技有限公司 Underground pipeline repairing assisting method, device and system
CN106683198A (en) * 2015-11-10 2017-05-17 星际空间(天津)科技发展有限公司 3D automatic modeling and scheduling rendering method for integrated pipe network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080129734A1 (en) * 2006-12-05 2008-06-05 Electronics And Telecommunications Research Institute Apparatus and method of ray-triangle collision detection for ray-tracing
CN106683198A (en) * 2015-11-10 2017-05-17 星际空间(天津)科技发展有限公司 3D automatic modeling and scheduling rendering method for integrated pipe network
CN105387274A (en) * 2015-11-24 2016-03-09 湖南大麓科技有限公司 Underground pipeline repairing assisting method, device and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ENRIQUE DE LUCAS 等: "Ultra-Low Power Render-Based Collision Detection for CPU/GPU Systems", 《IEEE/ACM INTERNATIONAL SYMPOSIUM ON MICROARCHITECTURE》 *
田志宇 等: "辅助空间遥操作的虚拟管道设计与实现", 《宇航学报》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532720A (en) * 2019-09-04 2019-12-03 上海山南勘测设计有限公司 A kind of rapid automatized modeling method of Urban Buried Pipeline Network BIM
CN110532720B (en) * 2019-09-04 2023-04-18 上海山南勘测设计有限公司 Rapid automatic modeling method for urban underground pipe network BIM
CN111784843A (en) * 2020-07-01 2020-10-16 上海电气集团股份有限公司 Three-dimensional display method and system for pipeline grid model
CN112231874A (en) * 2020-10-19 2021-01-15 中铁建华南建设有限公司 Method and device for establishing underground pipeline model, computer equipment and storage medium
CN117332481A (en) * 2023-10-09 2024-01-02 浙江挚典科技有限公司 Object characterization method and system for collision detection
CN117332481B (en) * 2023-10-09 2024-06-28 浙江挚典科技有限公司 Object characterization method and system for collision detection
CN117910072A (en) * 2023-12-30 2024-04-19 江苏大塔科技有限公司 Cesium-based pipe rack pipeline collision analysis method
CN117910072B (en) * 2023-12-30 2024-06-25 江苏大塔科技有限公司 Cesium-based pipe rack pipeline collision analysis method

Also Published As

Publication number Publication date
CN107885912B (en) 2021-05-11

Similar Documents

Publication Publication Date Title
CN107885912A (en) A kind of Fast Collision Detection Algorithm of magnanimity underground utilities
CN102750618B (en) A kind of comprehensive pipeline of metro construction aided management system and implementation method
CN103970960B (en) The element-free Galerkin structural topological optimization method accelerated parallel based on GPU
Bracci et al. HexaLab. net: An online viewer for hexahedral meshes
CN101281654A (en) Method for processing cosmically complex three-dimensional scene based on eight-fork tree
CN103135132A (en) Hybrid-domain full wave form inversion method of central processing unit (CPU)/graphics processing unit (GPU) synergetic parallel computing
CN104573279B (en) The grid rapid generation that nuclear radiation shield based on Depth Peeling calculates
CN106875492A (en) It is a kind of towards GPU bounding box collision checking methods
CN107330139A (en) Collision checking method based on BIM technology
CN104504760B (en) The method and system of real-time update 3-D view
CN103080941A (en) Apparatus for generating computational data, method for generating computational data, and program for generating computational data
CN102999657B (en) Method and system for the design object sub-assembly in computer aided design system
CN102193837B (en) Front line-based method for detecting collision of bounding volume
CN108460195A (en) Tsunami mathematical calculation model is based on rapid implementation method parallel GPU
CN107341598A (en) Semantic and geometry calculations incorporated complex building specification accordance detection means and method
CN104408773B (en) Method for interpolating structured grid non-matching interface
Fan et al. An octree-based proxy for collision detection in large-scale particle systems
CN113673186A (en) Cartesian grid rapid generation method based on STL file
KR20060066575A (en) System and method for acceleration of physic simulation
Dharma et al. Material point method based fluid simulation on GPU using compute shader
Qi et al. An enhanced sweep and prune algorithm for multi-body continuous collision detection
CN104463940A (en) Hybrid tree parallel construction method based on GPU
Ma Application of Building Information Model (BIM) in the Design of Marine Architectural Structures
Jie et al. LOD methods of large-scale urban building models by GPU accelerating
CN106651760A (en) 3D supermarket display method based on CAD (Computer Aided Design) floor plan

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant