CN104102357B - 3D model checking methods and device in a kind of virtual scene - Google Patents
3D model checking methods and device in a kind of virtual scene Download PDFInfo
- Publication number
- CN104102357B CN104102357B CN201410317624.6A CN201410317624A CN104102357B CN 104102357 B CN104102357 B CN 104102357B CN 201410317624 A CN201410317624 A CN 201410317624A CN 104102357 B CN104102357 B CN 104102357B
- Authority
- CN
- China
- Prior art keywords
- models
- controlling line
- enclosure body
- virtual controlling
- axis
- 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
Links
Abstract
The present invention is applied to the model inspection field of man-machine interaction, there is provided 3D model checking methods and device, methods described in a kind of virtual scene include:The spatial attitude angle of the corresponding interaction pen, maps out a virtual controlling line in real time in the virtual scene;Every 3D models in the corresponding virtual scene, construct an enclosure body respectively, and the enclosure body wraps corresponding 3D models;Judge whether the virtual controlling line mapped in real time intersects with the enclosure body of 3D models;When the virtual controlling line intersects with the enclosure body of 3D models, judge whether the virtual controlling line intersects with any triangle gridding in 3D models corresponding to the enclosure body intersected;In the virtual controlling line and intersecting any triangle gridding in 3D models corresponding to the enclosure body intersected, judge that the virtual controlling line intersects with 3D models corresponding to the enclosure body intersected, to judge to detect 3D models.The embodiment of the present invention can improve the accuracy of detection of 3D models.
Description
Technical field
The invention belongs to the model inspection field of man-machine interaction, more particularly to the 3D model inspection sides in a kind of virtual scene
Method and device.
Background technology
With the further investigation and application of virtual reality technology, three-dimensional visualization Display Technique and human-computer interaction technology enter
One step develops, and people can render, design various virtual reality scenarios, and carry out necessary control to the 3D models in virtual scene
System.And, it is necessary to detect the 3D models in virtual scene before the 3D models in controlling virtual scene.
At present, the 3D model checking methods in existing virtual scene are mainly accomplished by the following way:One is established to penetrate
Line cluster, then the Intersection of the ray cluster and detection body of foundation is detected, and when detecting that some ray is handed over detection body phase, according to
3D model of the mapping relationship searching of detection body and model to hit.Due to only by detecting the ray cluster established and detection body
Intersection carrys out detection model, therefore accuracy of detection is too low.
The content of the invention
The embodiments of the invention provide the 3D model checking methods in a kind of virtual scene, it is intended to solves existing method and is examining
The problem of precision is too low when surveying 3D models.
The embodiment of the present invention is achieved in that the 3D model checking methods in a kind of virtual scene, and methods described includes
Following step:
The spatial attitude angle of the corresponding interaction pen, maps out a virtual controlling line in real time in the virtual scene;
Every 3D models in the corresponding virtual scene, construct an enclosure body respectively, and the enclosure body wraps pair
The 3D models answered, the 3D models are made up of multiple triangle griddings;
Judge whether the virtual controlling line mapped in real time intersects with the enclosure body of 3D models;
When the virtual controlling line intersects with the enclosure body of 3D models, the virtual controlling line and the encirclement intersected are judged
Whether any triangle gridding in 3D models corresponding to body intersects;
In the virtual controlling line and intersecting any triangle gridding in 3D models corresponding to the enclosure body intersected, judge
The virtual controlling line intersects with 3D models corresponding to the enclosure body intersected, to judge to detect 3D models.
The another object of the embodiment of the present invention is in the 3D model inspection devices in a kind of virtual scene is provided, described device
Including:
Virtual controlling line generation unit, it is real in the virtual scene for the spatial attitude angle of the corresponding interaction pen
When map out a virtual controlling line;
Model enclosure body structural unit, for every 3D models in the corresponding virtual scene, a bag is constructed respectively
Containment body, the enclosure body wrap corresponding 3D models, and the 3D models are made up of multiple triangle griddings;
The Intersection detection unit of model enclosure body, for judging the virtual controlling line mapped in real time and 3D models
Whether enclosure body intersects;
The Intersection detection unit of model triangle gridding, for intersecting in the virtual controlling line with the enclosure body of 3D models
When, judge whether the virtual controlling line intersects with any triangle gridding in 3D models corresponding to the enclosure body intersected;
Model inspection identifying unit, in the virtual controlling line and appointing in 3D models corresponding to the enclosure body intersected
When one triangle gridding intersects, judge that the virtual controlling line intersects with 3D models corresponding to the enclosure body intersected, to judge to detect
To 3D models.
In embodiments of the present invention, due to first being detected to the enclosure body of 3D models, after interaction pen rotation is judged
After corresponding direction vector intersects with the enclosure body of 3D models in virtual scene, just detect after interaction pen rotates in virtual field
Whether corresponding direction vector intersects with any one triangle gridding in 3D models in scape, therefore reduces operand, so as to have
Effect improves the speed and precision of 3D models in detection virtual environment scene.
Brief description of the drawings
Fig. 1 is the flow chart of the 3D model checking methods in a kind of virtual scene that first embodiment of the invention provides;
Fig. 2 is the schematic diagram for the attitude angle that first embodiment of the invention provides;
Fig. 3 is the structure chart of the 3D model inspection devices in a kind of virtual scene that second embodiment of the invention provides;
Fig. 4 is the structure chart of the 3D model inspection devices in another virtual scene that second embodiment of the invention provides.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.
In the embodiment of the present invention, according to the spatial attitude angle of interaction pen, a virtual control is mapped out in real time in virtual scene
Line processed, and the enclosure body of 3D models is determined according to the vertex data information of the 3D models of storage, then judge the virtual controlling
Whether line intersects with the enclosure body of 3D models, and when virtual controlling line intersects with the enclosure body of 3D models, judges described virtual
Whether control line intersects with any triangle gridding in 3D models corresponding to the enclosure body intersected, if intersecting, judgement detects 3D
Model.
In order to illustrate technical solutions according to the invention, illustrated below by specific embodiment.
Embodiment one:
Fig. 1 shows the flow of the 3D model checking methods in a kind of virtual scene that first embodiment of the invention provides
Figure, details are as follows:
Step S11, the spatial attitude angle of the corresponding interaction pen, map out a virtual control in real time in the virtual scene
Line processed.
In the step, interaction pen refers to user and a kind of operative employee of the shape of similar pen used during intelligent terminal interactive
Tool, the interaction of the 3D models in posture realization and intelligent terminal of the user by changing the interaction pen.
Wherein, the attitude angle of interaction pen includes the angle of pitch, roll angle and the yaw angle of interaction pen.Referring to Fig. 2, in fig. 2,
The coordinate system that Xg axles, Yg axles, Zg axles are formed is earth axes, and Zg axles are perpendicular to ground and point to the earth's core, and Yg axles are in horizontal plane
It is interior to be determined perpendicular to Xg axles, its sensing by the right-hand rule;The coordinate system that Xb axles, Yb axles, Zb axles are formed is interaction pen coordinate system, Xb
Axle points to the interaction pen right side in interaction pen plane and parallel to the design axis of interaction pen, Yb axles perpendicular to interaction pen symmetrical plane
Side, Zb axles in interaction pen symmetrical plane, it is vertical with Xb axles and point to interaction pen lower section.The angle of pitch refers to interaction pen coordinate system
The angle of Xb axles and horizontal plane, when the positive axis of Xb axles is located on zeroaxial horizontal plane, just, otherwise the angle of pitch is
It is negative;Yaw angle refers to the angle between the projection in the horizontal plane of the Xb axles of interaction pen coordinate system and earth axes Xg axles,
When going to the projection of Xb axles counterclockwise by Xg axles, yaw angle is just, on the contrary is negative;Roll angle refer to interaction pen coordinate system Zb axles with
By the angle between the vertical guide of Xb axles, interaction pen is rolled to the right as just, on the contrary is negative.
Preferably, in step S11, the spatial attitude angle of the corresponding interaction pen, mapped in real time in the virtual scene
Go out before a virtual controlling line, comprise the steps:
A1, determine the initial angle of pitch and roll angle.In the step, by the three-axis gyroscope on interaction pen,
Three axis accelerometer determines the initial angle of pitch and roll angle.
A2, the final angle of pitch and horizontal stroke determined according to Kalman filtering and the initial angle of pitch and roll angle iteration
Roll angle.Because gyroscope precision is high, but drift is had for a long time, and accelerometer dynamic accuracy is poor, but there is no long term drift, because
This, in order to comprehensively utilize both advantages, can do data fusion, with the accurate angle of pitch stablized by Kalman filtering
And roll angle.In this step:The initial angle of pitch and roll angle are represented using quaternary number, and are used as Kalman filtering system
Quantity of state.State transition equation using attitude kinematics equations as Kalman filtering, sight of the acceleration information as filtering
Measurement information, calculating then is iterated using the computational methods of Kalman filtering, the initial angle of pitch and roll angle are updated to
Accurately, the stable angle of pitch and roll angle.
Wherein, quaternary number is all made up of three elements i, j, k on real add, and they have following relation:I^2=
J^2=k^2=ijk=-1.
A3, according to where the final angle of pitch and roll angle and interaction pen the x-axis of coordinate system, y-axis, z-axis magnetic
Field intensity component, determine the magnetic field strength component in horizontal plane.In the step, x-axis, y-axis, the z-axis of coordinate system where interaction pen
Magnetic field strength component can be obtained by three axle magnetometer on interaction pen.Assuming that the x-axis measured by three axle magnetometer,
Y-axis, the magnetic field strength component of z-axis are respectively hx,hy,hz, it is determined that the final angle of pitch be θ, roll angle γ, due to interaction
Coordinate system xyz where pen rotates around x-axis, and after being rotated further around y-axis, the xoy planes of the coordinate system where interaction pen are easy to ground
The horizontal plane XOY of coordinate system is overlapped, and therefore, following equation is can obtain using above-mentioned relation:
Wherein, HX、HY、HZFor magnetic field intensity in the horizontal plane of earth axes point
Amount,
RpitchFor the coordinate system xyz where interaction pen the spin matrix obtained after θ angles, R are rotated around y-axisrollFor interaction
Coordinate system xyz where pen rotates the spin matrix obtained after γ angles around x-axis.Above-mentioned equation is deployed, obtained:
HX=hx·cosγ+hy·sinγ·sinθ+hz·cosγ·sinθ
HY=hy·cosγ-hz·sinγ
HZ=-hx·sinθ+hy·sinγ·cosθ+hz·cosθ·cosγ
Above-mentioned " " refers to inner product, and H is obtained by 3 formula aboveX、HY。
A4, yaw angle determined according to the magnetic field strength component in the horizontal plane of determination.
Yaw angle=arctan (HY/HX), HX、HYFor magnetic field strength component in the horizontal plane of earth axes.
It is determined that after the spatial attitude angle of interaction pen, the spatial attitude angle of the interaction pen is corresponded to, in the virtual field
A virtual controlling line is mapped out in scape in real time, specifically includes following step:
B1, the spin matrix for determining according to the attitude angle of the interaction pen interaction pen.Specifically:B11, determine interaction
Coordinate system where pen rotates the matrix obtained after θ angles around y-axis, and the θ is the angle of pitch.From step S11, interaction pen place
Coordinate system rotates the matrix obtained after θ angles around y-axisB12, determine interaction pen
The matrix that place coordinate system obtains after z-axis rotation alpha angle, the α are yaw angle.Assuming that coordinate system is around z-axis where interaction pen
The matrix obtained after rotation alpha angle is Rz(α), thenB13, determine to sit where interaction pen
Mark system rotates the matrix obtained after γ angles around x-axis, and the γ is roll angle.From step S11, coordinate system where interaction pen
The matrix obtained after γ angles is rotated around x-axis isB14, the interaction according to determination
Coordinate system where coordinate system where pen rotates the matrix obtained after θ angles, the interaction pen around y-axis obtains after z-axis rotation alpha angle
Matrix and the interaction pen where coordinate system the spin matrix that the matrix obtained after γ angles determines interaction pen is rotated around x-axis.
Assuming that spin matrix is R, then
Expansion obtains:
B2, the origin in the spin matrix of the interaction pen, default virtual scene and default interaction pen
Inceptive direction vector, real-time rendering goes out corresponding virtual controlling line after the interaction pen rotation in virtual scene.In the step,
Assuming that the inceptive direction vector of default interaction pen isCorresponding direction vector is (i.e. in virtual scene after interaction pen rotation
The virtual controlling line mapped in real time) beR is spin matrix, thenWherein " " represents inner product operation.If it is determined that
Origin in virtual scene, then can determine that interaction pen rotation after in virtual scene corresponding direction vector (map in real time
Virtual controlling line) where position.Specifically, the origin in default virtual scene, in void after the interaction pen is rotated
Intend the virtual controlling line that corresponding direction vector in scene is plotted as designated length.In the step, using figure rendering tool
OpenGL, the origin in default virtual scene rotated along interaction pen after in virtual scene corresponding direction vectorSide
To, the virtual controlling line of a certain length is drawn out, it is real so as to which the spatial attitude information of interaction pen is passed through into virtual controlling line
When show, be easy to user intuitively to know the current state of interaction pen.
Step S12, every 3D models in the virtual scene are corresponded to, construct an enclosure body, the enclosure body respectively
3D models, the 3D models are made up of multiple triangle griddings corresponding to wrapping.
In the step, because each 3D models are made up of multiple triangle griddings, therefore, the vertex data information of 3D models is
Form vertex data information corresponding to multiple triangle griddings of the 3D models.During the enclosure body of one 3D model of structure, compare this
Each fixed-point data information in 3D models, it is that 3D models are sat in maximum vertex coordinate, the minimum vertex of x-axis to judge which coordinate
Mark;It is maximum vertex coordinate, minimum vertex coordinate of the 3D models in y-axis to judge which coordinate;It is 3D models to judge which coordinate
Maximum vertex coordinate, minimum vertex coordinate in z-axis.It is determined that after above-mentioned 6 coordinates enumerated, 6 coordinates are just used as should
The apex coordinate of the enclosure body of 3D models.
Step S13, judges whether the virtual controlling line mapped in real time intersects with the enclosure body of 3D models.
Wherein, it is described to judge that the virtual controlling line mapped in real time has with the step whether enclosure body of 3D models intersects
Body includes:
C1, determine function f (x, y, z) corresponding to the virtual controlling line, f (x, y, z) any points are in x-axis, y-axis, z-axis
Component is fx(x,y,z)、fy(x,y,z)、fz(x,y,z).In the step, function f (x, y, z) passes through corresponding to virtual controlling line
Origin in default virtual scene.
C2, judge f (x, y, z) any points x-axis, y-axis, z-axis component fx(x,y,z)、fy(x,y,z)、fz(x,y,z)
Whether following condition is all met:
min x≤fx(x,y,z)≤max x;
min y≤fy(x,y,z)≤max y;
min z≤fz(x,y,z)≤max z;
Wherein, the min x, max x, min y, max y, min z, the apex coordinate that max z is the enclosure body.Should
In step, min x, max x, min y, max y, min z, max z are respectively 3D models in the minimum vertex coordinate, most of x-axis
Big apex coordinate;Minimum vertex coordinate, maximum vertex coordinate in y-axis;Minimum vertex coordinate, maximum vertex coordinate in z-axis.
C3, f (x, y, z) any points x-axis, y-axis, z-axis component fx(x,y,z)、fy(x,y,z)、fz(x, y, z) all
When meeting above-mentioned condition, judge that the virtual controlling line intersects with the enclosure body of 3D models, otherwise, it is determined that the virtual controlling line
It is non-intersect with the enclosure body of 3D models.In the step, once detect that virtual controlling line and the enclosure body of some 3D model intersect,
The possibility that virtual controlling line intersects with other remaining 3D models can be excluded, i.e., need not go to detect virtual controlling line and other
Whether the enclosure body of 3D models intersects, so as to greatly accelerate the detection speed of 3D models, also, due to according to virtual controlling line
The coordinate of enclosure body of coordinate and 3D models on summit judge the Intersection of virtual controlling line and enclosure body, therefore, judge to tie
Fruit will not be influenceed by whether 3D models are blocked, so as to improve the detection for the 3D models that are blocked in virtual scene effect
Rate.
Step S14, when the virtual controlling line intersects with the enclosure body of 3D models, judge the virtual controlling line and phase
Whether any triangle gridding in 3D models corresponding to the enclosure body of friendship intersects.
After it is determined that intersecting with the enclosure body of some 3D model, followed by virtual controlling line and the triangulation network of 3D models
The specific Intersection detection of lattice.
Wherein, it is described when the virtual controlling line intersects with the enclosure body of 3D models, judge the virtual controlling line with
The step whether any triangle gridding in 3D models corresponding to intersecting enclosure body intersects specifically includes:
Assuming that the parametric equation of triangle corresponding to any triangle gridding is (1-u-v) V in 3D models0+uV1+vV2, its
In, (1-u-v), u, v are respectively the weight on Atria summit;V0,V1,V2For the coordinate on Atria summit;
Origin, the virtual controlling line in default virtual scene and any triangle gridding in 3D models
Three apex coordinates, judge whether u, v meet following condition:U >=0, v >=0, u+v≤1, if satisfied, judging the virtual controlling
Line intersects with any triangle gridding in 3D models corresponding to the enclosure body intersected, otherwise, it is determined that the virtual controlling line
With the enclosure body intersected corresponding to any triangle gridding in 3D models it is non-intersect.
Assuming that the origin in default virtual scene is O, the direction of virtual controlling line is D, then the virtual controlling line can be with
It is expressed as O+Dt (expression formula can represent control line with the above-mentioned C1 f (x, y) occurred), t ≠ 0.It is every due to 3D models
The summit of individual triangle gridding is stored in vertical array, therefore can be according to the storage order on summit, successively to each triangulation network
Lattice carry out Intersection detection.Assuming that the summit of some triangle gridding is respectively V0,V1,V2, and u, v are summit V respectively1,V2Power
Weight, then the parametric equation of triangle gridding can be expressed as (1-u-v) V0+uV1+vV2, when meeting u >=0, v >=0, u+v≤1 when
Wait, judgement is intersected with the triangle gridding.And judge whether u, v meet above-mentioned condition, then need first to determine u, v value, especially by
Following steps determine u, v value:
According to O+Dt=(1-u-v) V0+uV1+vV2Equation obtains unknown number t, if t is not zero, illustrates virtual control
Line processed intersects with the triangle gridding, that is, detects specific 3D models.According to O+Dt=(1-u-v) V0+uV1+vV2It can obtain
System of linear equations:
Make E1=V1-V0,E2=V2-V0, T=o-V0Obtain
Obtained by Cramer's rule
Wherein, the determinant of " | | " representing matrix.
Further according to mixed product formula | a b c |=a × bc=-a × cb, wherein, "×" represents that apposition calculates, " "
Represent that inner product calculates.Formula can make into:
Make P=D × E2, Q=T × E1,
Finally can abbreviation be
U, v calculation formula are obtained according to the above-mentioned formula finally simplified, may then pass through following methods to confirm u, v
Whether " u >=0, v >=0, u+v≤1 " this condition are met:
The positive floating number for making ε be one very close 0, makes det=| PE1|, if det<ε, it is immediately finished and works as first three
The Intersection of angle grid judges, into the judgement with next triangle gridding.If det >=ε, u '=PT is made, if u '<0 or
u′>Det, judge that the u values that finally calculate are ineligible, then jump out current judgement immediately, into next triangulation network
The judgement of lattice.If u ' >=0 or u '≤det, make v '=QD, if v '<0 or u '+v '>Det, judge the v values finally calculated not
It is eligible, then current judgement is jumped out immediately, into the judgement with next triangle gridding.Otherwise, if det >=ε, u ' >=0
Or u '≤det, and when v '≤0 or u '+v '≤det, you can judge that the virtual controlling line intersects with some specific triangle gridding.
Because obverse and reverse be present in same triangle gridding, in the detection process with triangle gridding, only detection and three
Angle grid is positive intersecting, can save half detection time, when detect intersect with some specific triangle gridding when, record friendship
The numbering of the enclosure body of point and corresponding 3D models, detection finish.
Step S15, in the virtual controlling line and any triangle gridding phase in 3D models corresponding to the enclosure body intersected
During friendship, judge that the virtual controlling line intersects with 3D models corresponding to the enclosure body intersected, to judge to detect 3D models.
In the step, in all triangle griddings of 3D models, as long as judging virtual controlling line and wherein any one
Triangle gridding is intersecting, you can judges that virtual controlling line has been detected by some specific 3D model immediately, after no longer carrying out
Continuous intersecting detection.
In the first embodiment of the invention, the attitude angle information of interaction pen is collected, according to the attitude angle of the interaction pen of collection
Determine the spin matrix of the interaction pen, the origin in spin matrix, default virtual scene further according to the interaction pen with
And the inceptive direction vector of default interaction pen, a virtual controlling line is mapped out in real time in virtual scene, finally according to storage
3D models vertex data information determine the enclosure body of 3D models after, judge the encirclement of the virtual controlling line and 3D models
Whether body intersect, judge the virtual controlling line with any triangle gridding in 3D models corresponding to the enclosure body intersected whether phase
Hand over, to judge whether to detect 3D models.Due to first being detected to the enclosure body of 3D models, virtual controlling line is being judged
After intersecting with the enclosure body of 3D models, just detect whether virtual controlling line intersects with any one triangle gridding in 3D models,
Therefore operand is reduced, so as to effectively improve the speed and precision of 3D models in detection virtual environment scene.
Embodiment two:
Fig. 3 shows the structure of the 3D model inspection devices in a kind of virtual scene that second embodiment of the invention provides
Figure, for convenience of description, illustrate only the part related to the embodiment of the present invention.
3D model inspection devices in the virtual scene include:Virtual controlling line generation unit 31, model enclosure body construction
Unit 32, the Intersection detection unit 33 of model enclosure body, the Intersection detection unit 34 of model triangle gridding, model inspection are sentenced
Order member 35.Wherein:
Virtual controlling line generation unit 31, for the spatial attitude angle of the corresponding interaction pen, in the virtual scene
Map out a virtual controlling line in real time.
Wherein, the attitude angle of interaction pen includes the angle of pitch, roll angle and the yaw angle of interaction pen, and the attitude angle of interaction pen is led to
Cross in the following manner determination:
Fig. 4 shows the structure of the 3D model inspection devices in a kind of virtual scene that another embodiment of the present invention provides
Figure, now, the 3D model inspection devices in the virtual scene include:
Initial pitch angle and roll angle determining unit 36, the angle of pitch and roll angle initial for determining interaction pen.Wherein,
The initial angle of pitch and roll angle are determined by the three-axis gyroscope on interaction pen, three axis accelerometer.
The final angle of pitch and roll angle determining unit 37, for according to Kalman filtering and the initial angle of pitch and
Roll angle iteration determines the final angle of pitch and roll angle.The initial angle of pitch and roll angle are represented using quaternary number, and made
For the quantity of state of Kalman filtering system.State transition equation using attitude kinematics equations as Kalman filtering, acceleration
Observation information of the information as filtering, is then iterated calculating, by initial pitching using the computational methods of Kalman filtering
The angle of pitch and roll angle that angle and roll angle are updated to is accurate, stable.
Magnetic field strength component determining unit 38, for according to where the final angle of pitch and roll angle and interaction pen
X-axis, y-axis, the magnetic field strength component of z-axis of coordinate system, determine the magnetic field strength component in horizontal plane.
Yaw angle determines 39 yuan of list, and yaw angle is determined for the magnetic field strength component in the horizontal plane according to determination.
Preferably, virtual controlling line generation unit 31 includes:
Spin matrix determining module 311, for determining the spin moment of the interaction pen according to the attitude angle of the interaction pen
Battle array.Coordinate system where the spin matrix of the interaction pen includes interaction pen rotates the matrix obtained after θ angles around y-axis, and the θ is to bow
The elevation angle;The matrix that coordinate system where interaction pen obtains after z-axis rotation alpha angle, the α is yaw angle;Coordinate where interaction pen
System rotates the matrix obtained after γ angles around x-axis, and the γ is roll angle.
Virtual controlling line rendering module 312, in the spin matrix according to the interaction pen, default virtual scene
The inceptive direction of origin and default interaction pen vector, real-time rendering corresponds to after going out the interaction pen rotation in virtual scene
Virtual controlling line.Assuming that the inceptive direction vector of default interaction pen isIt is corresponding in virtual scene after interaction pen rotation
Direction vector (the virtual controlling line mapped in real time) beR is spin matrix, thenWherein " " represents inner product
Computing.
Model enclosure body structural unit 32, for every 3D models in the corresponding virtual scene, one is constructed respectively
Enclosure body, the enclosure body wrap corresponding 3D models, and the 3D models are made up of multiple triangle griddings.
Wherein, the enclosure body of 3D models is in the maximum vertex coordinate of x-axis, minimum vertex coordinate, in y-axis by 3D models
Maximum vertex coordinate, minimum vertex coordinate, in the maximum vertex coordinate of z-axis, minimum vertex coordinate this 6 coordinates compositions.
The Intersection detection unit 33 of model enclosure body, for judging the virtual controlling line mapped in real time and 3D models
Enclosure body whether intersect.
Specifically, the Intersection detection unit unit 33 of model enclosure body includes:
Vector function determining module 331, for determining function f (x, y, z) corresponding to the virtual controlling line, f (x, y, z)
Any point is f in the component of x-axis, y-axis, z-axisx(x,y,z)、fy(x,y,z)、fz(x,y,z)。
Intersecting condition judgment module 332, for judge f (x, y, z) any points x-axis, y-axis, z-axis component fx(x,y,
z)、fy(x,y,z)、fzWhether (x, y, z) all meets following condition:
min x≤fx(x,y,z)≤max x;
min y≤fy(x,y,z)≤max y;
min z≤fz(x,y,z)≤max z。
Wherein, the min x, max x, min y, max y, min z, the apex coordinate that max z is the enclosure body.Its
In, minimum vertex coordinate that min x, max x, min y, max y, min z, max z are respectively 3D models in x-axis, maximum top
Point coordinates;Minimum vertex coordinate, maximum vertex coordinate in y-axis;Minimum vertex coordinate, maximum vertex coordinate in z-axis.
Enclosure body intersects judge module 333, for f (x, y, z) any points x-axis, y-axis, z-axis component fx(x,y,
z)、fy(x,y,z)、fzWhen (x, y, z) all meets above-mentioned condition, judge that the virtual controlling line intersects with the enclosure body of 3D models,
Otherwise, it is determined that the enclosure body of the virtual controlling line and 3D models is non-intersect.
The Intersection detection unit 34 of model triangle gridding, for the encirclement body phase in the virtual controlling line and 3D models
During friendship, judge whether the virtual controlling line intersects with any triangle gridding in 3D models corresponding to the enclosure body intersected.
Specifically, the Intersection detection unit 34 of model triangle gridding includes:
Vertex weights value scope judge module 341, the ginseng for triangle corresponding to any triangle gridding in 3D models
Number equation is (1-u-v) V0+uV1+vV2When, origin, the virtual controlling line and 3D moulds in default virtual scene
Three apex coordinates of any triangle gridding in type, judge whether u, v meet following condition:U >=0, v >=0, u+v≤1, its
In, (1-u-v), u, v are respectively the weight on Atria summit;V0,V1,V2For the coordinate on Atria summit.
Triangle gridding Intersection determination module 342, for meeting u >=0 in u, v, when v >=0, u+v≤1, judge the void
Intend control line with any triangle gridding in 3D models corresponding to the enclosure body intersected to intersect, u >=0, v are unsatisfactory in u, v
During >=0, u+v≤1, the virtual controlling line and any triangle gridding in 3D models corresponding to the enclosure body intersected are judged
It is non-intersect.
Specific detection process is identical with embodiment one, and here is omitted.
Model inspection identifying unit 35, for the virtual controlling line with 3D models corresponding to the enclosure body intersected
When any triangle gridding intersects, judge that the virtual controlling line intersects with 3D models corresponding to the enclosure body intersected, to judge to examine
Measure 3D models.
In second embodiment of the invention, due to first being detected to the enclosure body of 3D models, virtual controlling is being judged
After line intersects with the enclosure body of 3D models, just detect virtual controlling line and any one triangle gridding in 3D models whether phase
Hand over, therefore reduce operand, so as to effectively improve the speed and precision of 3D models in detection virtual environment scene.
Can be with it will appreciated by the skilled person that realizing that all or part of step in above-described embodiment method is
The hardware of correlation is instructed to complete by program, described program can be stored in a computer read/write memory medium
In, described storage medium, such as ROM/RAM, disk, CD.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
All any modification, equivalent and improvement made within refreshing and principle etc., should be included in the scope of the protection.
Claims (10)
1. the 3D model checking methods in a kind of virtual scene, it is characterised in that methods described comprises the steps:
The spatial attitude angle of corresponding interaction pen, maps out a virtual controlling line in real time in the virtual scene;
Every 3D models in the corresponding virtual scene, construct an enclosure body respectively, and the enclosure body wraps corresponding
3D models, the 3D models are made up of multiple triangle griddings;
Judge whether the virtual controlling line mapped in real time intersects with the enclosure body of 3D models;
When the virtual controlling line intersects with the enclosure body of 3D models, the virtual controlling line and the enclosure body pair intersected are judged
Whether any triangle gridding in the 3D models answered intersects;
In the virtual controlling line and intersecting any triangle gridding in 3D models corresponding to the enclosure body intersected, described in judgement
Virtual controlling line intersects with 3D models corresponding to the enclosure body intersected, to judge to detect 3D models.
2. the method as described in claim 1, it is characterised in that the spatial attitude angle includes the angle of pitch, roll angle and driftage
Angle;At the spatial attitude angle of the correspondence interaction pen, a virtual controlling line is mapped out in real time in the virtual scene
Before step, comprise the steps:
Determine the interaction pen initial angle of pitch and roll angle;
The final angle of pitch and roll angle are determined according to Kalman filtering and the initial angle of pitch and roll angle iteration;
According to the x-axis of coordinate system, y-axis, the magnetic field intensity of z-axis point where the final angle of pitch and roll angle and interaction pen
Amount, determines the magnetic field strength component in horizontal plane;
Yaw angle is determined according to the magnetic field strength component in the horizontal plane of determination.
3. the method as described in claim 1, it is characterised in that the spatial attitude angle of the correspondence interaction pen, in described
The step of mapping out a virtual controlling line in virtual scene in real time specifically includes:
The spin matrix of the interaction pen is determined according to the attitude angle of the interaction pen;
The inceptive direction of origin and default interaction pen in the spin matrix of the interaction pen, default virtual scene
Vector, real-time rendering goes out corresponding virtual controlling line after the interaction pen rotation in virtual scene.
4. the method as described in claim 1, it is characterised in that described to judge the virtual controlling line mapped in real time and 3D moulds
The step whether enclosure body of type intersects specifically includes:
Function f (x, y, z) corresponding to the virtual controlling line is determined, f (x, y, z) any points are f in the component of x-axis, y-axis, z-axisx
(x,y,z)、fy(x,y,z)、fz(x,y,z);
Judge f (x, y, z) any points x-axis, y-axis, z-axis component fx(x,y,z)、fy(x,y,z)、fzWhether (x, y, z) be all full
It is enough lower condition:
minx≤fx(x,y,z)≤maxx;
miny≤fy(x,y,z)≤maxy;
minz≤fz(x,y,z)≤maxz;
Wherein, described minx, maxx, miny, maxy, minz, maxz are the apex coordinate of the enclosure body;
F (x, y, z) any points x-axis, y-axis, z-axis component fx(x,y,z)、fy(x,y,z)、fz(x, y, z) all meets above-mentioned
During condition, judge that the virtual controlling line intersects with the enclosure body of 3D models, otherwise, it is determined that the virtual controlling line and 3D models
Enclosure body it is non-intersect.
5. the method as described in claim 1, it is characterised in that described corresponding in the virtual controlling line and the enclosure body intersected
3D models in any triangle gridding it is intersecting when, judge the virtual controlling line and 3D models phase corresponding to the enclosure body intersected
Hand over, to be specifically included the step of judging and detect 3D models:
The parametric equation of triangle corresponding to any triangle gridding is (1-u-v) V in 3D models0+uV1+vV2, wherein, (1-u-
V), u, v are respectively the weight on Atria summit;V0,V1,V2For the coordinate on Atria summit;
Three of origin, the virtual controlling line in default virtual scene and any triangle gridding in 3D models
Apex coordinate, judges whether u, v meet following condition:U >=0, v >=0, u+v≤1, if satisfied, judge the virtual controlling line with
Any triangle gridding in 3D models corresponding to intersecting enclosure body intersects, otherwise, it is determined that the virtual controlling line and phase
Any triangle gridding in 3D models corresponding to the enclosure body of friendship is non-intersect.
6. the 3D model inspection devices in a kind of virtual scene, it is characterised in that described device includes:
Virtual controlling line generation unit, for the spatial attitude angle of corresponding interaction pen, mapped out in real time in the virtual scene
One virtual controlling line;
Model enclosure body structural unit, for every 3D models in the corresponding virtual scene, an enclosure body is constructed respectively,
The enclosure body wraps corresponding 3D models, and the 3D models are made up of multiple triangle griddings;
The Intersection detection unit of model enclosure body, for judging the encirclement of the virtual controlling line mapped in real time and 3D models
Whether body intersects;
The Intersection detection unit of model triangle gridding, for when the virtual controlling line intersects with the enclosure body of 3D models,
Judge whether the virtual controlling line intersects with any triangle gridding in 3D models corresponding to the enclosure body intersected;
Model inspection identifying unit, in the virtual controlling line and any three in 3D models corresponding to the enclosure body intersected
When angle grid intersects, judge that the virtual controlling line intersects with 3D models corresponding to the enclosure body intersected, to judge to detect 3D
Model.
7. device as claimed in claim 6, it is characterised in that described device includes:
Initial pitch angle and roll angle determining unit, the angle of pitch and roll angle initial for determining interaction pen;
The final angle of pitch and roll angle determining unit, for according to Kalman filtering and the initial angle of pitch and roll angle
Iteration determines the final angle of pitch and roll angle;
Magnetic field strength component determining unit, for the coordinate system according to where the final angle of pitch and roll angle and interaction pen
X-axis, y-axis, the magnetic field strength component of z-axis, determine the magnetic field strength component in horizontal plane;
Yaw angle determining unit, yaw angle is determined for the magnetic field strength component in the horizontal plane according to determination.
8. device as claimed in claim 6, it is characterised in that the virtual controlling line generation unit includes:
Spin matrix determining module, for determining the spin matrix of the interaction pen according to the attitude angle of the interaction pen;
Virtual controlling line rendering module, for the origin in the spin matrix according to the interaction pen, default virtual scene with
And the inceptive direction vector of default interaction pen, real-time rendering goes out corresponding virtual after the interaction pen rotates in virtual scene
Control line.
9. device as claimed in claim 6, it is characterised in that the Intersection detection unit unit bag of the model enclosure body
Include:
Vector function determining module, for determining function f (x, y, z) corresponding to the virtual controlling line, f (x, y, z) any point
It is f in the component of x-axis, y-axis, z-axisx(x,y,z)、fy(x,y,z)、fz(x,y,z);
Intersecting condition judgment module, for judge f (x, y, z) any points x-axis, y-axis, z-axis component fx(x,y,z)、fy(x,
y,z)、fzWhether (x, y, z) all meets following condition:
minx≤fx(x,y,z)≤maxx;
miny≤fy(x,y,z)≤maxy;
minz≤fz(x,y,z)≤maxz;
Wherein, described minx, maxx, miny, maxy, minz, maxz are the apex coordinate of the enclosure body;
Enclosure body intersects judge module, for f (x, y, z) any points x-axis, y-axis, z-axis component fx(x,y,z)、fy(x,
y,z)、fzWhen (x, y, z) all meets above-mentioned condition, judge that the virtual controlling line intersects with the enclosure body of 3D models, otherwise, sentence
The enclosure body of fixed the virtual controlling line and 3D models is non-intersect.
10. device as claimed in claim 6, it is characterised in that the Intersection detection unit of the model triangle gridding includes:
Vertex weights value scope judge module, the parametric equation for triangle corresponding to any triangle gridding in 3D models are
(1-u-v)V0+uV1+vV2When, appointing in the origin, the virtual controlling line and 3D models in default virtual scene
Three apex coordinates of one triangle gridding, judge whether u, v meet following condition:U >=0, v >=0, u+v≤1, wherein, (1-u-
V), u, v are respectively the weight on Atria summit;V0,V1,V2For the coordinate on Atria summit;
Triangle gridding Intersection determination module, for meeting u >=0 in u, v, when v >=0, u+v≤1, judge the virtual controlling line
With the enclosure body intersected corresponding to any triangle gridding in 3D models intersect, be unsatisfactory for u >=0 in u, v, v >=0, u+v≤
When 1, judge that the virtual controlling line and any triangle gridding in 3D models corresponding to the enclosure body intersected are non-intersect.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410317624.6A CN104102357B (en) | 2014-07-04 | 2014-07-04 | 3D model checking methods and device in a kind of virtual scene |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410317624.6A CN104102357B (en) | 2014-07-04 | 2014-07-04 | 3D model checking methods and device in a kind of virtual scene |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104102357A CN104102357A (en) | 2014-10-15 |
CN104102357B true CN104102357B (en) | 2017-12-19 |
Family
ID=51670557
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410317624.6A Active CN104102357B (en) | 2014-07-04 | 2014-07-04 | 3D model checking methods and device in a kind of virtual scene |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104102357B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106527887B (en) * | 2016-10-18 | 2018-09-04 | 腾讯科技(深圳)有限公司 | Dummy object choosing method, device and VR systems |
EP3502939B1 (en) | 2016-08-19 | 2023-06-14 | Tencent Technology (Shenzhen) Company Limited | Authentication method based on virtual reality scene, virtual reality device, and storage medium |
CN106648355B (en) * | 2016-11-07 | 2020-10-02 | 成都华域天府数字科技有限公司 | 3D model selection method and device |
CN112423035A (en) * | 2020-11-05 | 2021-02-26 | 上海蜂雀网络科技有限公司 | Method for automatically extracting visual attention points of user when watching panoramic video in VR head display |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103076619A (en) * | 2012-12-27 | 2013-05-01 | 山东大学 | System and method for performing indoor and outdoor 3D (Three-Dimensional) seamless positioning and gesture measuring on fire man |
CN103337066A (en) * | 2013-05-27 | 2013-10-02 | 清华大学 | Calibration method for 3D (three-dimensional) acquisition system |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090135177A1 (en) * | 2007-11-20 | 2009-05-28 | Big Stage Entertainment, Inc. | Systems and methods for voice personalization of video content |
US9033805B2 (en) * | 2012-01-19 | 2015-05-19 | Zynga Inc. | Three dimensional operations in an isometric projection |
-
2014
- 2014-07-04 CN CN201410317624.6A patent/CN104102357B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103076619A (en) * | 2012-12-27 | 2013-05-01 | 山东大学 | System and method for performing indoor and outdoor 3D (Three-Dimensional) seamless positioning and gesture measuring on fire man |
CN103337066A (en) * | 2013-05-27 | 2013-10-02 | 清华大学 | Calibration method for 3D (three-dimensional) acquisition system |
Also Published As
Publication number | Publication date |
---|---|
CN104102357A (en) | 2014-10-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103940442B (en) | A kind of localization method and device using acceleration convergence algorithm | |
CN104299244B (en) | Obstacle detection method and device based on monocular camera | |
US8850337B2 (en) | Information processing device, authoring method, and program | |
US9223408B2 (en) | System and method for transitioning between interface modes in virtual and augmented reality applications | |
CN102243074B (en) | Method for simulating geometric distortion of aerial remote sensing image based on ray tracing technology | |
CN110007350B (en) | Analysis method for magnetic detection method blind area | |
CN104102357B (en) | 3D model checking methods and device in a kind of virtual scene | |
CN109991636A (en) | Map constructing method and system based on GPS, IMU and binocular vision | |
CN108052703A (en) | Fast Collision Detection Algorithm based on hybrid hierarchy bounding box | |
CN108170297A (en) | Real-time six degree of freedom VR/AR/MR equipment localization methods | |
CN109752003A (en) | A kind of robot vision inertia dotted line characteristic positioning method and device | |
CN107015654A (en) | Air navigation aid and device based on augmented reality | |
CN105869214A (en) | Virtual reality device based view frustum cutting method and apparatus | |
CN109782901A (en) | Augmented reality exchange method, device, computer equipment and storage medium | |
CN109461208A (en) | Three-dimensional map processing method, device, medium and calculating equipment | |
CN105469445B (en) | A kind of step-length changeably drawing generating method | |
TW201907270A (en) | Reorientation for VR in a virtual reality | |
CN106643717A (en) | Method and device for performance detection of nine-axis sensor | |
CN106370178A (en) | Mobile terminal equipment attitude measurement method and mobile terminal equipment attitude measurement apparatus | |
CN105894551A (en) | Image drawing method and device | |
CN109445620A (en) | A kind of interaction pen automatic identifying method | |
CN110515110A (en) | Method, apparatus, equipment and the computer readable storage medium of data assessment | |
CN105427371B (en) | The method that the elemental areas such as Drawing Object are shown is kept in a kind of three-dimensional perspective projection scene | |
CN104156969B (en) | Plane exploration method based on panoramic image depth map | |
CN108401462A (en) | Information processing method and system, cloud processing device and computer program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |