CN112764650B - Graph scaling method and device, electronic equipment and storage medium - Google Patents
Graph scaling method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112764650B CN112764650B CN202110128263.0A CN202110128263A CN112764650B CN 112764650 B CN112764650 B CN 112764650B CN 202110128263 A CN202110128263 A CN 202110128263A CN 112764650 B CN112764650 B CN 112764650B
- Authority
- CN
- China
- Prior art keywords
- graph
- original
- scaling
- point
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0484—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
- G06F3/04845—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/10—Geometric CAD
- G06F30/12—Geometric CAD characterised by design entry means specially adapted for CAD, e.g. graphical user interfaces [GUI] specially adapted for CAD
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/10—Geometric CAD
- G06F30/13—Architectural design, e.g. computer-aided architectural design [CAAD] related to design of buildings, bridges, landscapes, production plants or roads
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
- G06T19/20—Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2203/00—Indexing scheme relating to G06F3/00 - G06F3/048
- G06F2203/048—Indexing scheme relating to G06F3/048
- G06F2203/04806—Zoom, i.e. interaction techniques or interactors for controlling the zooming operation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2210/00—Indexing scheme for image generation or computer graphics
- G06T2210/04—Architectural design, interior design
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2219/00—Indexing scheme for manipulating 3D models or images for computer graphics
- G06T2219/20—Indexing scheme for editing of 3D models
- G06T2219/2016—Rotation, translation, scaling
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Evolutionary Computation (AREA)
- Architecture (AREA)
- Computational Mathematics (AREA)
- Human Computer Interaction (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Computer Graphics (AREA)
- Software Systems (AREA)
- Civil Engineering (AREA)
- Structural Engineering (AREA)
- Document Processing Apparatus (AREA)
- Image Generation (AREA)
- Processing Or Creating Images (AREA)
Abstract
The invention discloses a graph scaling method and device, electronic equipment and a storage medium. The graphic scaling method comprises the following steps: generating an original graph according to an instruction input by a user; acquiring an original central point of an original graph; taking a preset base point as a graph center point of the original graph; acquiring a scaling ratio corresponding to the original graph; carrying out scaling processing on the original graph according to the scaling ratio to obtain a target scaling graph; and moving the target scaling graph to enable the target scaling graph to take the original central point as a graph center. The invention can realize the custom drawing of the outline graph and the operation of firstly scaling and then previewing the original outline graph, is beneficial to a user to better understand the overall appearance and details of the outline graph in the previewing process and properly adjust the insertion point so as to improve the design efficiency.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for scaling a graphic, an electronic device, and a storage medium.
Background
The BIM (Building Information Modeling) technology can help to realize the integration of Building Information, and the core of the BIM technology is to provide a complete Building engineering Information base consistent with the actual situation for a virtual Building engineering three-dimensional model by establishing the model and utilizing the digitization technology.
Revit is a BIM modeling software that simulates the actual construction of a construction project, such as by combining different building elements, such as beams, columns, doors, windows, etc. In the field of construction, a foot is a construction element whose cross section is made of straight lines, curved lines or a combination of straight and curved lines and extends linearly according to this cross section.
If the user adds a stitch in the local project through the Revit software, it is first necessary to select a contour figure corresponding to the cross section of the target stitch. Without a corresponding outline graphic, the user typically needs to build a family of outlines that contain a two-dimensional closed loop shape that can be loaded into the project and applied to certain building primitives. There are generally two methods of creating a family of contours, one is to open a new family of metric contours and draw the contour graphics using lines, dimensioning and reference planes. After the family of outlines is saved, it can be loaded and applied to the solid geometry in the project. Another method for creating a family of contours is to custom draw contours, i.e. the user uses the drawing model line function of the Revit software to generate and name a closed contour graph in the drawing interface, and when the contour graph is loaded into an item, the graph needs to be previewed and the insertion point needs to be adjusted.
However, when the preview graph is displayed, due to the limitation of the display screen of the computer device, the size of the preview window of the Revit software is fixed, but the sizes of the outline graphs are different, and for the outline graph with an excessively large size or an excessively small size, a user cannot properly know the overall appearance and the graph details of the outline graph through the preview window and adjust the insertion point, thereby affecting the work efficiency of the user.
Disclosure of Invention
The present invention aims to provide a method, an apparatus, an electronic device and a storage medium for scaling a graphic, so as to solve the problem that the size of a previewed outline graphic does not match the size of a preview window of Revit software, thereby improving the working efficiency of a user.
In a first aspect, the present invention provides a method of graphical scaling, the method comprising the steps of:
generating an original graph according to an instruction input by a user;
acquiring an original central point of the original graph;
taking a preset base point as a graph center point of the original graph;
acquiring a scaling ratio corresponding to the original graph;
according to the scaling proportion, scaling the original graph to obtain a target scaled graph;
and moving the target scaling graph to enable the target scaling graph to take the original central point as a graph center.
In a second aspect, the present invention provides a graphic scaling apparatus, comprising:
the graph generating module is used for generating an original graph according to an instruction input by a user;
the data processing module is used for acquiring an original central point of the original graph;
the graph moving module is used for taking a preset base point as a graph central point of the original graph;
the image scaling module is used for scaling the original image according to the scaling proportion to obtain a target scaling image;
optionally, the data processing module is further configured to obtain a scaling ratio corresponding to the original graph;
optionally, the graph moving module is further configured to move the target scaled graph, so that the target scaled graph takes the original central point as a graph center.
In a third aspect, the present invention provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the graphic scaling method provided by the present invention when executing the computer program.
In a fourth aspect, the present invention provides a storage medium having stored thereon a computer program which, when executed by a processor, performs the steps in the graphics scaling method provided by the present invention.
The invention provides a method and a device for scaling a graph, electronic equipment and a storage medium, which can scale the graph. The method is applied to the design scene of the building line foot model, and can realize the custom drawing of the outline graph and the operation of firstly zooming and then previewing the original outline graph. Moreover, the original data of the scaled object is not changed by adopting the invention. Particularly, in the previewing process before the profile family is loaded into the project, the size of the previewed profile graph can be matched with the size of the BIM software previewing window, so that the user can better know the overall appearance and details of the profile graph in the previewing process, and the insertion point can be properly adjusted, and the design efficiency is improved.
Drawings
The technical scheme and other beneficial effects of the invention are obvious from the detailed description of the specific embodiments of the invention in combination with the attached drawings.
Fig. 1 is an application environment diagram of a method for scaling a graphic according to an embodiment of the present invention.
Fig. 2 is a schematic flow chart of a method for scaling a graphic according to an embodiment of the present invention.
Fig. 3A to fig. 3D are schematic diagrams illustrating a process of scaling a graphic by using the method for scaling a graphic according to the embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a graphic scaling apparatus according to an embodiment of the present invention.
Fig. 5 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In the description of the invention, the claims, and the preceding drawings, the terms "first," "second," "third," and the like (if any) are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the objects so described are interchangeable under appropriate circumstances such that the embodiments described herein are capable of operation in other sequences than described or illustrated herein. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to such process, method, article, or apparatus. The division of the modules presented in the embodiments of the present invention is only a logical division, and in practical applications, there may be other division ways, for example, a plurality of modules may be combined or integrated into another system, or some features may be omitted, or not executed. In the description of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning a fixed connection, a removable connection, or an integral connection; may be mechanically connected, may be electrically connected or may be in communication with each other; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations. In addition, in the description of the embodiments of the present invention, the shown or discussed mutual coupling, direct coupling or communication connection may be through some interfaces, and the indirect coupling or communication connection between the modules may be in an electrical or other similar form, which is not limited in the embodiments of the present invention. Furthermore, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in a plurality of circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
The embodiment of the invention provides a graph scaling method which is mainly applied to a design scene of a building line foot model. Specifically, the method comprises the steps of designing a line foot by adopting building design software, and previewing a line foot outline graph before loading the line foot outline graph in a project. The adopted Building design software can be Revit Modeling software, the Revit software is constructed for a Building Information model (BIM for short), and the Building design software can help architects to design, build and maintain buildings with better quality and higher energy efficiency. The embodiment of the invention can execute the graphic scaling method through the electronic equipment, or execute the graphic scaling method through a graphic scaling device running on the electronic equipment. The electronic device may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a smart television, a smart robot, a desktop computer, a server computer, and the like.
Fig. 1 is a diagram of an application environment of a method for scaling a graphic according to an embodiment of the present invention. The electronic device 100 in the figure includes a memory, a processor and a display screen, the processor may run architectural design software, the architectural design software may be stored in the memory in the form of a computer program, the memory also provides an operating environment for the architectural design software, and the memory may store operating information of the architectural design software. Specifically, the display screen may display a design editing interface of the architectural design software, and the user may input information through a drawing component provided by the design editing interface to perform architectural design, such as drawing a contour figure corresponding to a cross section of the target leg. Optionally, the architectural design software may invoke the mapped model data through a software interface, the invoked model data including, but not limited to, model data of the architectural design software.
The method of scaling the graphics is described below with specific examples.
It should be noted that the application scenarios of the method for scaling a graphic provided in this embodiment are specifically:
in order to generate a target line foot in a building design project, a user generally needs to self-construct a contour family corresponding to the target line foot, wherein the contour family contains a contour graph corresponding to a cross section of the target line foot. The user can use the drawing model line function of BIM software (such as Revit software) to custom draw the outline graph. Before loading the self-built outline family into the corresponding building design project to generate the target line foot, the outline graphics in the outline family need to be previewed and the insertion point needs to be adjusted. The graphic scaling method provided by the embodiment is used for scaling the outline graphic, so that the size of the scaled outline graphic is matched with the size of the BIM software preview window, which is helpful for helping a user to better understand the overall appearance and details of the outline graphic in the preview process and to properly adjust the insertion point.
Specifically, please refer to fig. 2, which is a flowchart illustrating a method for scaling a graphic according to an embodiment of the present invention. As shown in fig. 2, in the present embodiment, the method for scaling graphics includes the following steps:
s210: and generating an original graph according to an instruction input by a user.
Firstly, acquiring a drawing instruction input by a user through a family editor of BIM software, such as an instruction for drawing a line segment or an arc segment; and generating a corresponding graph in the target coordinate system according to the instruction. Further, whether the graph is a closed graph is judged.
To help readers to understand the present invention, please refer to fig. 3A to fig. 3D, which are schematic flow diagrams of scaling a graphic by using the method for scaling a graphic according to an embodiment of the present invention. In the coordinate system of FIG. 3A (target coordinate system) there is a rectangle E 1 F 1 G 1 H 1 The original graph is the original graph described in this embodiment. The peripheral contour line of the three-dimensional model comprises four vertexes: e 1 (0,1,1)、F 1 (0,4,1)、G 1 (0,4,5)、H 1 (0,1,5), therefore, the rectangle can be considered to be composed of the line segment E 1 F 1 Line segment F 1 G 1 Line segment G 1 H 1 And line segment H 1 E 1 And (4) forming a closed graph. It should be noted that the rectangle E is understood by those skilled in the art 1 F 1 G 1 H 1 Not only on the contour line of 1 (0,1,1)、F 1 (0,4,1)、G 1 (0,4,5)、H 1 The four points (0,1,5) are illustrated for convenience of description and to ensure the accuracy and simplicity of the description, and will not be described in detail hereinafter. In this step, the method of determining whether the graph is closed is to determine whether the line segments (or arc segments) constituting the graph are connected end to end according to the read graph data. And if the figure is judged to be a closed figure, marking the figure as an original figure, wherein the original figure is the outline figure corresponding to the cross section of the target line foot.
Further, in this embodiment, the outline graphics (original graphics) are named according to a naming instruction input by a user, and the following steps are performed according to a preview instruction input by the user.
S220: and acquiring an original central point of the original graph.
Obtaining the original center point of the original graph, i.e. obtaining the rectangle E in FIG. 3A 1 F 1 G 1 H 1 Graphic center point D of 1 (0,2.5,3), setting the original center point as D 1 (0,2.5,3) and storing.
S230: and taking a preset base point as the graph center point of the original graph.
Specifically, referring to fig. 3B, the predetermined base point is an origin O (0,0,0) of the coordinate system in the drawing. Further, the rectangle E is moved 1 F 1 G 1 H 1 To obtain a rectangle E 2 F 2 G 2 H 2 And, a rectangle E 2 F 2 G 2 H 2 The origin O (0,0,0) of the coordinate system is taken as the center point.
S240: and acquiring the scaling corresponding to the original graph.
Specifically, please continue to refer to FIG. 3B, obtain rectangle E 2 F 2 G 2 H 2 Coordinate arrays corresponding to points on the contour, e.g. E 2 (0,-1.5,-2)、F 2 (0,1.5,-2)、G 2 (0,1.5,2)、H 2 (0, -1.5, -2); calculating a rectangle E according to the coordinate arrays of each point 2 F 2 G 2 H 2 Distances between any two points on the contour line in the directions parallel to the X-axis, Y-axis and Z-axis of the coordinate system are obtained to obtain a plurality of distance values, which are respectively set as L 1 -L n 。
Let L 1 -L n Respectively with a reference value L 0 Dividing to obtain multiple quotients, setting as R 1 -R n . Then, to R 1 -R n Screening was performed to select the smallest value (set as R) x ) As a scaling ratio R. Wherein, in the present embodiment, the reference value L 0 The value of (b) is taken to be the length of the long side of the preview window, but it should be noted thatIn another embodiment of the present invention, the reference value L is 0 Other values may be taken. The specific calculation formula is as follows:
L 0 ÷L 1 =R 1 ,
L 0 ÷L 2 =R 2 ,
L 0 ÷L 3 =R 3 ,
L 0 ÷L n-1 =R n-1 ,
L 0 ÷L n =R n .
thus, the scaling ratio R ═ MIN (R) 1 ,R 2 ,R 3 ,…R n-1 ,R n )。
In other embodiments of the present application, the step of calculating the scaling ratio R may be: firstly to L 1 -L n Screening was performed to select the highest value (set as L) x ) And a reference value L 0 Dividing to obtain quotient R x Namely the scaling R. The specific calculation formula is as follows:
L x =MAX(L 1 ,L 2 ,L 3 ,…L n-1 ,L n ),
R x =L 0 ÷L x .
thus, the scaling ratio R ═ R x 。
S250: and carrying out scaling processing on the original graph according to the scaling ratio to obtain a target scaled graph.
Referring to FIG. 3B and FIG. 3C, in this step, first, let the original graph (rectangle E) 2 F 2 G 2 H 2 ) And multiplying each coordinate value in each point coordinate array on the contour line by the scaling ratio R to obtain the scaled coordinate array of each point. To help the reader understand, let E be equal to 0.5 for the scaling ratio R 2 (0,-1.5,-2)、F 2 (0,1.5,-2)、G 2 (0,1.5,2)、H 2 (0, -1.5, -2) multiplying and multiplying respectivelyBy reducing the ratio R, E can be obtained 3 (0,-0.75,-1)、F 3 (0,0.75,-1)、G 3 (0,0.75,1)、H 3 (0,-0.75,-1)。
Next, a new graph is generated from the scaled coordinate arrays of the points (e.g., rectangle E in FIG. 3C) 3 F 3 G 3 H 3 ) Namely, the target scaling graph is obtained.
S260: and moving the target scaling graph to enable the target scaling graph to take the original central point as a graph center.
Specifically, referring to fig. 3C and 3D, in this step, a rectangle E with the origin O (0,0,0) as the center of the graph is moved 3 F 3 G 3 H 3 To obtain a rectangle E 4 F 4 G 4 H 4 And, a rectangle E 4 F 4 G 4 H 4 Using the original center point D 1 (0,2.5,3) is the center of the graph.
At this time, rectangle E 4 F 4 G 4 H 4 Namely, the original graph (rectangle E) is scaled by the graph scaling method provided by the embodiment 1 F 1 G 1 H 1 ) And zooming the obtained target zoomed graph.
Further, the target is scaled to a graphic (rectangle E) 4 F 4 G 4 H 4 ) And outputting through a preview window for a user to preview the outline graph. Then, according to the instruction of adjusting the insertion point inputted by the user, the insertion point is switched, and according to the saving instruction inputted by the user, the contour graph (original graph) is saved in a self-built contour family. And further, loading a corresponding outline family in the building design project according to a loading outline family instruction input by a user to generate a target line foot.
According to the above, the method for scaling the graph provided by the embodiment of the invention is applied to a scene in which the BIM software (such as Revit software) is used for generating the target line foot in the building design project, so that the custom drawing of the outline graph and the operation of scaling and previewing the original outline graph can be realized. Moreover, the original data of the scaled object is not changed by adopting the method. Specifically, in the process of previewing before loading the outline group into the project, the size of the previewed outline graph can be matched with the size of a BIM software preview window by adopting the graph scaling method provided by the embodiment of the invention. This helps the user to better understand the overall appearance and details of the outline graphic during the preview process and to adjust the insertion point appropriately to improve the work efficiency.
In order to better implement the steps in the above-mentioned method for scaling graphics, the embodiments of the present invention further provide related apparatuses for implementing the above-mentioned method. Fig. 4 is a schematic structural diagram of a graphic scaling apparatus according to an embodiment of the present invention. The graphic scaling apparatus 400 includes:
a graph generating module 410, configured to generate an original graph according to an instruction input by a user;
a data processing module 420, configured to obtain an original central point of the original graph;
the graph moving module 430 is configured to use a preset base point as a graph center point of the original graph;
and a graph scaling module 440, configured to perform scaling processing on the original graph according to the scaling ratio to obtain a target scaled graph.
In this embodiment, the graph generating module 410 acquires a drawing instruction input by a user through a family editor of the BIM software, generates a corresponding graph in the target coordinate system according to the instruction, and marks the graph as an original graph (outline graph) after determining that the graph is a closed graph. Optionally, the graph generating module 410 is further configured to name the original graph (outline graph) according to a naming instruction input by the user, and trigger the data processing module 420, the graph moving module 430, and the graph scaling module 440 according to a preview instruction input by the user.
In this embodiment, the data processing module 420 first obtains the position data of the previewed graph (original graph) in the target coordinate system, for example, obtains and saves the original center point coordinate array of the original graph. At the same time, the graphic moving module 430 moves the previewed graphic (original graphic) so that the moved previewed graphic (original graphic) takes the origin of the target coordinate system as the graphic center.
Further, the data processing module 420 is further configured to obtain a scaling ratio corresponding to the original graph. Specifically, the data processing module 420 reads data of each point on a contour line of the previewed graph (original graph) with the origin as the graph center to obtain a coordinate array of each point on the contour line, and calculates the scaling ratio according to the coordinate data of each point.
In this embodiment, the calculating the scaling ratio by the data processing module 420 may include:
calculating the distance between any two points on the contour line of the previewed graph (original graph) in the direction parallel to each coordinate axis of the target coordinate system to obtain a plurality of distance values;
removing a reference value (dividend) from the distance values to obtain a plurality of quotients;
and screening a plurality of calculated quotients, and taking the quotient with the minimum value as a scaling ratio.
In some possible embodiments of the present invention, the calculating of the scaling by the data processing module 420 may further include:
calculating the distance between any two points on the contour line of the previewed graph (original graph) in the direction parallel to each coordinate axis of the target coordinate system to obtain a plurality of distance values;
and screening the plurality of distance numerical values obtained by calculation, removing a reference value (dividend) with the largest numerical value, and obtaining the quotient which is the scaling ratio by calculation.
Further, the graphic scaling module 440 scales the previewed graphic (original graphic) according to the scaling ratio calculated by the data processing module 420, specifically, multiplies the coordinate values in the coordinate arrays of each point on the contour line of the previewed graphic with the origin as the center by the scaling ratio to obtain a series of new coordinate arrays, and generates the target scaled graphic according to the new coordinate arrays.
Further, the graph moving module 430 obtains the original central point coordinate array of the previewed graph (original graph) stored by the data processing module 420, and moves the target scaled graph with the original point of the target coordinate system as the graph center, so that the moved target scaled graph takes the original central point as the graph center. The process of scaling the previewed graphics (original graphics) is completed.
Alternatively, in some possible embodiments of the present invention, the graphic scaling apparatus 400 may output the target scaled graphic to an external module through a graphic output interface. For example, in the preview process before the building line foot model outline graphic is loaded into the project, the target scaled graphic can be displayed through the preview window.
In summary, the method and the device for scaling the graphics provided by the embodiment of the invention can scale the graphics. In the design scene of the building line foot model, the invention is adopted to scale the outline graph in the preview process before loading the project, so that the size of the scaled outline graph can be matched with the size of the BIM software preview window, a user can better know the overall appearance and details of the outline graph in the preview process, and the insertion point can be properly adjusted, thereby improving the design efficiency.
Fig. 5 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention. The electronic device 500 comprises: a Processor (Processor)501, a Communications Interface 502, a memory 503, and a Communications bus 504. The processor 501, the communication interface 502 and the memory 503 are communicated with each other through a communication bus 504. The processor 501 may call logic instructions in the memory 503 to perform the following method: generating an original graph according to an instruction input by a user; acquiring an original central point of an original graph; moving the original graph to enable the original graph to take a preset base point as a graph center; acquiring a scaling ratio corresponding to the original graph; carrying out scaling processing on the original graph according to the scaling ratio to obtain a target scaling graph; and moving the target scaling graph to enable the target scaling graph to take the original central point as a graph center.
In addition, the logic instructions in the memory 503 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Embodiments of the present invention further provide a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the method provided in the foregoing embodiments when executed by a processor, and the method includes: generating an original graph according to an instruction input by a user; acquiring an original central point of an original graph; moving the original graph to enable the original graph to take a preset base point as a graph center; acquiring a scaling ratio corresponding to the original graph; carrying out scaling processing on the original graph according to the scaling ratio to obtain a target scaling graph; and moving the target scaling graph to enable the target scaling graph to take the original central point as a graph center.
In summary, the method, the apparatus, the electronic device, and the storage medium for scaling the graphics provided in the embodiments of the present invention can perform scaling processing on the graphics. The method is applied to the design scene of the building line foot model, and can realize the custom drawing of the outline graph and the operation of firstly zooming and then previewing the original outline graph. Moreover, the original data of the scaled object is not changed by adopting the invention. Specifically, in the previewing process before the contour family is loaded into the project, the invention can enable the size of the previewed contour graph to be matched with the size of the BIM software previewing window, thereby being beneficial to a user to better know the overall appearance and details of the contour graph in the previewing process and properly adjusting the insertion point so as to improve the design efficiency.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. Based on the understanding, the above technical solutions substantially or otherwise contributing to the prior art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the various embodiments or some parts of the embodiments.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (9)
1. A method of scaling a graphic in a target coordinate system, the method comprising the steps of:
generating an original graph according to an instruction input by a user;
acquiring an original central point of the original graph;
taking a preset base point as a graph center point of the original graph;
acquiring a scaling ratio corresponding to the original graph;
wherein the step of obtaining the scaling corresponding to the original graph comprises: acquiring a coordinate array corresponding to each point on the contour line of the original graph; calculating the distance between any two points on the contour line of the original graph in the direction of each axis of the target coordinate system according to the coordinate arrays of the points to obtain a plurality of distance values; calculating a scaling ratio value according to the plurality of distance values and a preset reference value, wherein the preset reference value is a long side of a preview window; taking the minimum value of the scaling ratio as an application value of the scaling ratio;
according to the scaling proportion, scaling the original graph to obtain a target scaled graph;
and moving the target scaling graph to enable the target scaling graph to take the original central point as a graph center.
2. The method of claim 1, wherein the step of generating the original graphic according to the instruction input by the user comprises:
acquiring an instruction input by a user;
drawing a graph according to an instruction input by a user;
judging whether the graph is a closed graph or not;
and if the graph is judged to be a closed graph, marking the graph as the original graph.
3. The method of claim 1, wherein the step of obtaining the original center point of the original graphic comprises:
acquiring an original central point of the original graph;
and storing the coordinate array of the original central point.
4. The method according to claim 1, wherein the preset base point is an origin of the target coordinate system.
5. The method of claim 1, wherein the step of obtaining the scaling factor corresponding to the original graphics comprises:
acquiring a coordinate array corresponding to each point on the contour line of the original graph;
calculating the distance of any two points on the contour line of the original graph in the direction of each axis of the target coordinate system according to the coordinate array of each point to obtain a plurality of distance values;
dividing the minimum distance value by a reference value to obtain a quotient as the scaling ratio.
6. The method according to claim 5, wherein the step of scaling the original graphic according to the scaling ratio to obtain the target scaled graphic comprises:
multiplying each coordinate value in the coordinate array of each point on the original graph contour line by the scaling ratio to obtain a scaled coordinate array of each point;
and generating the target scaling graph according to the scaled coordinate array of each point.
7. An apparatus for graphic scaling, the apparatus comprising:
the graph generating module is used for generating an original graph according to an instruction input by a user;
a data processing module, configured to obtain an original center point of the original graph, and obtain a scaling ratio corresponding to the original graph, where the step of obtaining the scaling ratio corresponding to the original graph includes: acquiring a coordinate array corresponding to each point on the contour line of the original graph; calculating the distance between any two points on the contour line of the original graph in the direction of each axis of a target coordinate system according to the coordinate array of each point to obtain a plurality of distance values; calculating a scaling ratio value according to the plurality of distance values and a preset reference value, wherein the preset reference value is a long side of a preview window; taking the minimum value of the scaling ratio as an application value of the scaling ratio;
the graph moving module is used for taking a preset base point as a graph center point of the original graph and moving a target scaled graph to enable the target scaled graph to take the original center point as a graph center;
and the image scaling module is used for scaling the original image according to the scaling proportion so as to obtain a target scaling image.
8. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 6 when executing the computer program.
9. A storage medium having a computer program stored thereon, the computer program, when being executed by a processor, realizing the steps of the method of any one of claims 1 to 6.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110128263.0A CN112764650B (en) | 2021-01-29 | 2021-01-29 | Graph scaling method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110128263.0A CN112764650B (en) | 2021-01-29 | 2021-01-29 | Graph scaling method and device, electronic equipment and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN112764650A CN112764650A (en) | 2021-05-07 |
| CN112764650B true CN112764650B (en) | 2022-08-23 |
Family
ID=75703791
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110128263.0A Active CN112764650B (en) | 2021-01-29 | 2021-01-29 | Graph scaling method and device, electronic equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112764650B (en) |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1950823A (en) * | 2004-03-09 | 2007-04-18 | 罗尔公司 | Systems, methods and computer program products for implementing processes relating to retail sales |
| CN103019594A (en) * | 2012-12-06 | 2013-04-03 | 鸿富锦精密工业(深圳)有限公司 | Electronic device and page zooming method thereof |
| CN103226806A (en) * | 2013-04-03 | 2013-07-31 | 广东欧珀移动通信有限公司 | Method and camera system for enlarging picture partially |
| CN104679394A (en) * | 2013-11-26 | 2015-06-03 | 中兴通讯股份有限公司 | Method and device for amplifying selected region of preview interface |
| CN108170350A (en) * | 2017-12-28 | 2018-06-15 | 努比亚技术有限公司 | Realize method, terminal and the computer readable storage medium of Digital Zoom |
| CN110519512A (en) * | 2019-08-16 | 2019-11-29 | 维沃移动通信有限公司 | A kind of object processing method and terminal |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130106888A1 (en) * | 2011-11-02 | 2013-05-02 | Microsoft Corporation | Interactively zooming content during a presentation |
| CN103019537B (en) * | 2012-11-19 | 2016-04-13 | 广东欧珀移动通信有限公司 | Image preview method and device |
| CN111798379A (en) * | 2020-07-20 | 2020-10-20 | 广州炫视智能科技有限公司 | Method and system for realizing high-speed preview of graphics |
-
2021
- 2021-01-29 CN CN202110128263.0A patent/CN112764650B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1950823A (en) * | 2004-03-09 | 2007-04-18 | 罗尔公司 | Systems, methods and computer program products for implementing processes relating to retail sales |
| CN103019594A (en) * | 2012-12-06 | 2013-04-03 | 鸿富锦精密工业(深圳)有限公司 | Electronic device and page zooming method thereof |
| CN103226806A (en) * | 2013-04-03 | 2013-07-31 | 广东欧珀移动通信有限公司 | Method and camera system for enlarging picture partially |
| CN104679394A (en) * | 2013-11-26 | 2015-06-03 | 中兴通讯股份有限公司 | Method and device for amplifying selected region of preview interface |
| CN108170350A (en) * | 2017-12-28 | 2018-06-15 | 努比亚技术有限公司 | Realize method, terminal and the computer readable storage medium of Digital Zoom |
| CN110519512A (en) * | 2019-08-16 | 2019-11-29 | 维沃移动通信有限公司 | A kind of object processing method and terminal |
Non-Patent Citations (1)
| Title |
|---|
| 在Delphi中实现拖动、缩放和打印数据库中的图像;刘德华 等;《仪表仪器用户》;20071008;第14卷(第5期);90-92 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112764650A (en) | 2021-05-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112785674B (en) | Texture map generation method, rendering device, equipment and storage medium | |
| CN107392984B (en) | Method for generating animation based on face image and computing equipment | |
| US9024938B2 (en) | Methods and apparatus for sweep-based freeform deformation of 3-D models | |
| US10614178B2 (en) | Scalable and precise fitting of NURBS surfaces to large-size mesh representations | |
| US9330466B2 (en) | Methods and apparatus for 3D camera positioning using a 2D vanishing point grid | |
| CN112967381B (en) | Three-dimensional reconstruction methods, equipment and media | |
| CN107341841B (en) | Generation method of gradual animation and computing device | |
| CN111476718A (en) | Image amplification method and device, storage medium and terminal equipment | |
| CN111950057A (en) | A method and device for loading building information model BIM | |
| KR20110069728A (en) | Method, apparatus and program for displaying objects on a computer screen | |
| CN109118593A (en) | A kind of system and method creating threedimensional model editable configuration | |
| CN113240578A (en) | Image special effect generation method and device, electronic equipment and storage medium | |
| CN106055331B (en) | Model boundary generation method and device | |
| CN113657396A (en) | Training method, translation display method, device, electronic equipment and storage medium | |
| CN116737133A (en) | Layout generation method, design draft layout generation method and device | |
| CN112764650B (en) | Graph scaling method and device, electronic equipment and storage medium | |
| US20240386668A1 (en) | 3d model generation method and related apparatus | |
| CN113268301A (en) | Animation generation method, device, equipment and storage medium | |
| CN114797109A (en) | Object editing method and device, electronic equipment and storage medium | |
| CN114373032B (en) | Three-dimensional mesh deformation method based on contour skeleton and related device | |
| US20140354627A1 (en) | Rendering a 3d shape | |
| CN113379768A (en) | Image processing method, image processing device, storage medium and computer equipment | |
| CN112258654A (en) | Model shell extracting method, terminal device and computer readable storage medium | |
| CN112667220B (en) | Animation generation method and device and computer storage medium | |
| CN115063299B (en) | Image preprocessing method and device, electronic equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |