CN110717970B - Method for moving corrected position by normal based on discrete collision detection - Google Patents

Method for moving corrected position by normal based on discrete collision detection Download PDF

Info

Publication number
CN110717970B
CN110717970B CN201910865108.XA CN201910865108A CN110717970B CN 110717970 B CN110717970 B CN 110717970B CN 201910865108 A CN201910865108 A CN 201910865108A CN 110717970 B CN110717970 B CN 110717970B
Authority
CN
China
Prior art keywords
next position
obstacle
moving
primitive
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.)
Active
Application number
CN201910865108.XA
Other languages
Chinese (zh)
Other versions
CN110717970A (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.)
Jiangsu University of Technology
Original Assignee
Jiangsu University of Technology
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 Jiangsu University of Technology filed Critical Jiangsu University of Technology
Priority to CN201910865108.XA priority Critical patent/CN110717970B/en
Publication of CN110717970A publication Critical patent/CN110717970A/en
Application granted granted Critical
Publication of CN110717970B publication Critical patent/CN110717970B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • 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

Abstract

The invention provides a moving method based on discrete collision detection by means of normal correction position, which is used for rapidly obtaining an approximate solution of a moving position in the discrete collision detection, wherein when a model is moving, if the moving end position is reachable, any position in a path is necessarily reachable; when the model collides during moving, the model is moved along the normal direction of each intersected graphic element so as to separate the two, and if the model cannot be separated, the model is reversed according to a bisection method. In the execution process, the method continuously approaches to the accurate value of the end position so as to realize the correction of the collision position.

Description

Method for moving corrected position by normal based on discrete collision detection
Technical Field
The invention relates to the technical field of computer graphics real-time rendering, in particular to a method for moving a position by means of normal correction based on discrete collision detection.
Background
Collision detection is mainly used for detecting the intersection situation between different models and simulating physical phenomena based on the intersection situation. In the field of real-time rendering, existing dynamic collision detection algorithms can be classified into discrete collision detection and continuous collision detection according to their properties.
In the discrete collision detection, time is mainly considered to be divided into discrete moments, motion of the models is simulated at each moment, collision conditions among the models after the motion are detected, and corresponding processing is carried out. Discrete collision detection may therefore leak through collisions between parts of high speed objects or may pass through walls or other objects when one object is displaced relatively large between successive points in time. And because of its post-crash detection characteristics, the crash point location needs to be calibrated, nor is its recorded crash time accurate.
In continuous collision detection, the motion trail of the model is mainly predicted before the model moves, and the motion trail of each model is combined for calculation. The discrete collision detection can not generate the phenomenon of mutual penetration between models, so that the accuracy of collision time and collision position calculation is ensured, but the algorithm complexity is high, and the real-time requirement is difficult to meet.
Disclosure of Invention
The present invention aims to provide a method of moving a position by means of normal correction based on discrete collision detection that overcomes one of the above problems or at least partially solves any of the above problems.
In order to achieve the above purpose, the technical scheme of the invention is specifically realized as follows:
an aspect of the present invention provides a method for moving a position by means of normal correction based on discrete collision detection, wherein the method comprises the following steps when knowing a movement model M, a movement direction S, a step t, and calculating an end point of a movement step: s1: record temporary variable t 0 =0、t 1 T, t' =t; s2: moving the movement model M by a distance t 'in the direction of the movement direction S to obtain a next position M'; s3: judging whether the next position M' collides with the obstacle, if so, t 1 =t ', storing the obstacle colliding with the next position M' in C, and executing S4; if the next position M' does not collide with the obstacle, t 0 =t', S6 is performed; s4: judging whether the obstacle in the step C is repeated, and executing the step S5 if the obstacle is not repeated; if the repetition occurs, C is emptied, and S6 is executed; s5: correcting the next position M 'according to the normal line of the primitive collided with the next position M', and executing S3; s6: if it is
Figure BDA0002201037440000021
Greater than threshold value>
Figure BDA0002201037440000022
Execute S2 if->
Figure BDA0002201037440000023
And not more than the threshold value, and ending the algorithm.
The stride t is determined according to the requirements of precision and speed.
Wherein, the obstacle in C is determined according to the requirements of precision and speed, including but not limited to: all models, part models, some subspace in the spatial data structure, bounding boxes of models, and primitives of models.
Wherein correcting the next position M 'based on the normal of the primitive colliding with the next position M' includes: determining the maximum distance value between the vertex and the primitive in the next position M' on the opposite side of the primitive normal line; determining the direction in the same direction as the normal line of the graphic element; determining a vector B according to the maximum distance value and the direction; accumulating B corresponding to all the primitives colliding with the next position M' to obtain B total The method comprises the steps of carrying out a first treatment on the surface of the Correcting the next position M '=m' +b total
The range of the threshold value is more than 0 and less than 1, and the threshold value is determined according to the requirements of precision and speed and is used for precision control.
Wherein, if calculated for gravity, the moving direction S is the gravity direction.
Therefore, according to the moving method based on the discrete collision detection and by means of the normal correction position, if the moving end position of the model is reachable during moving, any position in the path is necessarily reachable; when the model collides in moving, for each intersected graphic element, the model is moved along the normal direction of the graphic element to separate the two graphic elements, if the two graphic elements cannot be separated, the model is reversed according to a bisection method, and in the executing process, the accurate value of the end position is continuously approximated, and the approximate solution of the moving position in discrete collision detection can be rapidly obtained.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for moving a position by normal correction based on discrete collision detection according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an algorithm for intersecting a single primitive according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an algorithm when a model provided in an embodiment of the present invention intersects a plurality of primitives.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 is a flowchart of a method for moving a position by normal correction based on discrete collision detection according to an embodiment of the present invention, referring to fig. 1, the method for moving a position by normal correction based on discrete collision detection according to an embodiment of the present invention, when a movement model M, a movement direction S, a step t are known, and an endpoint of one step of movement is calculated, includes the following steps:
s1: record temporary variable t 0 =0、t 1 =t、t′=t。
In a specific implementation process, the method for moving the position by means of normal correction based on discrete collision detection provided by the embodiment of the invention can be used for physical simulation based on discrete collision detection in a two-dimensional or three-dimensional scene. And any shape primitive may be used by the model. Wherein for collision detection of regular movements other than straight lines, the direction of movement can be considered as a curve.
As an alternative implementation of the embodiment of the invention, the stride t is determined according to the requirements of precision and speed. Specifically, if the step t is selected to ensure that M collides with any M', the "mold penetration" phenomenon in discrete collision detection can be greatly reduced. The stride t is mainly selected according to the requirements of precision and speed, and the larger the stride t is, the faster the calculation speed is, and the lower the precision is. Thus, selection and determination can be made according to actual needs.
S2: moving the movement model M by a distance t 'in the direction of the movement direction S to obtain a next position M';
s3: judging whether the next position M' collides with the obstacle, if so, t 1 =t ', storing the obstacle colliding with the next position M' in C, and executing S4; if the next position M' does not collide with the obstacle, t 0 =t', S6 is performed;
s4: judging whether the obstacle in the step C is repeated, and executing the step S5 if the obstacle is not repeated; if repetition occurs, C is cleared, and S6 is performed.
As an alternative implementation of the embodiment of the present invention, the obstacle in C is determined according to the requirements of precision and speed, including but not limited to: all models, part models, some subspace in the spatial data structure, bounding boxes of models, and primitives of models. Specifically, the obstacle in C may be a model, a part of the model, a subspace in a spatial data structure, a bounding box of the model, a primitive, and the like, and the specific selection needs to be according to the accuracy and the speed requirements. Repeated collisions with the same obstacle in the cycle can be regarded as approximately unreachable at the current t' corresponding position.
S5: and correcting the next position M 'according to the normal line of the primitive collided with the next position M', and executing S3.
As an alternative implementation of the embodiment of the present invention, correcting the next position M 'according to the normal line of the primitive colliding with the next position M' includes: determining the maximum distance value between the vertex and the primitive in the next position M' on the opposite side of the primitive normal line; determining the direction in the same direction as the normal line of the graphic element; determining a vector B according to the maximum distance value and the direction; accumulating B corresponding to all the primitives colliding with the next position M' to obtain B total The method comprises the steps of carrying out a first treatment on the surface of the Correcting the next position M '=m' +b total . Specifically, for each primitive colliding with the current M ', calculating the maximum distance value between the vertex and the primitive in M' on the opposite direction side of the primitive normal. Length is recorded as the maximum distanceAnd simultaneously determining the direction in the same direction as the normal line of the primitive, and determining the vector as B according to the length and the direction. Accumulating B corresponding to all the primitives colliding with M' to obtain B total Thus, a corrected M '=m' +b can be obtained total
S6: if it is
Figure BDA0002201037440000051
Greater than threshold value>
Figure BDA0002201037440000052
Execute S2 if->
Figure BDA0002201037440000053
And not more than the threshold value, and ending the algorithm.
Specifically, the method of the present invention is not particularly limited, and a binary approach is used in the present step, and in practical use, a binary approach may be used according to the data amount.
As an alternative implementation of the embodiment of the present invention, the threshold value ranges from greater than 0 to less than 1, and is determined according to the requirements of precision and speed, and is used for precision control. Specifically, the reasonable value range of the threshold is (0, 1), which is used for controlling the precision of the calculation result, and is mainly selected according to the precision and the speed requirement, and meanwhile, the precision of the stride t is required to be considered. The larger the threshold value is, the faster the convergence speed is, and the lower the precision is; the smaller the threshold, the slower the convergence speed and the higher the accuracy.
As an alternative implementation of the embodiment of the present invention, if calculated as gravity, the moving direction S is the direction of gravity. Specifically, after the moving direction S is determined as the gravitational direction, the above steps S1 to S6 are performed.
Therefore, the method for moving the position by means of normal correction based on discrete collision detection provided by the embodiment of the invention adopts an approximation algorithm, gradually approximates to an accurate value in the calculation process, and mainly considers the requirement of real-time performance instead of accuracy.
As an alternative to the embodiment of the present invention, further acceleration may be performed in connection with the spatial data structure when performing S2-S6. In the implementation process, the method can be further accelerated by combining corresponding spatial data structures according to the number of the used models, the complexity of the models and the dimension of the models.
The following describes the method for moving the discrete collision detection based on the normal correction position according to the embodiment of the present invention by taking the calculation result obtained by the method for moving the discrete collision detection based on the normal correction position as an example when intersecting a single primitive, referring to fig. 2, when intersecting a single primitive, the method for moving the discrete collision detection based on the normal correction position according to the embodiment of the present invention obtains M final . Specifically, determining a maximum distance value between a vertex and a primitive in a primitive normal opposite direction side M 'of the primitive, wherein the primitive collides with the current M'; determining the direction in the same direction as the normal line of the graphic element, determining a vector B according to the maximum distance value and the direction, and correcting M final =m' +b, thereby obtaining M final
The following describes the method for moving the discrete collision detection based on the normal correction position according to the embodiment of the present invention, with reference to fig. 3, by taking the calculation result obtained by the method for moving the discrete collision detection based on the normal correction position provided by the embodiment of the present invention as an example when the model intersects with a plurality of primitives, where M is obtained by the method for moving the discrete collision detection based on the normal correction position provided by the embodiment of the present invention when the model intersects with a plurality of primitives final . Determining the maximum distance value between the vertex and the primitive in the opposite direction M 'of the primitive normal line of each primitive colliding with the current M'; determining the direction in the same direction as the normal line of the graphic element; determining a vector B based on the maximum distance value and the direction, the B comprising B 1 And B 2 Accumulate B 1 And B 2 Obtaining B total The method comprises the steps of carrying out a first treatment on the surface of the Correcting the next position M final =M′+B total Thereby obtaining M final
Therefore, by using the moving method based on discrete collision detection and corrected by the normal line provided by the embodiment of the invention, an accurate value is gradually approximated in the calculation process, so that the position correction can be performed.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.

Claims (6)

1. A method for moving a position corrected by means of a normal line based on discrete collision detection, characterized in that it comprises the following steps when the movement model M, the movement direction S, the step t are known, and the end point of a movement step is calculated:
s1: record temporary variable t 0 =0、t 1 =t、t′=t;
S2: moving the movement model M to a direction of the movement direction S by a distance t 'to obtain a next position M';
s3: judging whether the next position M' collides with the obstacle, if so, t 1 =t ', storing the obstacle colliding with the next position M' in an obstacle set C, performing S4; if the next position M' does not collide with an obstacle, t 0 =t', S6 is performed;
s4: judging whether the obstacle in the obstacle set C is repeated, and executing S5 if the obstacle is not repeated; if the repetition occurs, clearing the obstacle set C, and executing S6;
s5: correcting the next position M 'according to the normal line of the primitive collided with the next position M', and executing S3;
s6: if it is
Figure FDA0004201388160000011
Greater than threshold value>
Figure FDA0004201388160000012
Execute S2 if->
Figure FDA0004201388160000013
And not greater than the threshold value, and ending the method.
2. The method of claim 1, wherein the stride t is determined based on accuracy and speed requirements.
3. The method of claim 1, wherein the obstacles in the set of obstacles C are determined based on accuracy and speed requirements, including but not limited to: all models, part models, one subspace in the spatial data structure, bounding boxes of models, and primitives of models.
4. The method according to claim 1, wherein said correcting said next location M 'based on the normal of the primitive colliding with said next location M' comprises:
determining the maximum distance value between the vertex in the next position M' and the primitive at one side of the opposite direction of the primitive normal line;
determining the direction in the same direction as the normal line of the graphic element;
determining a vector B according to the maximum distance value and the direction;
accumulating B corresponding to all the primitives colliding with the next position M' to obtain B total
Correcting the next position M '=m' +b total
5. The method of claim 1, wherein the threshold value ranges from greater than 0 to less than 1, as determined by the accuracy and speed requirements, for accuracy control.
6. The method according to claim 1, wherein the direction of movement S is the direction of gravitational force.
CN201910865108.XA 2019-09-12 2019-09-12 Method for moving corrected position by normal based on discrete collision detection Active CN110717970B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910865108.XA CN110717970B (en) 2019-09-12 2019-09-12 Method for moving corrected position by normal based on discrete collision detection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910865108.XA CN110717970B (en) 2019-09-12 2019-09-12 Method for moving corrected position by normal based on discrete collision detection

Publications (2)

Publication Number Publication Date
CN110717970A CN110717970A (en) 2020-01-21
CN110717970B true CN110717970B (en) 2023-07-07

Family

ID=69210432

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910865108.XA Active CN110717970B (en) 2019-09-12 2019-09-12 Method for moving corrected position by normal based on discrete collision detection

Country Status (1)

Country Link
CN (1) CN110717970B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116562027B (en) * 2023-05-12 2023-11-28 江苏大学 Two-dimensional continuous collision detection method for circle and line segment set

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140358505A1 (en) * 2013-05-31 2014-12-04 The Board Of Trustees Of The University Of Illinois Collision impulse derived discrete element contact force determination engine, method, software and system
CN109682336B (en) * 2018-12-28 2020-12-29 上海理工大学 Automatic planning and optimizing method for three-coordinate measurement path for vehicle body precision detection
CN110047143B (en) * 2019-03-04 2023-03-21 南昌大学 Continuous collision detection method based on space subdivision and dynamic bounding box
CN110136269B (en) * 2019-05-09 2022-09-23 安徽工程大学 Fall test visual virtual reality system based on normal self-correction

Also Published As

Publication number Publication date
CN110717970A (en) 2020-01-21

Similar Documents

Publication Publication Date Title
CN109341707B (en) Method for constructing three-dimensional map of mobile robot in unknown environment
CN111707269B (en) Unmanned aerial vehicle path planning method in three-dimensional environment
TWI428778B (en) Collision determination device and collision determination program
CN105590339B (en) The collision checking method and system of threedimensional model
JP7314411B2 (en) Obstacle information sensing method and device for mobile robot
WO2018176596A1 (en) Unmanned bicycle path planning method based on weight-improved particle swarm optimization algorithm
CN112440281A (en) Robot trajectory planning method based on digital twins
CN108363393B (en) A kind of smart motion equipment and its air navigation aid and storage medium
CN103236079A (en) Improved three-dimensional model voxelization-based inner sphere construction method
CN105096381A (en) Collision detecting method using moving three-dimension ship models in navigation channel
CN104408774A (en) Detection method for collision between solid mesh models based on GPU (Graphics Processing Unit) acceleration
CN108638055A (en) A kind of seven freedom space manipulator automatic obstacle avoiding planing method
CN108733065A (en) A kind of barrier-avoiding method of robot, device and robot
CN110992456A (en) Avalanche simulation method based on position dynamics
CN113246143A (en) Mechanical arm dynamic obstacle avoidance trajectory planning method and device
CN113442140B (en) Cartesian space obstacle avoidance planning method based on Bezier optimization
CN110717970B (en) Method for moving corrected position by normal based on discrete collision detection
Tang et al. Hierarchical and controlled advancement for continuous collision detectionof rigid and articulated models
CN113536613B (en) Crowd evacuation simulation method and device, terminal equipment and storage medium
CN114326810A (en) Obstacle avoidance method of unmanned aerial vehicle in complex dynamic environment
CN112665592B (en) Space-time path planning method based on multiple agents
CN109933945A (en) Traffic environment modeling method
CN116858253A (en) Lightweight predictive navigation method and system suitable for indoor environment
WO2018210303A1 (en) Road model construction
JP6848761B2 (en) Distance evaluation method between objects and interference evaluation method between relatively moving objects

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