A method, device and medium for realizing point selection target under J2000 coordinate system based on osgEarth
By using the OSG point sprite method and occlusion detection and coordinate transformation in the J2000 coordinate system in the osgEarth simulation scene, the reliability problem of target recognition and interaction in the osgEarth simulation scene is solved, and efficient target selection function is realized, supporting real-time interaction and high-precision display of large-scale targets.
Patent Information
- Application Number
- CN202510402472.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-04-01
AI Technical Summary
In osgEarth simulation scenarios, existing technologies struggle to accurately identify specific targets through intuitive interaction when there are many spatial targets. Furthermore, they fail to effectively address Earth occlusion and coordinate transformation issues, leading to reduced distinguishability between targets and wasted computational resources.
The OSG point sprite method is used to add target points in the J2000 coordinate system. Combining vector normalization and dual geometric condition judgment, occlusion detection is achieved. The camera matrix is used to transform to the screen coordinate system, and the pixel distance threshold is used to determine the point selection, supporting efficient occlusion culling and coordinate transformation.
It achieves highly reliable target recognition and information exchange, reduces the occlusion misjudgment rate, reduces computing resource consumption, supports large-scale real-time target interaction, and meets aerospace-grade accuracy requirements.
Smart Images

Figure CN120408947B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of space target simulation based on osgEarth in the field of aerospace, and particularly relates to a method and device for realizing point selection of a target in a J2000 coordinate system based on osgEarth and a medium. BACKGROUND
[0002] In the field of computer simulation technology, especially in the scenarios of spacecraft orbit visualization and large-scale space target monitoring, a system usually needs to present thousands of space target entities at the same time. In order to ensure the efficiency of scene rendering, the existing technology generally uses a simplified drawing method such as Point Sprite to abstract a complex three-dimensional model into a pixel point in a two-dimensional screen space for display, as shown in FIG. 1. However, this optimization method, while improving the rendering performance, significantly reduces the distinguishability between target entities, and operators cannot accurately identify a specific target and obtain its attribute information through intuitive interaction such as mouse selection. Figure 2
[0003] The traditional point selection determination method is mostly based on a two-dimensional plane coordinate system to construct a collision detection mechanism, which has the following technical limitations: (1) In the osgEarth simulation scene, in order to improve the display efficiency, a point is used to represent each target in the scene when the number of targets in the scene is large, and when a target point is selected by a mouse, it is not possible to distinguish the target attributes represented by each target point. (2) The influence of the Earth's curvature on the visibility of space targets is not considered, and when there is an Earth occlusion between a ground observation point and a target, the point selection response may still be triggered incorrectly. (3) When using a geostationary coordinate system for coordinate conversion, it is difficult to adapt to the dynamic characteristics of the J2000 inertial coordinate system of space targets, resulting in accumulated errors in projection calculation. (4) There is a lack of efficient occlusion removal strategy when traversing a large number of targets, resulting in unnecessary consumption of computing resources. In addition, the existing space visualization scheme based on the osgEarth engine mostly focuses on the rendering of ground features, and has not effectively solved the problem of high-precision conversion between the J2000 coordinate system and the screen coordinate system in deep space environment.
[0004] Therefore, it is urgent to develop a space target point selection determination method suitable for the osgEarth platform and compatible with the J2000 coordinate system, which can ensure the efficiency of scene rendering, accurately determine which target is currently selected through precise Earth occlusion judgment and coordinate conversion mechanism, realize high-reliability target identification and information interaction function, and distinguish targets and display the information of the target itself. SUMMARY
[0005] In view of the above problems, the present application aims to provide a method, device and medium for realizing point selection of a target in a J2000 coordinate system based on osgEarth, which realizes high-reliability target identification and information interaction function and improves display efficiency when the number of targets in an osgEarth simulation scene is large.
[0006] The present application provides a method, device and medium for realizing point selection of a target in a J2000 coordinate system based on osgEarth.
[0007] The first aspect is a method for realizing point selection of a target in a J2000 coordinate system based on osgEarth, which comprises the following steps:
[0008] S1, adding a target point in a simulation scene;
[0009] S2, traversing position information of all target points to determine whether the simulation earth is blocked by a viewpoint position and whether the target point is blocked by the simulation earth;
[0010] S3, converting the J2000 position coordinates of the unblocked target point to a screen coordinate system;
[0011] S4, comparing the screen coordinate system position of the target point with the mouse point selection position to determine whether the current target point is selected by the mouse, and displaying information of the mouse-selected target point.
[0012] Further, in the step S1 of adding the target point, the size, color and map of the target point are set by using an OSG point sprite method.
[0013] Further, in the step S2 of determining whether the target point is blocked by the earth, whether the simulation earth is blocked by the viewpoint position is determined, and the formula is as follows:
[0014] cv = camPos / EarthRadius
[0015] wherein cv is a normalized unit viewpoint position vector to the earth radius, camPos is the current viewpoint position, and EarthRadius is the simulation earth radius.
[0016] When cv.length() < 1, the current viewpoint position is smaller than the earth radius, and the simulation earth is blocked.
[0017] When cv.length() >= 1, the current viewpoint position is greater than or equal to the earth radius, and the simulation earth is not blocked.
[0018] Further, in the step S2 of determining whether the target point is blocked by the earth, whether the target point is blocked by the simulation earth is determined, and the formula is as follows:
[0019] t = Pos / EarthRadius;
[0020] vt = t - cv;
[0021] vhSquared = cv.x() * cv.x() + cv.y() * cv.y() + cv.z() * cv.z() - 1.0;
[0022] vtSquared = vt.x() * vt.x() + vt.y() * vt.y() + vt.z() * vt.z();
[0023] vtDotVc = -(vt.x() * cv.x() + vt.y() * cv.y() + vt.z() * cv.z());
[0024] wherein cv is the current viewpoint normalized to the Earth radius unit viewpoint position vector; t is the target normalized to the Earth radius unit target point position vector; vt is a vector from the viewpoint position to the target position, vhSquared represents the distance from the current viewpoint to the ground, vtSquared represents the distance from the viewpoint to the target direction; vtDotVc is the dot product of vt and cv, respectively, the projection of vtDotVc on vt and cv is calculated, if vtDotVc is greater than vhSquared and vtDotVc * vtDotVc / vtSquared > vhSquared, the current point is not blocked by the simulated earth.
[0025] Further, in the S3, the unblocked target point J2000 position coordinates are converted to screen coordinates; comprising the steps of:
[0026] S31, using the camera observation matrix and the camera projection matrix to transform the current target point J2000 position coordinates, the formula is represented as:
[0027] outpos = outpos * viewMatrix;
[0028] outpos = outpos * projMatrix;
[0029] wherein outpos is the target point position, for easy calculation, a component w is added to the target point, which is converted to "homogeneous coordinates", outpos.w = vec4d outpos(Pos.x(), Pos.y(), Pos.z(), 1), 1 is the initial value of outpos.w, viewMatrix is the camera observation matrix, projMatrix is the camera projection matrix; after matrix transformation, the clipping coordinates are obtained;
[0030] S32, the normalized device coordinates (NDC) are calculated by perspective division, the x and y values of the NDC coordinates are in the space of -1.0 to 1.0, and the z axis is from 0 to 1;
[0031] The formula is:
[0032] outpot.x()=outpos.x() / outpos.w();
[0033] outpot.y()=outpos.y() / outpos.w();
[0034] outpot.z()=outpos.z() / outpos.w();
[0035] When outpos.w<0, it means that the current target point is on the back of the earth, and outpot.x(), outpot.y() and outpot.z() are the coordinates of the target point in the NDC coordinate system.
[0036] S33, the NDC coordinate system coordinates are converted into screen coordinate system coordinates, and the formula is:
[0037] outpos.x=outpos.x()*0.5+0.5;
[0038] outpos.y=outpos.y()*0.5+0.5;
[0039] outpos.z=outpos.z()*0.5+0.5;
[0040] outpos.x, outpos.y and outpos.z are values in the range of 0 to 1.
[0041] S34, the position of the target point in the screen coordinate system is calculated by calculating the value of 0 to 1, and the formula is:
[0042] screenPos.x()=outpos.x*nScreenW;
[0043] screenPos.y()=outpos.y*nScreenH;
[0044] nScreenW and nScreenH are the width and height of the target point in the screen coordinate system.
[0045] Further, the comparison of the position of the target point in the screen coordinate system with the mouse point selection position in S4 to determine whether the current target point is selected by the mouse includes:
[0046] S41, obtain the screen position coordinates mousePos of mouse clicking;
[0047] S42, calculate the position distance of the screen position of mouse clicking and the target point in the screen coordinate position, the formula is:
[0048] disrr=pow(mousePos.x()-screenPos.x(),2)+pow(mousePos.y()-screenPos.y(),2);
[0049] distance=sqrt(disrr);
[0050] Wherein, mousePos.x() is the x point of mouse clicking screen coordinate, mousePos.y() is the y point of mouse clicking screen coordinate;
[0051] S43, set the pixel value pixelSize occupied by the target point, compare the difference value of pixel value pixelSize and position distance, if the difference value between two points is less than pixelSize / 2.0, the mouse clicking position selects the target point.
[0052] Second aspect: an electronic device, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to realize the steps of the method provided in the first aspect.
[0053] Third aspect: a non-transitory computer readable storage medium, having a computer program stored thereon, wherein the computer program is executed by a processor to realize the steps of the method provided in the first aspect.
[0054] The beneficial effects of the present application are:
[0055] 1, the present application adopts OSG point spirit (Point Sprite) method, realizes large number of space target point display, judges which target point is selected by mouse clicking, distinguishes target points, shows the information of target points itself, realizes high reliability target point recognition and information interaction function, and improves display efficiency.
[0056] 2, the present application realizes the shielding detection precision through vector normalization calculation and double geometric condition judgment (vtDotVc>vhSquared and secondary projection verification), completely avoids the misselection problem caused by earth curvature, compared with the traditional two-dimensional plane detection method, the shielding misjudgment rate is reduced, through the accurate earth shielding judgment and coordinate conversion mechanism, the target recognition and information interaction function with high reliability are realized.
[0057] 3, The application adopts J2000 inertial coordinate system to directly carry out space projection calculation, eliminates dynamic error generated by earth rotation of earth-fixed coordinate system, and the cumulative error of ten-level target projection coordinate conversion is small, the space-level precision demand is met, and high-efficiency conversion of dynamic coordinate system can be realized.
[0058] 4, The application fuses point spirit rendering and GPU accelerated matrix operation, reduces coordinate conversion time consumption to less than 5ms, combines two-stage occlusion removal strategies (viewpoint position screening + target point occlusion detection), reduces calculation resource consumption, supports 100,000-level target real-time point selection response, and large-scale target real-time interaction can be realized.
[0059] 5, The application can ensure the consistency of point selection accuracy under different resolutions through the screen coordinate mapping of the dynamic calibration of the viewport size. The point selection error is stably lower than 0.1 pixels, and the screen projection optimization can be adaptively performed.
[0060] 6, The application adopts pixel distance threshold judgment, expands the fault tolerance radius of the point selection operation, cooperates with 7px point pixel optimization, improves the user operation success rate, reduces the response delay, and significantly improves the interaction efficiency.
[0061] 7, The application supports multi-scale simulation from low earth orbit (LEO) to deep space exploration through deep integration of osgEarth engine, meets the high-precision interaction demand of spacecraft rendezvous and docking, effectively solves the inherent contradiction between rendering efficiency and operation accuracy in large-scale space target visualization, and provides a reliable real-time interaction solution for space mission simulation, space situation awareness and other fields. BRIEF DESCRIPTION OF DRAWINGS
[0062] Figure 1 It is a flowchart of the method for realizing point selection target based on osgEarth in J2000 coordinate system of the application;
[0063] Figure 2 It is a schematic view after adding a target point in the osgEarth simulation scene of the application;
[0064] Figure 3 It is a schematic view after mouse point selection target point in the osgEarth simulation scene of the application;
[0065] Figure 4 It is a schematic view of the device (NDC) coordinate system of the application;
[0066] Figure 5 It is a schematic view of the screen coordinate system of the application;
[0067] Figure 6 It is a structural schematic view of the electronic device of the application. DETAILED DESCRIPTION
[0068] Embodiments of the present application are described below in the accompanying drawings, of which examples are shown, wherein identical or similar symbols throughout the various figures denote identical or similar elements or elements having identical or similar functions. The embodiments described below with reference to the drawings are exemplary only, and are merely intended to explain the present application, and are not to be understood as limiting the present application.
[0069] In the implementation of some simulation scenarios in the field of aerospace, when the number of targets in the scene is large, in order to improve the display efficiency, a point is used to represent each target in the scene, which leads to the inability to distinguish each point representing a certain target.
[0070] In view of the above problems, the present application provides a method for realizing point selection of targets (integrated situation points) in the J2000 coordinate system based on osgEarth, Figure 1 The flowchart of the method for realizing point selection of targets in the J2000 coordinate system based on osgEarth provided by the embodiments of the present application is shown, and the method comprises:
[0071] S1, adding target points in the simulation scene.
[0072] As shown in Figure 2 osgEarth is an open-source geospatial SDK and terrain engine that can provide support for (OpenSceneGraph OSG) applications. First, a plurality of target points are added in the simulation scene through the OSG point sprite method, and the size, color and map of the target points are set.
[0073] The OSG point sprite method is an open-source 3D graphics library that supports a variety of graphics rendering functions. In OSG, point sprite is a graphics technology for rendering point-like objects. Point sprite can apply texture mapping, so that each point can have different appearances, such as size, color and map. In space simulation engineering applications, point sprite can be used to visualize a large number of data points, such as space targets such as satellites.
[0074] Through the OSG point sprite method, a large number of space targets can be converted into target point representations.
[0075] S2, traverse the position information of all target points, and judge whether the simulation earth is occluded by the viewpoint position and whether the target points are occluded by the simulation earth.
[0076] Loop through the added target point J2000 position information, marked as Pos, get the current viewpoint position camPos through osgViewer, the Earth radius is EarthRadius, calculate whether the current viewpoint is less than the Earth radius through the current viewpoint position camPos and the Earth radius EarthRadius, the formula is represented as:
[0077] cv = camPos / EarthRadius
[0078] Wherein, cv is the normalized ratio of the viewpoint position and the Earth radius, camPos is the current viewpoint position, and EarthRadius is the simulation Earth radius;
[0079] When cv.length()<1, the current viewpoint position is less than the Earth radius, the viewpoint is located inside the Earth, the Earth is invisible, and the simulation Earth is blocked;
[0080] When cv.length()≥1, the current viewpoint position is greater than or equal to the Earth radius, and the simulation Earth is not blocked.
[0081] Then, it is judged whether the target is blocked by the Earth through the current viewpoint position and the target position, and the formula is represented as:
[0082] vhSquared=cv.x()*cv.x()+cv.y()*cv.y()+cv.z()*cv.z()-1.0;
[0083] t=Pos / EarthRadius;
[0084] vt=t-cv;
[0085] vtSquared=vt.x()*vt.x()+vt.y()*vt.y()+vt.z()*vt.z();
[0086] vtDotVc=-(vt.x()*cv.x()+vt.y()*cv.y()+vt.z()*cv.z());
[0087] Wherein, vtDotVc and vhSquared are defined variables, cv is the current viewpoint normalized to the unit viewpoint position vector of the earth radius; Pos is the target point position, t is the target normalized to the unit target point position vector of the earth radius; vt is the vector from the viewpoint position to the target position, vhSquared represents the distance from the current viewpoint to the ground, vtSquared represents the distance from the viewpoint to the target direction; vtDotVc is the dot product of vt and cv, respectively calculate the projection of vtDotVc on vt and cv, if vtDotVc is greater than vhSquared and vtDotVc*vtDotVc / vtSquared>vhSquared, the current point is not blocked by the simulated earth.
[0088] S2, convert the unblocked target point J2000 position coordinates to screen coordinates.
[0089] Target J2000 position to screen coordinates, convert the current J2000 point position to screen coordinates through osg camera conversion matrix, including:
[0090] Get camera observation matrix:
[0091] viewMatrix = cam->getViewmatrix();
[0092] Get camera projection matrix:
[0093] projMatrix = cam->getProjectionMatrix();
[0094] outpos is the current target point position, for easy calculation, add a component w to the target point, convert to "homogeneous coordinates", the current target point position is vec4d outpos(Pos.x(), Pos.y(), Pos.z(), 1), wherein 1 is the initial value of outpos.w, then convert through the camera observation matrix and the camera projection matrix, viewMatrix is the camera observation matrix, projMatrix is the camera projection matrix, after matrix transformation, the clipping coordinates are obtained;
[0095] outpos = outpos*viewMatrix;
[0096] outpos = outpos*projMatrix;
[0097] After conversion, the normalized device coordinates (NDC) are calculated by perspective division. The x and y values of NDC coordinates are in the space of -1.0 to 1.0, and the z axis is from 0 to 1. If outpos.w < 0 is calculated, it means that the current point is on the back of the earth, and the target point with outpos.w ≥ 0 is removed.
[0098] After conversion, the normalized device coordinates (NDC) are calculated by perspective division. The x and y values of NDC coordinates are in the space of -1.0 to 1.0, and the z axis is from 0 to 1. If outpos.w < 0 is calculated, it means that the current point is on the back of the earth, and the target point with outpos.w ≥ 0 is removed.
[0099] outpot.x()=outpos.x() / outpos.w();
[0100] outpot.y()=outpos.y() / outpos.w();
[0101] outpot.z()=outpos.z() / outpos.w();
[0102] The device coordinate system (x axis to the right, y axis upward, z far point in the center of the plane) is shown in Figure 4 , and the conversion between the device coordinate system and the screen coordinate system is shown in Figure 5 , and the formula is expressed as:
[0103] outpos.x=outpos.x()*0.5+0.5;
[0104] outpos.y=outpos.y()*0.5+0.5;
[0105] outpos.z=outpos.z()*0.5+0.5;
[0106] Calculate the width and height of the current viewport in the screen coordinate system:
[0107] nScreenW=cam->getViewport()->width();
[0108] nScreenH=cam->getViewport()->height();
[0109] Calculate the position of the current point in the screen coordinate system:
[0110] screenPos.x()=outpos.x*nScreenW;
[0111] screenPos.y()=outpos.y*nScreenH;
[0112] screenPos.x() and screenPos.y() are the positions of the target point in the screen coordinate system.
[0113] S4, comparing the target point screen coordinate system position with the mouse point selection position, judging whether the current target point is selected by the mouse, and displaying the information of the mouse-selected target point.
[0114] By comparing the screen position mousePos of the mouse selection and the screen position of the converted J2000 point, it is judged whether the current target point is selected, the pixel value pixelSize occupied by the target point is set, for example, pixelSize=7.0, and the following calculation is performed:
[0115] disrr=pow(mousePos.x()-screenPos.x(),2)+pow(mousePos.y()-screenPos.y(),2);
[0116] distance=sqrt(disrr);
[0117] Wherein, mousePos.x() and mousePos.y() are the positions of the mouse selection position in the screen coordinate system.
[0118] If the distance between the two points is less than pixelSize / 2.0, the current point selection position selects the target point.
[0119] Application example:
[0120] In a satellite simulation monitoring system, 10,000 space targets (J2000 coordinates) are loaded, and when the user clicks the screen:
[0121] The system quickly traverses all targets, and eliminates the target points (about 30%) that are blocked by the earth.
[0122] The remaining target points are calculated by matrix conversion to screen coordinates, which takes <5ms.
[0123] According to the pixel threshold (7px), the selected target is judged, and the error rate is <0.1%.
[0124] Implementation effect:
[0125] The information of the mouse selection point is accurately displayed, the point selection display response time is <10ms, and the real-time requirement of space task is met;
[0126] The shielding calculation accuracy is improved to 99.9%, and the misselection is avoided.
[0127] The coordinate conversion efficiency is improved by 50%, and the real-time interaction of ten thousand targets is supported.
[0128] The application also provides an electronic device, Figure 6 The structure diagram of the electronic device provided by the embodiment of the application is as follows: Figure 6As shown, the electronic device can include a processor, a communications interface, a memory, and a communications bus, wherein the processor, the communications interface, and the memory complete mutual communication through the communications bus. The processor can invoke a logical instruction in the memory, for example, to execute the following method:
[0129] S1, adding a target point in a simulation scene;
[0130] S2, traversing position information of all target points, judging whether the simulation earth is blocked by a viewpoint position and whether the target point is blocked by the simulation earth;
[0131] S3, converting J2000 position coordinates of an unblocked target point to a screen coordinate system;
[0132] S4, comparing a screen coordinate system position of the target point with a mouse point selection position, judging whether the current target point is selected by the mouse, and displaying information of the mouse-selected target point.
[0133] In addition, the logical instruction in the memory described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0134] The embodiments of the present application also provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method provided by the above-mentioned embodiments, for example, including:
[0135] S1, adding a target point in a simulation scene;
[0136] S2, traversing position information of all target points, judging whether the simulation earth is blocked by a viewpoint position and whether the target point is blocked by the simulation earth;
[0137] S3, converting J2000 position coordinates of an unblocked target point to a screen coordinate system;
[0138] S4, comparing the target point screen coordinate system position with the mouse point selection position, judging whether the current target point is selected by the mouse, and displaying the information of the mouse-selected target point.
[0139] The apparatus embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0140] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0141] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for realizing point selection target under J2000 coordinate system based on osgEarth, characterized in that, The method comprises the steps of: S1, adding a target point in a simulation scene; S2, traversing position information of all target points to determine whether the simulation earth is blocked by a viewpoint position and whether the target point is blocked by the simulation earth; S3, converting J2000 position coordinates of the unblocked target point to a screen coordinate system; S4, comparing the screen coordinate system position of the target point with a mouse point selection position to determine whether the current target point is selected by the mouse, and displaying information of the mouse-selected target point; In S3, the J2000 position coordinates of the unblocked target point are converted to the screen coordinate system; The method comprises the steps of: S31, transforming the J2000 position coordinates of the current target point using a camera observation matrix and a camera projection matrix, and the formula is: outpos = outpos * viewMatrix; outpos = outpos * projMatrix; Wherein, outpos is the target point position, for easy calculation, a component w is added to the target point, which is converted to "homogeneous coordinates", outpos.w = vec4d outpos(Pos.x(), Pos.y(), Pos.z(), 1), 1 is the initial value of outpos.w, viewMatrix is the camera observation matrix, and projMatrix is the camera projection matrix; after matrix transformation, the clipping coordinates are obtained; S32, the normalized device coordinates (NDC) are calculated by perspective division, and the x and y values of the NDC coordinates are in the space of-1.0 to 1.0, and the z axis is from 0 to 1; The formula is: outpot.x() = outpos.x() / outpos.w(); outpot.y() = outpos.y() / outpos.w(); outpot.z() = outpos.z() / outpos.w(); Wherein, when outpos.w < 0, it indicates that the current target point is on the back of the earth; S33, the NDC coordinate system coordinates are converted into screen coordinate system coordinates, and the formula is: outpos.x = outpos.x() * 0.5 + 0.5; outpos.y = outpos.y() * 0.5 + 0.5; outpos.z = outpos.z() * 0.5 + 0.5; Wherein, outpos.x, outpos.y and outpos.z are values in the range of 0 to 1; S34, the position of the target point in the screen coordinate system is calculated using the calculated 0 to 1 value, and the formula is: screenPos.x() = outpos.x * nScreenW; screenPos.y() = outpos.y * nScreenH; Wherein, nScreenW and nScreenH are the width and height of the target point in the screen coordinate system.
2. The method for realizing point selection target under J2000 coordinate system based on osgEarth according to claim 1, characterized in that, The target point is added in the S1, and the OSG point wizard method is used to set the size, color and map of the target point.
3. The method for realizing point selection target under J2000 coordinate system based on osgEarth according to claim 1, characterized in that, In the S2, the target point is judged whether it is blocked by the earth, and the formula is: cv = camPos / EarthRadius Wherein, cv is the unit view position vector normalized to the earth radius, camPos is the current view position, and EarthRadius is the simulation earth radius. When cv.length() < 1, the current view position is less than the earth radius, and the simulation earth is blocked. When cv.length() ≥ 1, the current view position is greater than or equal to the earth radius, and the simulation earth is not blocked.
4. The method for realizing point selection target under J2000 coordinate system based on osgEarth according to claim 1, characterized in that, In the S2, the target point is judged whether it is blocked by the earth, and the formula is: t = Pos / EarthRadius; vt = t - cv; vhSquared = cv.x() * cv.x() + cv.y() * cv.y() + cv.z() *cv.z() - 1.0; vtSquared = vt.x() * vt.x() + vt.y() * vt.y() + vt.z() * vt.z(); vtDotVc = -(vt.x() * cv.x() + vt.y() *cv.y() + vt.z() * cv.z()); Wherein, cv is the unit view position vector normalized to the earth radius; Pos is the target point position, t is the target point position vector normalized to the earth radius; vt is the vector from the view position to the target position, vhSquared represents the distance from the current view to the ground, vtSquared represents the distance from the view to the target direction; vtDotVc is the dot product of vt and cv, respectively calculates the projection of vtDotVc on vt and cv, if vtDotVc is greater than vhSquared and vtDotVc * vtDotVc / vtSquared > vhSquared, the current point is not blocked by the simulation earth.
5. The method for realizing point selection target under J2000 coordinate system based on osgEarth according to claim 1, characterized in that, In the S4, the target point screen coordinate system position and the mouse point selection position are compared, and it is judged whether the current target point is selected by the mouse, including: S41, the screen position coordinates mousePos of the mouse point selection are obtained; S42, the position distance of the mouse point selection screen position and the target point screen coordinate position is calculated, and the formula is: disrr=pow(mousePos.x()-screenPos.x(),2)+pow(mousePos.y()-screenPos.y(),2); distance=sqrt(disrr); Wherein, mousePos.x() is the x point of the mouse point selection screen coordinate, and mousePos.y() is the y point of the mouse point selection screen coordinate; S43, setting a pixel value pixelSize occupied by the target point, comparing the pixel value pixelSize with the difference of the position distance, if the difference between the two points is less than pixelSize / 2.0, the mouse point selection position selects the target point.
6. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the steps of the method for implementing point selection target under J2000 coordinate system based on osgEarth according to any one of claims 1 to 5 when executing the program.
7. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method for implementing point selection target under J2000 coordinate system based on osgEarth according to any one of claims 1 to 5.
Citation Information
Patent Citations
Construction method for 3D dynamic visual simulation platform for multimode navigation
CN106845032A
Giant constellation ground coverage capability analysis simulation system and method based on cellular grid
CN117527034A