CN118015183A - Model array replication generation method, device and medium in three-dimensional virtual scene modeling - Google Patents

Model array replication generation method, device and medium in three-dimensional virtual scene modeling Download PDF

Info

Publication number
CN118015183A
CN118015183A CN202311871809.7A CN202311871809A CN118015183A CN 118015183 A CN118015183 A CN 118015183A CN 202311871809 A CN202311871809 A CN 202311871809A CN 118015183 A CN118015183 A CN 118015183A
Authority
CN
China
Prior art keywords
array
model
user
bounding box
vector
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
Application number
CN202311871809.7A
Other languages
Chinese (zh)
Inventor
请求不公布姓名
卞振伟
黄坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Shibite Robot Co Ltd
Original Assignee
Hunan Shibite Robot Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Shibite Robot Co Ltd filed Critical Hunan Shibite Robot Co Ltd
Priority to CN202311871809.7A priority Critical patent/CN118015183A/en
Publication of CN118015183A publication Critical patent/CN118015183A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a model array replication generation method, a device and a medium in three-dimensional virtual scene modeling, wherein the method comprises the following steps: after a model array copying function is started, a model array arrangement mode selected by a user is obtained; detecting the operation of selecting the target model object by a user, recording the coordinate position of the target model object and calculating the corresponding bounding box size; creating a plurality of bounding boxes of the same size; when a copy request operation is received, starting to detect the position of a user operation point, mapping the position into a virtual scene, and updating the position of each bounding box in the bounding box array according to the starting point position, the end point position and the model array arrangement mode selected by a user; when a confirmation request operation is received, updating the positions of the bounding box arrays is stopped, data are copied to the positions of the bounding boxes respectively, and a model array is generated. The virtual scene modeling method and device can intelligently and rapidly realize the copy of the model array in the virtual scene, and remarkably improve the efficiency, the accuracy and the user experience of the virtual scene modeling.

Description

Model array replication generation method, device and medium in three-dimensional virtual scene modeling
Technical Field
The present invention relates to the field of three-dimensional virtual scene modeling technologies, and in particular, to a method, an apparatus, and a medium for generating model array replication in three-dimensional virtual scene modeling.
Background
In three-dimensional modeling and virtual scene design, it is often necessary to quickly build up an array of models to create a large-scale layout of objects in a virtual scene. In the prior art, a virtual scene construction tool and three-dimensional modeling software generally provide a function of manually copying and pasting objects, namely, after a user manually selects an object to be copied, a copy model is generated by using the copy and paste function, only one model can be copied and generated once per operation, if a model array is required to be generated, a plurality of models are formed by repeating operation and copying for many times, and then the position and the rotation angle of each copy model are manually adjusted, so that the required model array can be finally generated. The following problems exist in this type of manual replication of model arrays:
(1) The operation process is very tedious, time-consuming and labor-consuming, and especially when a large-scale model array is created, the modeling efficiency is very low, the quick construction of a virtual scene is not facilitated, and errors are easy to cause.
(2) If the model parameters, such as the position and rotation angle of the model, are required to be adjusted, only manual adjustment can be performed on each model respectively, which is very time-consuming, adjustment accuracy is difficult to ensure, and the distance between the models may be inconsistent or the angle is inaccurate, so that the layout is inaccurate, and the quality of the virtual scene is reduced.
(3) For a specific model array, the user also needs to calculate corresponding angle and distance parameters, which further increases the modeling difficulty.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: aiming at the technical problems existing in the prior art, the invention provides the method, the device and the medium for generating the model array replication in the three-dimensional virtual scene modeling, which have the advantages of simple implementation method, low cost, high replication efficiency and high precision, can intelligently and rapidly realize the model array replication in the virtual scene, and remarkably improve the efficiency, the accuracy and the user experience of the virtual scene modeling.
In order to solve the technical problems, the technical scheme provided by the invention is as follows:
A model array replication generation method in three-dimensional virtual scene modeling comprises the following steps:
after a model array copying function is started, obtaining a model array arrangement mode selected by a user and initial model parameters;
Detecting the operation of selecting the target model object to be copied by a user, and when detecting that the target model object is selected by the user, recording the coordinate position of the target model object and calculating the corresponding bounding box size;
creating a plurality of bounding boxes with the same size according to the bounding box size of the target model object to form a bounding box array;
When a copy request operation of a user is received, starting to detect the position of a user operation point, mapping the position of the user operation point to a plane where the position height of a target model object in a virtual scene is located, and updating the position of each bounding box in the bounding box array according to the starting point position and the end point position selected by the user, the model array arrangement mode selected by the user and the initial model parameters;
When a confirmation request operation of a user is received, updating the positions of the bounding box arrays is stopped, data of the target model object are copied to the positions of the bounding boxes in the bounding box arrays respectively, and a required model array is generated.
Further, the model array arrangement mode comprises a linear array mode and an annular array mode, wherein the linear array mode is that all units in the array are arranged in a linear mode according to a specified interval, and the annular array mode is that all units in the array are arranged in an annular mode according to a specified interval.
Further, when it is detected that the user selects the linear array mode, the position niPos of each bounding box in the bounding box array is updated according to the formula niPos = startPos +offset, where i=1 to n are the numbers of the bounding boxes, n is the number of the bounding boxes in the bounding box array, startPos is the starting point position coordinate, offset is the offset between the ending point position coordinate and the starting point position coordinate, and the angle of the bounding box array is obtained according to the included angle between a first vector and a second vector, where the first vector is the vector where the orientation of the target model object is located, and the second vector is the vector between the starting point position and the ending point position.
Further, when the fact that the user selects the annular array mode is detected, an identifier is generated at the position of the user operation point position after mapping, the generated position of the identifier is taken as the circle center, the distance between the circle center and the target model object is taken as the radius, and the position of each bounding box in the bounding box array is updated.
Further, when the position of each bounding box in the bounding box array is updated, an included angle between the world Z-axis direction dz and a vector v1 is calculated, where the vector v1 is a vector obtained by subtracting the center coordinates from the mapping coordinates obtained by mapping the user operation point, the position of each bounding box in the bounding box array is niPos =quaternion.
Further, the method further comprises a model parameter adjustment step, and the model parameter adjustment step comprises the following steps:
detecting modification data of a user on model parameters;
and modifying the data according to the detected model parameters to adjust the corresponding parameter states of the model array.
Further, when it is detected that the user selects the linear array mode, the model parameters include any one or more of an angle, a distance and a number, and adjusting the corresponding parameter states of the model array according to the detected model parameter configuration data includes:
If angle parameter modification data are detected, rotating the world Z-axis direction vector by a designated angle according to the modification data to obtain a new v1 unit vector, recalculating the end position and the offset according to the new v1 unit vector, and further calculating the position of the model array according to the recalculated offset and updating;
If the distance parameter modification data are detected, a new end point position is calculated according to the modification data and a direction vector v2 between the initial position and the end point position before modification, an offset is recalculated according to the new end point position, and then a new array model position is calculated according to the recalculated offset and updated.
If the distance parameter modification data is detected, regenerating a corresponding number of array models, calculating the position of a new array model according to the current offset and updating.
Further, when it is detected that the user selects the annular array mode, the model parameters include any one or more of an angle, a radius and a number, and adjusting the corresponding parameter states of the model array according to the detected model parameter configuration data includes:
If the angle parameter modification data are detected, recalculating the coordinate positions of the models in the array according to the modified angle data and updating the coordinate positions;
If radius parameter modification data are detected, recalculating the circle center position according to the modification data and a direction vector v2 from the target model object to the circle center before modification, calculating the positions of the models in the model array according to the recalculated circle center position, and updating;
If the quantity parameter modification data is detected, regenerating a corresponding quantity of array models, and recalculating the positions of the models and updating.
A computer apparatus comprising a processor and a memory for storing a computer program, the processor being for executing the computer program to perform a method as described above.
A computer readable storage medium storing a computer program which, when executed by a processor, implements a method as described above.
Compared with the prior art, the invention has the advantages that:
1. According to the invention, a user can quickly establish a batch of model arrays, complicated manual operation is reduced, the method can be suitable for complex scene modeling tasks, quick replication of model arrays with various sizes is realized, the whole operation process is simple, model parameters can be automatically calculated in the process of establishing the model arrays, so that efficient and accurate layout of virtual scene models can be realized, the efficiency and accuracy of virtual scene modeling are greatly improved, the operation difficulty of the user can be reduced, and the user experience is improved.
2. According to the invention, the model array parameters are generated in an editable mode according to the initial model parameters, and then the angles, the intervals, the quantity and other states of the model array are automatically adjusted according to the modification data of the user when the adjustment is needed, so that the user can flexibly adjust the parameters of the model array according to the requirements, the modeling requirements of different scenes are met, the flexibility of scene modeling is improved, the layout accuracy of the model array can be ensured, the errors and inaccuracy of manual adjustment of the user are reduced, and the modeling accuracy is improved.
Drawings
Fig. 1 is a schematic flow chart of an implementation of a model array copy generation method in three-dimensional virtual scene modeling in embodiment 1 of the present invention.
Fig. 2 is a detailed flowchart of the implementation of model array copy generation in three-dimensional virtual scene modeling in embodiment 1 of the present invention.
Fig. 3 is a schematic diagram of an effect of model array copy generation in implementing three-dimensional virtual scene modeling in embodiment 2 of the present invention.
Fig. 4 is a schematic diagram of the effect of the first stage of model array copy generation in implementing three-dimensional virtual scene modeling in embodiment 3 of the present invention.
Fig. 5 is a schematic diagram of a second stage effect of model array copy generation in implementing three-dimensional virtual scene modeling in embodiment 3 of the present invention.
Detailed Description
The invention is further described below in connection with the drawings and the specific preferred embodiments, but the scope of protection of the invention is not limited thereby.
Example 1:
as shown in fig. 1, the method for generating model array replication in three-dimensional virtual scene modeling according to the embodiment includes the following steps:
and S01, after a model array copying function is started, obtaining a model array arrangement mode selected by a user and initial model parameter setting.
In an alternative embodiment, in the three-dimensional virtual scene construction environment, by setting a model array replication function button, when the user clicks the button, that is, the model array replication function is started, the model array arrangement mode selected by the user starts to be detected. The model array arrangement mode can be set into a linear array mode, an annular array mode and the like according to actual requirements, wherein the linear array mode is that all units in the array are arranged in a linear mode according to specified intervals, and the annular array mode is that all units in the array are arranged in an annular mode according to specified intervals. The model array arrangement mode can also be provided for user selection by setting corresponding buttons.
It can be understood that, besides the above modes, other modes can be adopted according to actual demands, for example, the mode of starting the model array replication function is triggered by a specific clicking mode, a list mode is adopted to allow a user to select the model array replication mode, besides the linear arrangement mode and the annular arrangement mode, the user can select other different arrangement modes according to specific demands, and the diversity of arrangement is increased.
In an alternative embodiment, the model parameters are related parameters such as model angle, inter-model distance, etc. The model parameter settings of different model array arrangement modes are different. For example, the model parameters in the linear array mode include the angle of the models, the distance between the models, the number of models, and the like. Model parameters for the annular array mode include the angle of the model, the radius of the annulus, the number of models, etc. The model parameters can be specifically configured according to actual requirements.
And S02, detecting the operation of selecting the target model object to be copied by the user, recording the coordinate position of the target model object and calculating the corresponding bounding box size when the target model object selected by the user is detected.
In an alternative embodiment, after the model array copying function is started, the user's selection operation on the target model object is started, if the user selects a certain target model object, the coordinate position of the target model object is recorded and saved, and meanwhile, the length, width and height of a rectangular bounding box surrounding the target model object are calculated to obtain the size data of the bounding box, and the bounding box is displayed at the target model object to identify that the bounding box has been selected.
S03, creating a plurality of bounding boxes with the same size according to the bounding box size of the target model object to form a bounding box array.
In an alternative embodiment, a plurality of bounding boxes with the same size are synchronously copied according to the size of the bounding box of the target model object, and each copied bounding box is displayed in the interface, wherein the copy number of the models can be set in advance through model parameters.
And S04, when a copy request operation of a user is received, starting to detect the position of a user operation point, mapping the position of the user operation point to a plane where the position height of a target model object in the virtual scene is located, and updating the positions of the bounding boxes in the bounding box array according to the starting point position selected by the user, the position of the user operation point, the model array arrangement mode selected by the user and the initial model parameters.
In an alternative embodiment, the user sends the copy request operation through the mouse click operation or other specified operation, and when the mouse click operation or other specified operation of the user is detected, the detection of the position of the user operation point is further started, for example, the position of the user mouse is detected, the position of the user mouse is taken as a starting point when the mouse clicks operation, the real-time movement position of the mouse is taken as an end point position, and the position of the bounding box array is updated in real time according to the initial model parameter configuration according to the user selected starting point position, end point position and the user selected model array configuration mode, so that the effect that the bounding box array changes correspondingly along with the change of the user operation point is presented. For example, if the model is a linear array model, determining the position of the bounding box array according to the starting point position and the real-time position of the operating point selected by the user, so that the bounding box array is in linear arrangement, determining the angle, the distance, the number and the like of the model according to the initial model parameter configuration, and updating the position of the bounding box array after the operating point of the user moves.
According to the embodiment, before the confirmation operation is received, the positions of the bounding boxes in the bounding box array are updated in real time according to the positions of the user operation points, so that the functions of instant preview and real-time feedback can be achieved, the model array copying state can be displayed to the user in real time when the positions of the different operation points are displayed, the user can better understand the layout of the model array, and errors and unsatisfied conditions are reduced.
It can be understood that the detection of the copy request operation and the detection of the user operation point can be realized in other modes besides the above mode according to the actual demand configuration. For example, a double click or other specific clicking manner may be used to click on a location of the target model object as a copy request operation.
And S05, stopping updating the positions of the bounding box arrays when receiving confirmation request operation of a user, and copying data of the target model object to the positions of all bounding boxes in the bounding box arrays respectively to generate a required model array.
In an alternative embodiment, if a confirmation request operation of a user, such as a mouse click operation of the user, is detected during the process of updating the position of the bounding box array in real time, the position of the bounding box array is stopped from being updated by taking the confirmation operation of the user as a final end position, that is, the position of the bounding box array is determined, and after the data of the target model object are copied to the positions of the bounding boxes, the model array consisting of a plurality of models can be directly generated in batches.
According to the method, a user can quickly establish a batch of model arrays, complicated manual operation is reduced, the method can be suitable for complex scene modeling tasks, quick replication of model arrays with various sizes is achieved, the whole operation process is simple, model parameters can be automatically calculated in the process of establishing the model arrays, efficient and accurate layout of virtual scene models can be achieved, efficiency and accuracy of virtual scene modeling are greatly improved, operation difficulty of the user can be reduced, and user experience is improved.
In an alternative embodiment, the method further comprises a model parameter adjustment step, the model parameter adjustment step comprising:
detecting modification data of a user on model parameters;
and modifying the data according to the detected model parameters to adjust the corresponding parameter states of the model array.
In the conventional model replication method, once the model array is created, if the layout needs to be changed or the number of replication objects needs to be increased/decreased, the user needs to perform manual operations again, which makes it difficult to further adjust and maintain the model. According to the application, the model array parameters are generated in an editable mode according to the initial model parameters, and then the angles, the intervals, the quantity and other states of the model array are automatically adjusted according to the modification data of the user when the adjustment is needed, so that the user can flexibly adjust the parameters of the model array according to the requirements, the modeling requirements of different scenes are met, the flexibility of scene modeling is improved, the layout accuracy of the model array can be ensured, the errors and inaccuracy of manual adjustment of the user are reduced, and the modeling accuracy is improved. The user can immediately see the change of the model array when adjusting the parameters, does not need to wait for a complex calculation process, can realize a real-time feedback function, and further improves the modeling efficiency of the user.
In an alternative embodiment, the above scheme is implemented by adopting an intelligent interaction technology, so that the user can adjust the layout in an intuitive manner, and the interactivity between the user and the virtual scene can be increased.
In a specific application embodiment, the first click of the mouse is used as a start copy request, the second click of the mouse is used as a confirm copy request, namely, the first click of the mouse is detected as a starting position, the start of the real-time update calculation of the position of the bounding box array is started, the second click of the mouse is used as a determined end position, and the update is stopped. As shown in fig. 2, firstly, whether a model is selected is detected, and if the model is selected, a surrounding square array with the size of the model is generated; detecting whether a mouse clicks, if so, calculating an angle and a distance and surrounding square array positions according to the position of the mouse, and updating and displaying; detecting whether the mouse clicks again, if so, determining the end point position, and stopping updating the model array position; detecting whether the parameters in the model parameter setting panel are modified, if so, recalculating the model array position, updating the array effect, and if the pressing of the confirm button is detected, generating a final array.
Example 2:
The present embodiment is basically the same as embodiment 1, except that the present embodiment is a case where the model array arrangement mode selected by the user is a linear array mode. After a model array copying function is started, detecting that a user selects a linear array mode, wherein model parameters in the linear array mode comprise angles, distances, quantity and the like, when the positions of all bounding boxes in the bounding box array are updated in real time, the positions of all the bounding boxes in the bounding box array are updated according to niPos = startPos +offset, wherein i=1-n are sequence numbers of the bounding boxes, n is the quantity of the bounding boxes in the bounding box array, startPos is a starting point position coordinate, offset is an offset between an end point position coordinate and the starting point position coordinate, the angle of the bounding box array is obtained according to an included angle between a first vector and a second vector, the first vector is a vector in which the orientation of a target model object is located, and the second vector is a vector between the starting point position and the end point position.
In this embodiment, the specific step of adjusting the corresponding parameter states of the model array according to the detected model parameter configuration data includes:
If the angle parameter modification data are detected, the world Z-axis direction vector is rotated by a designated angle according to the modification data to obtain a new v1 unit vector, the end position and the offset are recalculated according to the new v1 unit vector, and then the position of the model array is calculated and updated according to the recalculated offset.
Specifically, when it is detected that the angle parameter is modified, the world Z-axis direction vector is rotated by an angle to obtain a v1 unit vector, the end position endPos is recalculated according to endPos = startPos +distance v1, the offset value offset is recalculated according to the formula offset= endPos-startPos, the new array model position is calculated according to the formula niPos = startPos +offset i (i=1 to n) according to the offset value offset, and the position of the model array is updated.
If the distance parameter modification data are detected, a new end point position is calculated according to the modification data and a direction vector v2 between the initial position and the end point position before modification, an offset is recalculated according to the new end point position, and then a new array model position is calculated according to the recalculated offset and updated.
Specifically, when a modification of the distance parameter is detected, the end position is calculated according to the formula endPos = startPos +distance v2.normalized according to the original direction vector v2= endPos-startPos from the start position to the end position, normalize represents vector normalization for maintaining the direction of the vector unchanged, the offset is recalculated according to the formula offset= endPos-startPos according to the new endPos, the new array model position is calculated according to the formula niPos = startPos +offset i (i=1 to n) according to the offset, and the position of the model array is updated.
If the distance parameter modification data is detected, regenerating a corresponding number of array models, calculating the position of a new array model according to the current offset and updating.
Specifically, when the modification of the quantity parameter is detected, a corresponding quantity of array models are regenerated, new array model positions are calculated according to the offset according to the formula niPos = startPos +offset, and the positions of the array models are updated.
The following takes a state machine to implement the replication process of the model array in a specific application embodiment as an example, and includes three states of switching, specifically:
State one: detecting target model objects
After detecting that a user starts a linear array mode, switching to a first state, after detecting that the user selects a model object, recording the coordinate position of the model as p1 (x 1, y1, z 1), calculating the length, width and height size s1 of a bounding box of the model, creating n square bounding boxes according to the number n of arrays initially configured, wherein the position and the length, width and height size are the same as those of the selected model object, and switching to a second state.
State two: real-time update adjustment array
Starting to detect a user clicking mouse event during the state, when the user clicking mouse is detected, mapping the mouse position onto a plane with the height of the model position height y1 in the virtual scene, recording the starting point position as mapping coordinates startPos (x 2, y1, z 2), mapping the user mouse position (operation point position) onto the plane every frame to obtain a real-time end point position endPos (x 3, y1, z 3), subtracting the starting point position from the end point position coordinate to obtain an offset (x 3-x2,0, z3-z 2), and obtaining coordinate positions niPos = startPos +offset i (i=1-n) of n bounding boxes in the model array, and updating the bounding box array position in real time.
Wherein, the distance in the model parameter is the distance between the two points of the starting point and the end point, and the calculation mode is distance= v ((x 3-x 2) 2+ (z 3-z 2) 2); the angle is the angle between the model object towards the a vector and the vector b from the start point to the end point, and is calculated in such a way that angle=vector 3.Angle (a, b) ×mathf. Sign (vector 3.Dot (n, vector3.Cross (a, b))), wherein vector3.Angle (a, b) represents the angle between the a vector and the b vector, mathf. Sign (n) represents the sign of n, 1 if n is a positive number, -1 if n is a negative number, -0 if n is a 0, vector3.Cross (a, b) represents the cross product of the a, b vectors, and vector3.Dot (a, b) represents the dot product of the a, b vectors. Therefore, the real-time distance and angle data can be calculated and displayed on the parameter panel, so that the model array can be observed and generated in real time to be in a parameter state.
When the second mouse click operation of the user is detected, the final end position is determined, the position of the entire model array is not updated any more, as shown in fig. 3 (b), and then the state is switched to the state three.
State three: detecting parameter adjustment array effects
During this state, modification events of parameters on the parameter setting panel are turned on to adjust the corresponding array effects, including angle, distance, and number of models, etc.
Angle: when the angle parameter is detected to be modified, the world Z-axis direction vector is rotated by an angle to obtain a v1 unit vector, the end point position endPos = startPos +distance v1 is recalculated, the offset amount offset= endPos-startPos is recalculated, the new array model position niPos = startPos +offset i (i=1-n) is calculated according to the offset, and the position of the model array is updated.
Distance: when a modification of the distance parameter is detected, the end position endPos = startPos +distance v2.normalized is calculated from the original direction vector v2= endPos-startPos, the offset value offset= endPos-startPos is recalculated from the new endPos, the new array model position niPos = startPos +offset i (i is 1-n) is calculated from the offset and the position of the model array is updated.
Quantity: when a number parameter modification is detected, a corresponding number of array models are regenerated, new array model positions niPos = startPos +offset i (i is 1-n) are calculated according to the offset and the positions of the array models are updated.
After detecting that the user presses the confirm button, the linear array model of the target model is finally generated according to the array pre-generation position, and as shown in fig. 3 (c), the state is switched back to the state to wait for the next copy.
Example 3:
The present embodiment is basically the same as embodiment 1, except that the present embodiment is a case where the model array arrangement mode selected by the user is a circular array mode. The model parameters in the annular array mode comprise parameters such as angles, radiuses and quantity, after a model array copying function is started, when the user selects the annular array mode, after the copying request operation of the user is received, an identifier is generated at the position (the position of the user operation point is mapped to the position carried on the plane where the position height of the target model object in the virtual scene is located) after the position mapping of the user operation point is received, and the positions of the bounding boxes in the bounding box array are updated according to the positions of the generated identifiers serving as circle centers and the distances from the circle centers to the target model object serving as radiuses.
In this embodiment, when updating the position of each bounding box in the bounding box array, specifically, an angle between the world Z-axis direction dz and a vector v1 is obtained according to the formula angle=vector3.angle (dz, v 1), where the vector v1 is a vector obtained by subtracting the center coordinates from the mapping coordinates obtained by mapping the user operation points, the position of each bounding box in the bounding box array is niPos =quaternion.angle (i×angle, vector3.up) ×p 1-startPos) + startPos, i=1 to n is the number of bounding boxes in the bounding box array, n is the starting point position coordinates, startPos is the starting point position coordinates, quaternion.angle is (a, b) is the rotation reference axis direction, vector3.up is the Y-axis quantity with coordinates of (0, 1, 0), and p1 is the position of a state in which p1 is the model (x 1, Z1).
In this embodiment, the step of adjusting the corresponding parameter states of the model array according to the detected model parameter configuration data includes:
if the angle parameter modification data are detected, the coordinate positions of the models in the array are recalculated and updated according to the modified angle data.
Specifically, when the modification of the angle parameter is detected, the coordinate positions of n models in the array are calculated according to the formula niPos =quaternion.
If radius parameter modification data are detected, recalculating the circle center position according to the modification data and a direction vector v2 between the target model object and the circle center before modification, calculating the positions of the models in the model array according to the recalculated circle center position, and updating.
Specifically, when the radius parameter is detected to be modified, calculating the center position according to the formula startPos =p1+r×v2.normalized according to the original direction vector v2= startPos-p1 between the starting point position and the center position, and recalculating the position of the model array according to the new startPos according to the formula niPos =quaternion.
If the quantity parameter modification data is detected, regenerating a corresponding quantity of array models, and recalculating the positions of the models and updating.
Specifically, when the number parameter is detected to be modified, a corresponding number of array models are regenerated, the positions of the model arrays are recalculated according to the formula niPos =quaternion.
The following takes the example of using a state machine to implement the replication process of the model array in a specific application embodiment, including switching of four states, specifically:
State one: detecting target model objects
After detecting that a user starts a ring array mode and then switches to the first state, after detecting that the user selects a model object, recording the coordinate position of the model as p1 (x 1, y1, z 1), calculating the length, width and height size s1 of a bounding box of the model, creating n square bounding boxes according to the set array quantity n, and switching to the second state, wherein the positions and the length, width and height sizes are the same as those of the model, as shown in (a) of fig. 4.
State two: determining the position of the center of a circle
During this state, the user is started to detect a mouse click event, the mouse position is mapped onto a plane where the height of the virtual scene is the model position height y1, the mapping coordinates startPos (x 2, y1, z 2) are mapped, the circle mark is moved to this position, the radius is the distance r=vector3.distance (startPos, p 1) from the center of the circle to the model position, the radius parameter on the parameter panel is updated, and the updating is not performed until the user is detected to press the mouse, as shown in (b) in fig. 4, the state is switched to the state three.
State three: adjusting array effects
During the state, starting to detect a mouse clicking event of a user, mapping the position of each frame of mouse onto a plane where the height of the virtual scene is the model position height y1, mapping coordinates endPos (x 3, y1, Z3), subtracting the center coordinates from the mapped coordinates to obtain vectors v1= endPos-startPos, calculating an included angle angle=vector 3.Angle (dz, v 1) between the Z-axis direction dz and v1 of the world, updating angle parameter values on a panel, calculating coordinate positions niPos =quaternion. Angle (i x angle, vector3. Up) of n models in the array, and updating the model array positions in real time (p 1-startPos) + startPos (i is 1-n). When it is detected that the user clicks the mouse, the update is not performed, and the state is switched to the state four as shown in fig. 5 (a).
State four: detecting parameter adjustment array effects
Detecting modification of parameters on the panel during this state, adjusting the corresponding array effect according to the angle, radius, number of modification data:
Angle: when the modification of the angle parameters is detected, the coordinate positions niPos =quaternion.
Radius: when the radius parameter is detected to be modified, calculating the circle center position startPos =p1+r×v2.normalized according to the original direction vector v2= startPos-p1, and recalculating the position niPos =quaternion.
Quantity: when the number parameter is detected to be modified, a corresponding number of array models are regenerated, the positions niPos =quaternion.
After detecting that the user presses the confirm button, the annular array model of the target model is generated according to the array pre-generation position, and as shown in fig. 5 (b), the state is switched back to the state one for the next copy.
The application also provides a computer apparatus comprising a processor and a memory, the memory being for storing a computer program, the processor being for executing the computer program to perform a method as described above.
It will be understood that the method in this embodiment may be performed by a single device, for example, a computer or a server, or may be implemented by a plurality of devices in a distributed scenario, where one device of the plurality of devices may perform only one or more steps in the method in this embodiment, and the plurality of devices interact to implement the method. The processor may be implemented as a general-purpose CPU, a microprocessor, an application-specific integrated circuit, or one or more integrated circuits, etc. for executing the relevant program to implement the methods described in this embodiment. The memory may be implemented in the form of read-only memory ROM, random access memory RAM, static storage devices, dynamic storage devices, etc. The memory may store an operating system and other application programs, and when the methods of the present embodiments are implemented in software or firmware, the associated program code is stored in the memory and invoked for execution by the processor.
The application also provides a computer readable storage medium storing a computer program which when executed by a processor implements a method as described above.
It will be appreciated by those skilled in the art that the above-described embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein. The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. While the invention has been described with reference to preferred embodiments, it is not intended to be limiting. Therefore, any simple modification, equivalent variation and modification of the above embodiments according to the technical substance of the present invention shall fall within the scope of the technical solution of the present invention.

Claims (10)

1. The method for generating the model array replication in the three-dimensional virtual scene modeling is characterized by comprising the following steps:
after a model array copying function is started, obtaining a model array arrangement mode selected by a user and initial model parameters;
Detecting the operation of selecting the target model object to be copied by a user, and when detecting that the target model object is selected by the user, recording the coordinate position of the target model object and calculating the corresponding bounding box size;
creating a plurality of bounding boxes with the same size according to the bounding box size of the target model object to form a bounding box array;
When a copy request operation of a user is received, starting to detect the position of a user operation point, mapping the position of the user operation point to a plane where the position height of a target model object in a virtual scene is located, and updating the position of each bounding box in the bounding box array according to the starting point position and the end point position selected by the user, the model array arrangement mode selected by the user and the initial model parameters;
When a confirmation request operation of a user is received, updating the positions of the bounding box arrays is stopped, data of the target model object are copied to the positions of the bounding boxes in the bounding box arrays respectively, and a required model array is generated.
2. The method for generating model array replication in three-dimensional virtual scene modeling according to claim 1, wherein the model array arrangement mode comprises a linear array mode and an annular array mode, the linear array mode is that units in the array are arranged in a linear mode according to a specified interval, and the annular array mode is that units in the array are arranged in an annular mode according to a specified interval.
3. The method for generating model array replication in three-dimensional virtual scene modeling according to claim 2, wherein when detecting that a user selects a linear array mode, updating a position niPos of each bounding box in the bounding box array according to a formula niPos = startPos +offset i, wherein i=1 to n are sequence numbers of the bounding boxes, n is the number of the bounding boxes in the bounding box array, startPos is a start position coordinate, offset is an offset between an end position coordinate and a start position coordinate, an angle of the bounding box array is obtained according to an included angle between a first vector and a second vector, the first vector is a vector in which an orientation of a target model object is located, and the second vector is a vector between the start position and the end position.
4. The method for generating model array replication in three-dimensional virtual scene modeling according to claim 2, wherein when the user selection of the circular array mode is detected, an identifier is generated at a position mapped by the user operation point position, the generated position of the identifier is used as a circle center, the distance between the circle center and the target model object is used as a radius, and the position of each bounding box in the bounding box array is updated.
5. The method for generating model array replication in three-dimensional virtual scene modeling according to claim 4, wherein when updating the positions of bounding boxes in the bounding box array, calculating an angle between a world Z-axis direction dz and a vector v1, wherein the vector v1 is a vector obtained by subtracting a circle center coordinate from a mapping coordinate obtained by mapping a user operation point, the positions of the bounding boxes in the bounding box array are niPos =quaternion.
6. The method for generating model array replication in three-dimensional virtual scene modeling according to any one of claims 1 to 5, further comprising a model parameter adjustment step, wherein the model parameter adjustment step comprises:
detecting modification data of a user on model parameters;
and modifying the data according to the detected model parameters to adjust the corresponding parameter states of the model array.
7. The method according to claim 6, wherein when detecting that the user selects the linear array mode, the model parameters include any one or more of an angle, a distance, and a number, and the adjusting the corresponding parameter states of the model array according to the detected model parameter configuration data includes:
If angle parameter modification data are detected, rotating the world Z-axis direction vector by a designated angle according to the modification data to obtain a new v1 unit vector, recalculating the end position and the offset according to the new v1 unit vector, and further calculating the position of the model array according to the recalculated offset and updating;
If the distance parameter modification data are detected, a new end point position is calculated according to the modification data and a direction vector v2 between the initial position and the end point position before modification, an offset is recalculated according to the new end point position, and then a new array model position is calculated according to the recalculated offset and updated.
If the distance parameter modification data is detected, regenerating a corresponding number of array models, calculating the position of a new array model according to the current offset and updating.
8. The method for generating model array replication in three-dimensional virtual scene modeling according to claim 6, wherein when detecting that a user selects a circular array mode, the model parameters include any one or more of an angle, a radius, and a number, and adjusting the corresponding parameter states of the model array according to the detected model parameter configuration data includes:
If the angle parameter modification data are detected, recalculating the coordinate positions of the models in the array according to the modified angle data and updating the coordinate positions;
If radius parameter modification data are detected, recalculating the circle center position according to the modification data and a direction vector v2 from the target model object to the circle center before modification, calculating the positions of the models in the model array according to the recalculated circle center position, and updating;
If the quantity parameter modification data is detected, regenerating a corresponding quantity of array models, and recalculating the positions of the models and updating.
9. A computer device comprising a processor and a memory for storing a computer program, characterized in that the processor is adapted to execute the computer program to perform the method according to any of claims 1-8.
10. A computer readable storage medium storing a computer program, which when executed by a processor implements the method of any one of claims 1-8.
CN202311871809.7A 2023-12-29 2023-12-29 Model array replication generation method, device and medium in three-dimensional virtual scene modeling Pending CN118015183A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311871809.7A CN118015183A (en) 2023-12-29 2023-12-29 Model array replication generation method, device and medium in three-dimensional virtual scene modeling

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311871809.7A CN118015183A (en) 2023-12-29 2023-12-29 Model array replication generation method, device and medium in three-dimensional virtual scene modeling

Publications (1)

Publication Number Publication Date
CN118015183A true CN118015183A (en) 2024-05-10

Family

ID=90949140

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311871809.7A Pending CN118015183A (en) 2023-12-29 2023-12-29 Model array replication generation method, device and medium in three-dimensional virtual scene modeling

Country Status (1)

Country Link
CN (1) CN118015183A (en)

Similar Documents

Publication Publication Date Title
US10147398B2 (en) Display control method and device
JP3529373B2 (en) Work machine simulation equipment
US5905501A (en) Method of and apparatus for generating assembly view
JP3673749B2 (en) Simulation device
US20120290122A1 (en) Predictive control and virtual display system for a numerically controlled machine tool
JP2011048621A (en) Robot off-line teaching method
US10437229B2 (en) Numerical controller
CN109976614B (en) Method, device, equipment and medium for marking three-dimensional graph
JP2012221416A (en) Computer system, and assembly animation generation method
CN109544702A (en) Three-dimension varying processing method, device, electronic equipment and storage medium
JP2019032788A (en) Information processing apparatus, information processing method, and information processing program
WO2013118179A1 (en) Tool-path displaying method and tool-path displaying apparatus
CN111177828A (en) Linkage method and device applied to standard floor model and computer storage medium
CN115847384B (en) Mechanical arm safety plane information display method and related products
CN118015183A (en) Model array replication generation method, device and medium in three-dimensional virtual scene modeling
US10761523B2 (en) Method for controlling an automation system
CN108553900B (en) Method capable of being repeatedly used by overlapping storage based on UE engine
JPH06337711A (en) Teaching device for robot
CN108318723B (en) Waveform scaling method, device and system
CN113643443B (en) Positioning system for AR/MR technology
CN116681869B (en) Cultural relic 3D display processing method based on virtual reality application
CN115964788A (en) Building structure collision correction method and device based on BIM model
JPS6155728A (en) Coordinate input device
CN118205070A (en) Control method, equipment and readable storage medium for in-situ integrated printing
JP2966531B2 (en) Window moving method

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