CN107492150A - A kind of method for realizing dragging in three-dimensional sphere - Google Patents
A kind of method for realizing dragging in three-dimensional sphere Download PDFInfo
- Publication number
- CN107492150A CN107492150A CN201710565973.3A CN201710565973A CN107492150A CN 107492150 A CN107492150 A CN 107492150A CN 201710565973 A CN201710565973 A CN 201710565973A CN 107492150 A CN107492150 A CN 107492150A
- Authority
- CN
- China
- Prior art keywords
- dimensional
- dimensional coordinate
- sphere
- coordinate
- mouse
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
- G06T19/20—Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2219/00—Indexing scheme for manipulating 3D models or images for computer graphics
- G06T2219/20—Indexing scheme for editing of 3D models
- G06T2219/2016—Rotation, translation, scaling
Landscapes
- Engineering & Computer Science (AREA)
- Architecture (AREA)
- Computer Graphics (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The present invention proposes a kind of method for realizing dragging in three-dimensional sphere, including:Obtain the three-dimensional sphere model under three-dimensional scenic and camera matrix locking datum mark, the datum mark are intersected by the 3rd three-dimensional coordinate G with the line segment that the first three-dimensional coordinate A is formed and whole scene, take out the intersecting three-dimensional coordinate D of closest approach the 4th;The mobile mouse, the second two-dimensional coordinate B1 of the point that the mouse is currently moved to is obtained, the second three-dimensional coordinate B and primary vector CB is gone out based on the second two-dimensional coordinate B1 and roaming camera matrix computations;Based on the 4th three-dimensional coordinate D, primary vector CB and line segment OE calculate the 5th three-dimensional coordinate E, and the 5th three-dimensional coordinate E is the position of the datum mark after rotation scene;Based on the 5th three-dimensional coordinate E and the 4th three-dimensional coordinate D, the anglec of rotation and rotary shaft are calculated;The anglec of rotation and rotary shaft based on calculating, rotary camera.Accurate dragging of the object based on Sphere Measurement Model under three-dimensional scenic can be realized by the present invention.
Description
Technical field
The present invention relates to three dimentional graph display to roam field, more particularly to the method for dragging is realized in three-dimensional sphere, its
By calculating camera matrix to mouse click location, and the shift position of mouse in three-dimensional scenic, realize in three-dimensional sphere
In precisely dragging model effect.
Background technology
Moved during dragging of traditional three-dimensional sphere scene to scene, it is necessary to calculate using mouse in window two-dimensional coordinate system
Position go to drag scene, it is but inconsistent due to two three-dimensional coordinates, cause the dragging of three-dimensional scenic not accurate, thing in mouse point
After dragging, the point in mouse position and point is offset body, therefore, when needing precisely dragging, this processing
Mode is then helpless.
The content of the invention
The purpose of the present invention is in view of the shortcomings of the prior art, it is proposed that using mouse down current point two-dimensional coordinate and
The matrix information of principal phase machine is done with the model of whole scene once intersects computing, so as to accurately calculate in three-dimensional sphere scene when
The three-dimensional coordinate LockPoint (point A) of the model points of preceding mouse locking.By computing make left mouse button press after in the scene
Any movement can lock three-dimensional coordinate LockPoint in mouse position.
To realize this purpose, the present invention proposes a kind of method for realizing dragging in three-dimensional sphere, and it includes:
Three-dimensional sphere model and camera matrix under step 1, acquisition three-dimensional scenic;
Step 2, locking datum mark, the line segment that the datum mark is formed by the 3rd three-dimensional coordinate G and the first three-dimensional coordinate A
Intersect with whole scene, take out the intersecting three-dimensional coordinate D of closest approach the 4th;
Step 3, the mobile mouse, the second two-dimensional coordinate B1 of the point that the mouse is currently moved to is obtained, based on the
Two two-dimensional coordinate B1 and roaming camera matrix computations go out the second three-dimensional coordinate B and primary vector CB;
Step 4, based on the 4th three-dimensional coordinate D, primary vector CB and line segment OE calculate the 5th three-dimensional coordinate E, it is described
5th three-dimensional coordinate E is the position of the datum mark after rotation scene;
Step 5, based on the 5th three-dimensional coordinate E and the 4th three-dimensional coordinate D, calculate the anglec of rotation and rotary shaft;
Step 6, the anglec of rotation and rotary shaft based on calculating, rotary camera, so as to realize the accurate of three-dimensional sphere
Dragging.
Wherein, the datum mark is projection of the point currently pressed of mouse on three-dimensional sphere.
Wherein, the first two-dimensional coordinate of the datum mark is converted to three dimensional field by the step 2 including the use of camera matrix
The first three-dimensional coordinate A and the 3rd three-dimensional coordinate G in scape.
Wherein, also include between the step 1 and step 2:Calculate mouse currently press a little in the three-dimensional scenic
Three-dimensional coordinate.
Wherein, the two-dimensional coordinate is located on the remote section of relative roaming camera, and three-dimensional coordinate is located at relative dimensional scene
Coordinate.
Wherein, the step 5 specifically includes:
The centre of sphere of three-dimensional sphere is set as origin
It is assumed that roaming camera is motionless, the dragging for the point that the mouse is clicked on is considered as the 4th three-dimensional coordinate D, the 5th three-dimensional seat
Mark in the first plane that E and the origin are formed, the 4th three-dimensional coordinate D is along spherical rotation angle [alpha];
Now, it is assumed that stone-dead, actual mobile visible roams camera in first plane by raw bits to be described
Put reverse movement angle [alpha].
Wherein, the point A1 pressed when clicking on mouse based on user goes out on the remote section of camera with the camera matrix computations
First three-dimensional coordinate A of point and the 3rd three-dimensional coordinate G of the point on the nearly section of camera.
The present invention can realize accurate dragging of the object based on Sphere Measurement Model under three-dimensional scenic.
Brief description of the drawings
Fig. 1 is that the object by three-dimensional scenic consistent with the embodiment of the present invention drags to the flat of another point from a point
Face schematic diagram;
Fig. 2 is the dragging schematic diagram in three-dimensional scenic consistent with Fig. 1 dragging;
Fig. 3 is the dragging schematic diagram under three-dimensional sphere model consistent with Fig. 2 draggings;
Fig. 4 is to drag mapping graph of the consistent three-dimensional sphere in two dimensional surface with Fig. 3.
Specific embodiment
Based on above content, main core of the invention is:First, to calculate mouse down point two-dimensional coordinate and
The conversion of three-dimensional coordinate, second, the position being moved to according to mouse calculates camera change orientation.
First, two-dimensional coordinate and three-dimensional coordinate conversion
1st, precisely conversion
The two-dimensional coordinate for the point that mouse is currently pressed is converted to the coordinate in three-dimensional scenic, and it is accurate to regard this three-dimensional point
Point LockPoint is captured, calculating below is all calculated on the basis of this.
2nd, direction is changed
The two-dimensional coordinate of point after mouse down is moved is converted into the vector of now three-dimensional scenic using camera matrix
MoveVector (vectorial CB), now scene is static, and the matrix of camera still uses camera matrix when mouse down.
Calculated by initial the three-dimensional coordinate LockPoint and mouse of mouse down point the vector M oveVector moved real
Now precisely dragging
This Drag algorithm mainly has two emphasis.First, model is exactly still in the position that original mouse far comes after dragging
After under mouse point, no matter how how mouse moves, and LockPoint in the position of mouse, i.e., is exactly always briefly that mouse down is grabbed
Take and a little moved as mouse is mobile;Second, the dragging based on three-dimensional sphere.
It is as shown in figure 1, another to be dragged to the consistent object by three-dimensional scenic of the embodiment of the present invention from a point
The floor map of individual point.
Shown in figure, user drags to the object from the point A1 of two-dimensional screen the point B1 of two-dimensional screen.
As shown in Fig. 2 for camera matrix will be used, the point A1 of two-dimensional screen to point B1 is projected near cut from remote section
At the corresponding points D and E in face.Wherein D points are actual position of the object in three-dimensional scenic, and E points are the objects in three-dimensional scenic
Actual position after movement.
As shown in figure 3, for the dragging process to be projected to the stereogram of the three-dimensional sphere of three-dimensional scenic.
As shown in figure 4, the mapping graph of two dimensional surface is mapped to for stereogram shown in Fig. 3.
The implication and its relation at each figure midpoint are as follows:
The keyed end that A clicks the mouse when pressing
The transfer point that B clicks the mouse when pressing but do not lift
Known to C point camera positions
D clicks the mouse when pressing, model points that actual point is chosen (by with whole scene is intersecting calculates)
When E clicks the mouse mobile, point that realistic model is moved to, precisely crawl is realized
F points cross the centre of sphere and are boost line OF vertical vectors CB
Known to O point sphere center positions
OD=OE.
Vectorial CB=moved by mouse after two coordinates and the matrix of camera can be calculated.
Such as figure, accurate dragging is realized, is sought to using the normal vector in ODE faces as axle, rotate α angles,
The normal vector in ODE faces and α angles is asked to be required for first asking the coordinate of E points
E point coordinates is calculated below:
β=vectorial CO and vectorial CB angles;
OF=sin β * OC;
CF=cos β * OC;
EF*EF=OE*OE+OF*OF;
CE=CF-EF;
E points=vectorial CB unit vector * CE.
Operation comprises the following steps above:
Three-dimensional sphere model and camera matrix under step 1, acquisition three-dimensional scenic;
Step 2, locking datum mark, the line segment that the datum mark is formed by the 3rd three-dimensional coordinate G and the first three-dimensional coordinate A
Intersect with whole scene, take out the intersecting three-dimensional coordinate D of closest approach the 4th;
Step 3, the mobile mouse, the second two-dimensional coordinate B1 of the point that the mouse is currently moved to is obtained, based on the
Two two-dimensional coordinate B1 and roaming camera matrix computations go out the second three-dimensional coordinate B and primary vector CB;
Step 4, based on the 4th three-dimensional coordinate D, primary vector CB and line segment OE calculate the 5th three-dimensional coordinate E, it is described
5th three-dimensional coordinate E is the position of the datum mark after rotation scene;
Step 5, based on the 5th three-dimensional coordinate E and the 4th three-dimensional coordinate D, calculate the anglec of rotation and rotary shaft;
Step 6, the anglec of rotation and rotary shaft based on calculating, rotary camera, so as to realize the accurate of three-dimensional sphere
Dragging.
Wherein, the datum mark is projection of the point currently pressed of mouse on three-dimensional sphere.
Wherein, the first two-dimensional coordinate of the datum mark is converted to three dimensional field by the step 2 including the use of camera matrix
The first three-dimensional coordinate A and the 3rd three-dimensional coordinate G in scape.
Wherein, also include between the step 1 and step 2:Calculate mouse currently press a little in the three-dimensional scenic
Three-dimensional coordinate.
Wherein, the two-dimensional coordinate is located on the remote section of relative roaming camera, and three-dimensional coordinate is located at relative dimensional scene
Coordinate.
Wherein, the step 5 specifically includes:
The centre of sphere of three-dimensional sphere is set as origin
It is assumed that roaming camera is motionless, the dragging for the point that the mouse is clicked on is considered as the 4th three-dimensional coordinate D, the 5th three-dimensional seat
Mark in the first plane that E and the origin are formed, the 4th three-dimensional coordinate D is along spherical rotation angle [alpha];
Now, it is assumed that stone-dead, actual mobile visible roams camera in first plane by raw bits to be described
Put reverse movement angle [alpha].
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show
The description of example " or " some examples " etc. means specific features, structure, material or the spy for combining the embodiment or example description
Point is contained at least one embodiment or example of the present invention.In this manual, to the schematic representation of above-mentioned term not
Necessarily refer to identical embodiment or example.Moreover, specific features, structure, material or the feature of description can be any
One or more embodiments or example in combine in an appropriate manner.
Although an embodiment of the present invention has been shown and described, it will be understood by those skilled in the art that:Not
In the case of departing from the principle and objective of the present invention a variety of change, modification, replacement and modification can be carried out to these embodiments, this
The scope of invention is limited by claim and its equivalent.
Claims (6)
1. a kind of method for realizing dragging in three-dimensional sphere, it includes:
Three-dimensional sphere model and camera matrix under step 1, acquisition three-dimensional scenic;
Step 2, locking datum mark, the datum mark by the 3rd three-dimensional coordinate G and the line segment that the first three-dimensional coordinate A is formed with it is whole
Individual scene intersects, and takes out the intersecting three-dimensional coordinate D of closest approach the 4th;
Step 3, the mobile mouse, the second two-dimensional coordinate B1 of the point that the mouse is currently moved to is obtained, based on the two or two
Dimension coordinate B1 and roaming camera matrix computations go out the second three-dimensional coordinate B and primary vector CB;
Step 4, based on the 4th three-dimensional coordinate D, primary vector CB and line segment OE calculate the 5th three-dimensional coordinate E, the described 5th
Three-dimensional coordinate E is the position of the datum mark after rotation scene;
Step 5, based on the 5th three-dimensional coordinate E and the 4th three-dimensional coordinate D, calculate the anglec of rotation and rotary shaft;
Step 6, the anglec of rotation and rotary shaft based on calculating, rotary camera, so as to realize the accurate dragging of three-dimensional sphere.
2. the method for realizing dragging in three-dimensional sphere as claimed in claim 1, wherein, the step 2 is including the use of camera matrix
First two-dimensional coordinate of the datum mark is converted to the first three-dimensional coordinate A and the 3rd three-dimensional coordinate G in three-dimensional scenic.
3. the method for realizing dragging in three-dimensional sphere as claimed in claim 1, wherein, also wrapped between the step 1 and step 2
Include:Calculating mouse currently presses the three-dimensional coordinate in the three-dimensional scenic a little.
4. the method for realizing dragging in three-dimensional sphere as claimed in claim 1, wherein the two-dimensional coordinate is located at relative roaming phase
On the remote section of machine, three-dimensional coordinate is located at relative dimensional scene coordinate.
5. the method for realizing dragging in three-dimensional sphere as claimed in claim 1, wherein the step 5 specifically includes:
The centre of sphere of three-dimensional sphere is set as origin
It is assumed that roaming camera is motionless, the dragging for the point that the mouse is clicked on is considered as the 4th three-dimensional coordinate D, the 5th three-dimensional coordinate E
In the first plane formed with the origin, the 4th three-dimensional coordinate D is along spherical rotation angle [alpha];
Now, it is assumed that stone-dead, actual mobile visible is anti-by home position in first plane for the roaming camera
To move angle α.
6. the method for realizing dragging in three-dimensional sphere as claimed in claim 1, wherein, the point pressed when clicking on mouse based on user
A1 and the camera matrix computations go out the point on the remote section of camera the first three-dimensional coordinate A and the point on the nearly section of camera the 3rd
Three-dimensional coordinate G.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710565973.3A CN107492150A (en) | 2017-07-12 | 2017-07-12 | A kind of method for realizing dragging in three-dimensional sphere |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710565973.3A CN107492150A (en) | 2017-07-12 | 2017-07-12 | A kind of method for realizing dragging in three-dimensional sphere |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107492150A true CN107492150A (en) | 2017-12-19 |
Family
ID=60643711
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710565973.3A Pending CN107492150A (en) | 2017-07-12 | 2017-07-12 | A kind of method for realizing dragging in three-dimensional sphere |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107492150A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108052253A (en) * | 2017-12-28 | 2018-05-18 | 灵图互动(武汉)科技有限公司 | A kind of virtual reality display method for manufacturing contents |
CN110559660A (en) * | 2019-08-02 | 2019-12-13 | 福州智永信息科技有限公司 | method and medium for mouse-to-object drag in Unity3D scene |
-
2017
- 2017-07-12 CN CN201710565973.3A patent/CN107492150A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108052253A (en) * | 2017-12-28 | 2018-05-18 | 灵图互动(武汉)科技有限公司 | A kind of virtual reality display method for manufacturing contents |
CN108052253B (en) * | 2017-12-28 | 2020-09-25 | 灵图互动(武汉)科技有限公司 | Virtual reality display content manufacturing method |
CN110559660A (en) * | 2019-08-02 | 2019-12-13 | 福州智永信息科技有限公司 | method and medium for mouse-to-object drag in Unity3D scene |
CN110559660B (en) * | 2019-08-02 | 2022-05-17 | 宝宝巴士股份有限公司 | Method and medium for mouse-to-object drag in Unity3D scene |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104898947B (en) | A kind of method that GDI electronics map vector scaling and translation are realized based on mouse position | |
CN102848389B (en) | Realization method for mechanical arm calibrating and tracking system based on visual motion capture | |
CN104463108B (en) | A kind of monocular real time target recognitio and pose measuring method | |
CN100585329C (en) | Location system of video finger and location method based on finger tip marking | |
CN104657713B (en) | It is a kind of can anti-posture and expression shape change three-dimensional face calibration method | |
CN108154550A (en) | Face real-time three-dimensional method for reconstructing based on RGBD cameras | |
CN103489214A (en) | Virtual reality occlusion handling method, based on virtual model pretreatment, in augmented reality system | |
EP1059618A3 (en) | three dimensional graphical manipulator | |
CN103500467A (en) | Constructive method of image-based three-dimensional model | |
CN103077546B (en) | The three-dimensional perspective transform method of X-Y scheme | |
CN107218930A (en) | The sextuple position and attitude active measuring method of space circle based on monocular hand-eye system | |
CN101630418A (en) | Integrated method for measurement and reconstruction of three-dimensional model and system thereof | |
CN102221884B (en) | Visual tele-existence device based on real-time calibration of camera and working method thereof | |
CN107492150A (en) | A kind of method for realizing dragging in three-dimensional sphere | |
CN102722908B (en) | Method for position and device are put in a kind of object space in three-dimension virtual reality scene | |
CN107146287A (en) | Two-dimensional projection image to threedimensional model mapping method | |
CN103810746A (en) | Method and device of rendering 3D (three dimensional) model in any orientation | |
CN102768767B (en) | Online three-dimensional reconstructing and locating method for rigid body | |
CN107967054A (en) | The immersion three-dimensional electronic sand table that a kind of virtual reality is coupled with augmented reality | |
CN105550992A (en) | High fidelity full face texture fusing method of three-dimensional full face camera | |
CN106600664A (en) | Drawing method and device of symmetric graph | |
CN113936121A (en) | AR (augmented reality) label setting method and remote collaboration system | |
CN109395375A (en) | A kind of 3d gaming method of interface interacted based on augmented reality and movement | |
CN110363801A (en) | The corresponding point matching method of workpiece material object and workpiece three-dimensional CAD model | |
CN101727679A (en) | Auxiliary line slide block method for interactively selecting any point in three-dimensional geological model |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171219 |