CN111767700A - Graph adjusting method and device - Google Patents

Graph adjusting method and device Download PDF

Info

Publication number
CN111767700A
CN111767700A CN201910257040.7A CN201910257040A CN111767700A CN 111767700 A CN111767700 A CN 111767700A CN 201910257040 A CN201910257040 A CN 201910257040A CN 111767700 A CN111767700 A CN 111767700A
Authority
CN
China
Prior art keywords
graph
adjusted
width
radius
adjusting
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.)
Granted
Application number
CN201910257040.7A
Other languages
Chinese (zh)
Other versions
CN111767700B (en
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.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology 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 Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Kingsoft Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201910257040.7A priority Critical patent/CN111767700B/en
Publication of CN111767700A publication Critical patent/CN111767700A/en
Application granted granted Critical
Publication of CN111767700B publication Critical patent/CN111767700B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The embodiment of the invention provides a method and a device for adjusting a graph, which relate to the technical field of computer image processing and comprise the following steps: obtaining the width of a graph to be adjusted; under the condition that the graph to be adjusted is a regular convex polygon, acquiring the number of edges of the graph to be adjusted as representation information of the graph to be adjusted; under the condition that the graph to be adjusted is in a positive star shape, acquiring the number of vertex angles of the graph to be adjusted as representation information; acquiring the height of the graph to be adjusted, and calculating the radius of a circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and the representation information; and adjusting the graph to be adjusted according to the width of the pre-selected reference graph, the radius of the circumscribed circle of the reference graph, the first position point, the width of the graph to be adjusted and the radius of the circumscribed circle of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph. By applying the scheme provided by the embodiment of the invention to adjust the graph, the accuracy of center alignment can be improved.

Description

Graph adjusting method and device
Technical Field
The invention relates to the technical field of computer image processing, in particular to a method and a device for adjusting a graph.
Background
With the widespread use of various document processing software, users often need to adjust a plurality of graphics to a centered state by the software. Wherein, the figure can be a regular polygon, a circle, etc.
In the prior art, when the positions of the respective graphs are adjusted to achieve center alignment, a user usually drags the respective graphs through a mouse to further adjust the positions of the graphs, and then the user judges whether the respective graphs achieve a state of center alignment by naked eyes.
Although the pattern position can be adjusted by applying the above method, since an error exists when the naked eye judges whether the pattern reaches the center alignment state, the accuracy is low when the pattern adjustment is performed by applying the above method and further each pattern reaches the center alignment state.
Disclosure of Invention
The embodiment of the invention aims to provide a graph adjusting method and a graph adjusting device so as to improve the accuracy of center alignment adjustment of each graph. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for adjusting a graph, where the method includes:
obtaining the width of a graph to be adjusted;
under the condition that the graph to be adjusted is a regular convex polygon, acquiring the number of edges of the graph to be adjusted as representation information of the graph to be adjusted;
under the condition that the graph to be adjusted is in a positive star shape, acquiring the vertex angle number of the graph to be adjusted as the representation information;
acquiring the height of a graph to be adjusted, and calculating the radius of a circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and the representation information;
adjusting the graph to be adjusted according to the width of a pre-selected reference graph, the radius of a circumscribed circle of the reference graph, a first position point, the width of the graph to be adjusted and the radius of the circumscribed circle of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph, wherein the first position point is as follows: points representing the reference picture positions.
In an embodiment of the present invention, the calculating a radius of a circumscribed circle of the to-be-adjusted graph according to the height of the to-be-adjusted graph and the characterization information includes:
calculating the radius r of the circumscribed circle of the graph to be adjusted according to the following expression:
Figure BDA0002014064490000021
wherein h represents the acquired height, n represents the characterization information, and a, b, and c represent preset parameters.
In an embodiment of the present invention, the method for adjusting the graph further includes:
and under the condition that the graph to be adjusted is circular, adjusting the graph to be adjusted directly according to the width of the reference graph, the first position point and the width of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph.
In one embodiment of the present invention, the first location point is: and the intersection point of two adjacent edges in the circumscribed rectangle of the reference graph.
In an embodiment of the present invention, the adjusting the to-be-adjusted graph according to a preselected width of a reference graph, a radius of a circumscribed circle of the reference graph, a first position point, a width of the to-be-adjusted graph, and a radius of a circumscribed circle of the to-be-adjusted graph includes:
calculating an abscissa x2 and an ordinate y2 of a target point, and adjusting the to-be-adjusted figure by adjusting a second position point to the target point according to the following expression:
Figure BDA0002014064490000022
y2=y1+r2-r1
wherein the second location point is: points used for representing the positions of the graphs to be adjusted, w1 represents the width of the reference graph, w2 represents the width of the graphs to be adjusted, r1 represents the circumscribed circle radius of the reference graph, r2 represents the circumscribed circle radius of the graphs to be adjusted, and x1 and y1 represent the horizontal and vertical coordinates of the first position points respectively.
In a second aspect, an embodiment of the present invention provides a graphics adjusting apparatus, where the apparatus includes:
an information acquisition module: the method comprises the steps of obtaining the width of a graph to be adjusted;
the number of edges obtaining module: the graph adjusting device is used for acquiring the number of edges of the graph to be adjusted as the representation information of the graph to be adjusted under the condition that the graph to be adjusted is a regular convex polygon;
the vertex angle number acquisition module is used for acquiring the vertex angle number of the graph to be adjusted as the representation information under the condition that the graph to be adjusted is in a positive star shape;
the radius calculation module is used for acquiring the height of the graph to be adjusted and calculating the radius of a circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and the representation information;
the graph adjusting module is used for adjusting the graph to be adjusted according to the width of a preselected reference graph, the radius of a circumscribed circle of the reference graph, a first position point, the width of the graph to be adjusted and the radius of a circumscribed circle of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph, wherein the first position point is as follows: points representing the reference picture positions.
In an embodiment of the present invention, the radius calculation module is specifically configured to:
acquiring the height of a graph to be adjusted, and calculating the radius r of the circumscribed circle according to the following expression:
Figure BDA0002014064490000031
wherein h represents the acquired height, n represents the characterization information, and a, b, and c represent preset parameters.
In one embodiment of the present invention, the apparatus further comprises:
a circular adjusting module: and the adjusting device is used for adjusting the graph to be adjusted directly according to the width of the reference graph, the first position point and the width of the graph to be adjusted under the condition that the graph to be adjusted is circular, so that the graph to be adjusted is aligned with the center point of the reference graph.
In one embodiment of the present invention, the first location point is: and the intersection point of two adjacent edges in the circumscribed rectangle of the reference graph.
In an embodiment of the present invention, the graph adjustment module is specifically configured to:
calculating an abscissa x2 and an ordinate y2 of a target point, and adjusting the to-be-adjusted figure by adjusting a second position point to the target point according to the following expression:
Figure BDA0002014064490000041
y2=y1+r2-r1
wherein the second location point is: points used for representing the positions of the graphs to be adjusted, w1 represents the width of the reference graph, w2 represents the width of the graphs to be adjusted, r1 represents the circumscribed circle radius of the reference graph, r2 represents the circumscribed circle radius of the graphs to be adjusted, and x1 and y1 represent the horizontal and vertical coordinates of the first position points respectively.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the method steps of the first aspect are carried out.
In a fourth aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method steps described in the first aspect.
In a fifth aspect, embodiments of the present invention also provide a computer program product including instructions, which when executed on a computer, cause the computer to perform the method steps of the first aspect.
According to the technical scheme, the method and the device for adjusting the graph have the advantages that the width of the graph to be adjusted is obtained; under the condition that the graph to be adjusted is a regular convex polygon, acquiring the number of edges of the graph to be adjusted as representation information of the graph to be adjusted; under the condition that the graph to be adjusted is in a positive star shape, acquiring the number of vertex angles of the graph to be adjusted as representation information; the method comprises the steps of obtaining the height of a graph to be adjusted, calculating the radius of an external circle of the graph to be adjusted according to the height of the graph to be adjusted and characterization information, adjusting the graph to be adjusted according to the width of a pre-selected reference graph, the radius of the external circle of the reference graph, a first position point, the width of the graph to be adjusted and the radius of the external circle of the graph to be adjusted, and enabling the graph to be adjusted to be aligned with the center point of the reference graph, wherein the first position point is as follows: points representing the reference picture positions.
Compared with the prior art, when the scheme provided by the embodiment of the invention is applied to the graph adjustment, the graph to be adjusted is not judged by naked eyes any more, but is subjected to position adjustment according to the information such as the number of edges, the number of vertex angles and the like of the graph, so that the influence of subjective factors of a user on an adjustment result can be reduced, and the accuracy of center alignment adjustment of each graph is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for adjusting a graph according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a diagram provided by an embodiment of the present invention;
FIG. 3 is another schematic diagram provided in accordance with an embodiment of the present invention;
FIG. 4 is a schematic diagram of another embodiment of the present invention;
FIG. 5 is a flowchart illustrating another method for adjusting a pattern according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a graphic adjustment apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of another apparatus for adjusting a pattern according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a method and a device for adjusting a graph, which are respectively described in detail below.
First, an execution body of the graphic adjustment scheme provided by the embodiment of the present invention is explained.
The execution subject may be a software client. For example, the software client may perform file processing such as WPS, Word, PDF, or may perform graphics processing.
In addition, the execution main body may also be an electronic device running the software client. Such as desktop computers, notebook computers, tablet computers, smart phones, and the like.
The following describes a method for adjusting a pattern according to an embodiment of the present invention with reference to a specific embodiment.
Referring to fig. 1, fig. 1 is a schematic flow chart of a graph adjustment method according to an embodiment of the present invention, where the method includes the following steps
Step 101, obtaining the width of the graph to be adjusted.
In one embodiment of the present invention, the pattern to be adjusted may be a regular convex polygon, a regular star, or a circle. If the figure to be adjusted is a regular convex polygon or a regular star shape, the width and height of the figure to be adjusted may be the width and height of a circumscribed rectangle thereof. If the figure to be adjusted is a circle, the width and height of the figure to be adjusted may be the diameter of the figure to be adjusted.
Specifically, the regular convex polygon is a polygon having the following characteristics:
after any one side of the polygon is extended, the whole polygon is positioned at the same side of the extension line of the side; the vertex angles of the polygon are equal, and the side lengths of the polygon are equal. For example, the regular convex polygon may be: regular pentagons, regular hexagons, regular octagons, etc.
The regular star is a star with equal vertex angles and equal side lengths, such as a regular pentagram, a regular heptagram and the like.
In an implementation manner of the present invention, the width of the image to be adjusted may be obtained by obtaining the width of the image to be adjusted input by the user. For example, the electronic device may display an interface generation dialog box, and the user inputs the width of the graphic to be adjusted in the dialog box, so that the electronic device obtains the width input by the user.
In another implementation manner of the present invention, if the graph to be adjusted is a regular convex polygon or a regular star, the vertex coordinates of the graph to be adjusted may be identified, and the width of the graph to be adjusted may be calculated according to the coordinates.
In yet another implementation of the present invention, the width of the circumscribed rectangle of the graph to be adjusted is identified, and the width can be regarded as the width of the graph to be adjusted.
And 102, acquiring the number of edges of the graph to be adjusted as the representation information of the graph to be adjusted under the condition that the graph to be adjusted is a regular convex polygon.
In an implementation manner of the present invention, the number of edges may be obtained by obtaining the number of edges of the graph to be adjusted, which is input by the user. For example, the electronic device may display an interface generation dialog box first, and the user inputs the number of edges of the graph to be adjusted in the dialog box, so that the electronic device obtains the number of edges input by the user.
The other implementation manner of the invention can be to identify the number of vertex angles of the graph to be adjusted, and the number of sides of the regular convex polygon is the same as the number of vertex angles.
And 103, acquiring the vertex angle number of the graph to be adjusted as the representation information of the graph to be adjusted under the condition that the graph to be adjusted is in a positive star shape.
The method for realizing the vertex angle number adjustment comprises the step of obtaining the vertex angle number of the graph to be adjusted input by a user. For example, the electronic device may display an interface to generate a dialog box, and the user inputs the vertex angle number of the graph to be adjusted in the dialog box, so that the electronic device obtains the vertex angle number input by the user.
Another implementation of the present invention may be to directly identify the number of corners of the pattern to be adjusted.
And 104, acquiring the height of the graph to be adjusted, and calculating the radius of the circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and the representation information.
In an embodiment of the present invention, the radius r of the circumscribed circle of the graph to be adjusted may be calculated according to the following expression:
Figure BDA0002014064490000071
wherein h represents the acquired height, n represents the representation information of the graph to be adjusted, and a, b and c represent preset parameters.
Specifically, the value of a may be 2, the value of b may be 3, and the value of c may be 2. In this case, if the number of the sides of the graph to be adjusted is 3 and the height is 20 pixel points, the radius r of the circumscribed circle of the regular triangle with the height of 20 pixel points can be calculated according to the following formula:
Figure BDA0002014064490000072
the calculation shows that the radius of the circumscribed circle of the regular triangle with the height of 20 pixel points is 13 pixel points.
In addition to the above, the values of a, b, and c may be other values, for example, a may be 1, 1.5, 2.5, 3, etc., b may be 2.5, 3.5, 4, etc., and c may be 1, 1.5, 2.5, 3, etc. The embodiments of the present invention are described above as examples, and the schemes provided by the embodiments of the present invention are not limited.
And 105, adjusting the graph to be adjusted according to the width of the pre-selected reference graph, the radius of the circumscribed circle of the reference graph, the first position point, the width of the graph to be adjusted and the radius of the circumscribed circle of the adjusted graph, so that the graph to be adjusted is aligned with the center point of the reference graph.
Wherein, the first position point is: points representing the reference picture positions.
Specifically, when centering images, at least two figures are centered, and it is generally known which figures are to be centered before centering. Based on this, the reference pattern may be determined by a user manually selecting a pattern to be centered, or a pattern to be centered may be selected by a random selection, and the selected image may be used as the reference pattern.
Specifically, the abscissa x2 and the ordinate y2 of the target point may be calculated according to the following expression, and the to-be-adjusted graph may be adjusted by adjusting the second position point to the target point:
Figure BDA0002014064490000081
y2=y1+r2-r1
wherein the second location points are: points for indicating the position of the graph to be adjusted, w1 indicates the width of the reference graph, w2 indicates the width of the graph to be adjusted, r1 indicates the radius of the circumscribed circle of the reference graph, r2 indicates the radius of the circumscribed circle of the graph to be adjusted, and x1 and y1 respectively indicate the horizontal and vertical coordinates of the first position point.
Specifically, the first position point and the second position point are points representing positions of the reference pattern and the pattern to be adjusted, respectively. Referring to fig. 2, the first location point may be a center point of the reference pattern, or may be any vertex of a circumscribed rectangle of the reference pattern. Referring to fig. 3, the second location point may be a center point of the graph to be adjusted, or may be any vertex of a circumscribed rectangle of the graph to be adjusted.
In an embodiment of the invention, the first location point is an intersection of two adjacent edges in a circumscribed rectangle of the reference pattern.
Taking a circle as an example of the reference graph, assuming that a regular triangle with a height of 20 pixels is taken as the graph to be adjusted, a vertex where a left vertical edge and an upper horizontal edge of a circumscribed rectangle of the reference graph intersect is taken as a first position point, and a vertex where a left vertical edge and an upper horizontal edge of a circumscribed rectangle of the graph to be adjusted intersect is taken as a second position point. Wherein the reference pattern has a width of 20 pixel points, a radius of 10 pixel points, and a first position point coordinate of (10, 10); the width of the graph to be adjusted is 23 pixel points, and the radius is 13 pixel points, then the coordinates of the target points can be calculated by the following formula:
Figure BDA0002014064490000091
y2=10+13-10=13
the coordinates of the target point are (8, 13). And adjusting the graph to be adjusted to be aligned with the center point of the reference graph by moving the graph to be adjusted to adjust the second position point to the coordinates of the target point.
Specifically, referring to fig. 4, since the first position point may represent a position of the reference pattern, and the second position point may represent a position of the pattern to be adjusted, the second position point is adjusted to the calculated position of the target point, so that the center point of the pattern to be adjusted approaches the center point of the reference pattern.
Therefore, when the scheme provided by the embodiment of the invention is applied to adjust the graph, the width of the graph to be adjusted is obtained; under the condition that the graph to be adjusted is a regular convex polygon, acquiring the number of edges of the graph to be adjusted as representation information of the graph to be adjusted; under the condition that the graph to be adjusted is in a positive star shape, acquiring the number of vertex angles of the graph to be adjusted as representation information; the method comprises the steps of obtaining the height of a graph to be adjusted, calculating the radius of a circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and characterization information, and adjusting the graph to be adjusted according to the width of a pre-selected reference graph, the radius of the circumscribed circle of the reference graph, a first position point, the width of the graph to be adjusted and the radius of the circumscribed circle of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph. Compared with the prior art, when the scheme provided by the embodiment of the invention is applied to the graph adjustment, the graph to be adjusted is not judged by naked eyes any more, but is subjected to position adjustment according to the information such as the number of edges, the number of vertex angles and the like of the graph, so that the influence of subjective factors of a user on an adjustment result can be reduced, and the accuracy of center alignment adjustment of each graph is improved.
In an embodiment of the present invention, referring to fig. 5, a schematic flow chart diagram of another pattern adjustment method is provided, and compared with the foregoing embodiment shown in fig. 1, in this embodiment, the pattern adjustment method further includes:
step 106: and under the condition that the graph to be adjusted is circular, adjusting the graph to be adjusted directly according to the width of the reference graph, the first position point and the width of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph.
In particular, the radius of the circle being the width
Figure BDA0002014064490000092
The height and width of the circle are equal. When the circle is adjusted to be aligned with the center point of the reference pattern, since the height and width of the circle are equal to the diameter of the circle, in the implementation process, the calculation and adjustment of the pattern can be performed by obtaining the height, radius, diameter of the circle, the height of the circumscribed rectangle, the width of the circumscribed rectangle, and the like, which is not limited.
The following is an example of obtaining the width of the pattern to be adjusted.
The abscissa x2 and the ordinate y2 of the target point may be calculated according to the following expression, and the pattern to be adjusted may be adjusted by adjusting the second position point to the target point:
Figure BDA0002014064490000101
Figure BDA0002014064490000102
wherein the second location points are: points for indicating the position of the pattern to be adjusted, w1 the width of the reference pattern, w2 the width of the pattern to be adjusted, r1 the radius of the circumscribed circle of the reference pattern, and x1 and y1 the abscissa and ordinate respectively indicating the point of the first position.
Specifically, the first position point and the second position point are points representing positions of the reference pattern and the pattern to be adjusted, respectively. The first position point may be a center point of the reference pattern, or may be any vertex of a circumscribed rectangle of the reference pattern. The second position point may be a center point of the graph to be adjusted, or may be any vertex of a circumscribed rectangle of the graph to be adjusted.
Taking a circle as a reference graph as an example, assuming that the circle with the width of 40 pixel points is a graph to be adjusted, a vertex at which a left vertical edge and an upper horizontal edge of a circumscribed rectangle of the reference graph intersect is taken as a first position point, and a vertex at which the left vertical edge and the upper horizontal edge of the circumscribed rectangle of the graph to be adjusted intersect is taken as a second position point. Wherein the reference pattern has a width of 20 pixel points, a radius of 10 pixel points, and a first position point coordinate of (10, 10); if the width of the graph to be adjusted is 20 pixel points, the coordinates of the target points can be calculated by the following formula:
Figure BDA0002014064490000103
Figure BDA0002014064490000104
the coordinates of the target point are (0, 20). And adjusting the graph to be adjusted to be aligned with the center point of the reference graph by moving the graph to be adjusted to adjust the second position point to the coordinates of the target point.
Therefore, when the scheme provided by the embodiment of the invention is applied to pattern adjustment of a circle, the width of the circle can be directly obtained, the pattern to be adjusted is adjusted according to the width of the first position point and the reference pattern, the calculation steps are simplified, and the pattern to be adjusted and the reference pattern can be adjusted to be aligned to the central point more conveniently and quickly.
Fig. 6 is a schematic structural diagram of a graph adjustment apparatus according to an embodiment of the present invention, where the apparatus includes:
the information acquisition module 601: the method comprises the steps of obtaining the width of a graph to be adjusted;
the edge number obtaining module 602: the method comprises the steps of obtaining the number of edges of a graph to be adjusted as representation information of the graph to be adjusted under the condition that the graph to be adjusted is a regular convex polygon;
a vertex angle number obtaining module 603, configured to obtain, as the representation information, a vertex angle number of the graph to be adjusted when the graph to be adjusted is a positive star;
the radius calculation module 604 is configured to obtain a height of the to-be-adjusted graph, and calculate a circumscribed circle radius of the to-be-adjusted graph according to the height of the to-be-adjusted graph and the characterization information;
a graph adjusting module 605, configured to adjust the graph to be adjusted according to the preselected width of the reference graph, the radius of the circumscribed circle of the reference graph, the first position point, the width of the graph to be adjusted, and the radius of the circumscribed circle of the graph to be adjusted, so that the graph to be adjusted aligns with the center point of the reference graph, where the first position point is: points representing the reference picture positions.
In an embodiment of the present invention, the radius calculating module may specifically calculate a radius r of the circumscribed circle according to the following expression:
Figure BDA0002014064490000111
wherein h represents the acquired height, n represents the characterization information, and a, b, and c represent preset parameters.
In an embodiment of the present invention, the graph adjusting module specifically includes calculating an abscissa x2 and an ordinate y2 of the target point according to the following expression, and adjusting the graph to be adjusted by adjusting the second position point to the target point:
Figure BDA0002014064490000112
y2=y1+r2-r1
wherein the second location points are: points for indicating the position of the graph to be adjusted, w1 indicates the width of the reference graph, w2 indicates the width of the graph to be adjusted, r1 indicates the radius of the circumscribed circle of the reference graph, r2 indicates the radius of the circumscribed circle of the graph to be adjusted, and x1 and y1 respectively indicate the horizontal and vertical coordinates of the first position point.
Specifically, the first position point is: the intersection of two adjacent edges in the circumscribed rectangle of the reference pattern.
Therefore, when the device provided by the embodiments of the present invention is used to adjust the graph, the width of the graph to be adjusted is obtained; under the condition that the graph to be adjusted is a regular convex polygon, acquiring the number of edges of the graph to be adjusted as representation information of the graph to be adjusted; under the condition that the graph to be adjusted is in a positive star shape, acquiring the number of vertex angles of the graph to be adjusted as representation information; the method comprises the steps of obtaining the height of a graph to be adjusted, calculating the radius of a circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and characterization information, and adjusting the graph to be adjusted according to the width of a pre-selected reference graph, the radius of the circumscribed circle of the reference graph, a first position point, the width of the graph to be adjusted and the radius of the circumscribed circle of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph. Compared with the prior art, when the scheme provided by the embodiment of the invention is applied to the graph adjustment, the graph to be adjusted is not judged by naked eyes any more, but is subjected to position adjustment according to the information such as the number of edges, the number of vertex angles and the like of the graph, so that the influence of subjective factors of a user on an adjustment result can be reduced, and the accuracy of center alignment adjustment of each graph is improved.
Referring to fig. 7, in an embodiment of the present invention, compared with the aforementioned embodiment shown in fig. 3, the above-mentioned pattern adjusting apparatus further includes:
the circle adjustment module 606: and the adjusting device is used for adjusting the graph to be adjusted directly according to the width of the reference graph, the first position point and the width of the graph to be adjusted under the condition that the graph to be adjusted is circular, so that the graph to be adjusted is aligned with the center point of the reference graph.
Therefore, when the device provided by the embodiment of the invention is used for adjusting the graph of the circle, the width of the circle can be directly obtained, the graph to be adjusted is adjusted according to the width of the first position point and the reference graph, the calculation step is simplified, and the graph to be adjusted and the reference graph can be adjusted to be aligned to the central point more conveniently and rapidly.
Corresponding to the aforementioned graph adjustment method, an embodiment of the present invention further provides an electronic device, as shown in fig. 8, including a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete mutual communication via the communication bus 804,
a memory 803 for storing a computer program;
the processor 801 is configured to implement the graph adjustment method according to the embodiment of the present invention when executing the program stored in the memory 803.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program is executed by a processor to implement the steps of any of the above-mentioned graph adjustment methods.
In yet another embodiment, a computer program product containing instructions is provided, which when run on a computer causes the computer to perform any of the above-described graph adjustment methods.
It can be seen that, when the electronic device provided by the above embodiment is applied to perform graph adjustment, when the computer program stored in the computer-readable storage medium provided by the above embodiment is executed to perform graph adjustment, and when the computer program product provided by the above embodiment is run on a computer to perform graph adjustment, the width of the graph to be adjusted is obtained; under the condition that the graph to be adjusted is a regular convex polygon, acquiring the number of edges of the graph to be adjusted as representation information of the graph to be adjusted; under the condition that the graph to be adjusted is in a positive star shape, acquiring the number of vertex angles of the graph to be adjusted as representation information; the method comprises the steps of obtaining the height of a graph to be adjusted, calculating the radius of a circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and characterization information, and adjusting the graph to be adjusted according to the width of a pre-selected reference graph, the radius of the circumscribed circle, a first position point, the width of the graph to be adjusted and the radius of the circumscribed circle of the graph to be adjusted, so that the center point of the graph to be adjusted is aligned with the center point of the reference graph.
Compared with the prior art, when the scheme provided by the embodiment of the invention is applied to the graph adjustment, the position of the graph to be adjusted is adjusted according to the information such as the number of edges and the number of vertex angles of the graph without judging by naked eyes, so that the influence of subjective factors of a user on an adjustment result can be reduced, and the accuracy of center alignment adjustment of each graph is improved.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, apparatus embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are described with relative simplicity as they are substantially similar to method embodiments, where relevant only as described in portions of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (12)

1. A method for adjusting a pattern, the method comprising:
obtaining the width of a graph to be adjusted;
under the condition that the graph to be adjusted is a regular convex polygon, acquiring the number of edges of the graph to be adjusted as representation information of the graph to be adjusted;
under the condition that the graph to be adjusted is in a positive star shape, acquiring the vertex angle number of the graph to be adjusted as the representation information;
acquiring the height of a graph to be adjusted, and calculating the radius of a circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and the representation information;
adjusting the graph to be adjusted according to the width of a pre-selected reference graph, the radius of a circumscribed circle of the reference graph, a first position point, the width of the graph to be adjusted and the radius of the circumscribed circle of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph, wherein the first position point is as follows: points representing the reference picture positions.
2. The method according to claim 1, wherein the calculating the radius of the circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and the characterization information comprises:
calculating the radius r of the circumscribed circle of the graph to be adjusted according to the following expression:
Figure FDA0002014064480000011
wherein h represents the acquired height, n represents the characterization information, and a, b, and c represent preset parameters.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
and under the condition that the graph to be adjusted is circular, adjusting the graph to be adjusted directly according to the width of the reference graph, the first position point and the width of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph.
4. The method of claim 1, wherein the first location point is: and the intersection point of two adjacent edges in the circumscribed rectangle of the reference graph.
5. The method according to claim 1 or 2, wherein the adjusting the to-be-adjusted graph according to the preselected width of the reference graph, the radius of the circumcircle of the reference graph, the first position point, the width of the to-be-adjusted graph and the radius of the circumcircle of the to-be-adjusted graph comprises:
calculating an abscissa x2 and an ordinate y2 of a target point, and adjusting the to-be-adjusted figure by adjusting a second position point to the target point according to the following expression:
Figure FDA0002014064480000021
y2=y1+r2-r1
wherein the second location point is: points used for representing the positions of the graphs to be adjusted, w1 represents the width of the reference graph, w2 represents the width of the graphs to be adjusted, r1 represents the circumscribed circle radius of the reference graph, r2 represents the circumscribed circle radius of the graphs to be adjusted, and x1 and y1 represent the horizontal and vertical coordinates of the first position points respectively.
6. A pattern adjustment apparatus, characterized in that the apparatus comprises:
an information acquisition module: the method comprises the steps of obtaining the width of a graph to be adjusted;
the number of edges obtaining module: the graph adjusting device is used for acquiring the number of edges of the graph to be adjusted as the representation information of the graph to be adjusted under the condition that the graph to be adjusted is a regular convex polygon;
the vertex angle number acquisition module is used for acquiring the vertex angle number of the graph to be adjusted as the representation information under the condition that the graph to be adjusted is in a positive star shape;
the radius calculation module is used for acquiring the height of the graph to be adjusted and calculating the radius of a circumscribed circle of the graph to be adjusted according to the height of the graph to be adjusted and the representation information;
the graph adjusting module is used for adjusting the graph to be adjusted according to the width of a preselected reference graph, the radius of a circumscribed circle of the reference graph, a first position point, the width of the graph to be adjusted and the radius of a circumscribed circle of the graph to be adjusted, so that the graph to be adjusted is aligned with the center point of the reference graph, wherein the first position point is as follows: points representing the reference picture positions.
7. The apparatus of claim 6, wherein the radius calculation module is specifically configured to:
acquiring the height of a graph to be adjusted, and calculating the radius r of the circumscribed circle according to the following expression:
Figure FDA0002014064480000022
wherein h represents the acquired height, n represents the characterization information, and a, b, and c represent preset parameters.
8. The apparatus of claim 6 or 7, further comprising:
a circular adjusting module: and the adjusting device is used for adjusting the graph to be adjusted directly according to the width of the reference graph, the first position point and the width of the graph to be adjusted under the condition that the graph to be adjusted is circular, so that the graph to be adjusted is aligned with the center point of the reference graph.
9. The apparatus of claim 6, wherein the first location point is: and the intersection point of two adjacent edges in the circumscribed rectangle of the reference graph.
10. The apparatus according to claim 6 or 7, wherein the graph adjustment module is specifically configured to:
calculating an abscissa x2 and an ordinate y2 of a target point, and adjusting the to-be-adjusted figure by adjusting a second position point to the target point according to the following expression:
Figure FDA0002014064480000031
y2=y1+r2-r1
wherein the second location point is: points used for representing the positions of the graphs to be adjusted, w1 represents the width of the reference graph, w2 represents the width of the graphs to be adjusted, r1 represents the circumscribed circle radius of the reference graph, r2 represents the circumscribed circle radius of the graphs to be adjusted, and x1 and y1 represent the horizontal and vertical coordinates of the first position points respectively.
11. An electronic device comprising a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: carrying out the method steps of any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
CN201910257040.7A 2019-04-01 2019-04-01 Graph adjustment method and device Active CN111767700B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910257040.7A CN111767700B (en) 2019-04-01 2019-04-01 Graph adjustment method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910257040.7A CN111767700B (en) 2019-04-01 2019-04-01 Graph adjustment method and device

Publications (2)

Publication Number Publication Date
CN111767700A true CN111767700A (en) 2020-10-13
CN111767700B CN111767700B (en) 2023-10-27

Family

ID=72718682

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910257040.7A Active CN111767700B (en) 2019-04-01 2019-04-01 Graph adjustment method and device

Country Status (1)

Country Link
CN (1) CN111767700B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114329698A (en) * 2021-12-13 2022-04-12 清华大学建筑设计研究院有限公司 Building surface curved surface mesh construction method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH056402A (en) * 1990-10-23 1993-01-14 Ricoh Co Ltd Graphic editing device
US20140104684A1 (en) * 2010-01-14 2014-04-17 Nintendo Co., Ltd. Computer-readable storage medium having stored therein display control program, display control apparatus, display control system, and display control method
CN104240180A (en) * 2014-08-08 2014-12-24 沈阳东软医疗系统有限公司 Method and device for achieving automatic adjusting of images
US20150007073A1 (en) * 2013-06-27 2015-01-01 Panasonic Corporation Information processing apparatus
JP2016004333A (en) * 2014-06-13 2016-01-12 オムロン株式会社 Model image generation device and model image generation method
CN108259782A (en) * 2016-12-28 2018-07-06 株式会社理光 Image processing apparatus, camera chain, image processing method
JP2018157538A (en) * 2017-03-16 2018-10-04 株式会社リコー Program, imaging system, and information processing apparatus

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH056402A (en) * 1990-10-23 1993-01-14 Ricoh Co Ltd Graphic editing device
US20140104684A1 (en) * 2010-01-14 2014-04-17 Nintendo Co., Ltd. Computer-readable storage medium having stored therein display control program, display control apparatus, display control system, and display control method
US20150007073A1 (en) * 2013-06-27 2015-01-01 Panasonic Corporation Information processing apparatus
JP2016004333A (en) * 2014-06-13 2016-01-12 オムロン株式会社 Model image generation device and model image generation method
CN104240180A (en) * 2014-08-08 2014-12-24 沈阳东软医疗系统有限公司 Method and device for achieving automatic adjusting of images
CN108259782A (en) * 2016-12-28 2018-07-06 株式会社理光 Image processing apparatus, camera chain, image processing method
JP2018157538A (en) * 2017-03-16 2018-10-04 株式会社リコー Program, imaging system, and information processing apparatus

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114329698A (en) * 2021-12-13 2022-04-12 清华大学建筑设计研究院有限公司 Building surface curved surface mesh construction method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111767700B (en) 2023-10-27

Similar Documents

Publication Publication Date Title
US9697423B1 (en) Identifying the lines of a table
CN109697414B (en) Text positioning method and device
CN109753641B (en) Method and device for changing object position, electronic equipment and storage medium
KR20110044204A (en) Presenting dynamic grids
CN111091572A (en) Image processing method and device, electronic equipment and storage medium
CN110111284B (en) Method and device for correcting vignetting image, electronic equipment and storage medium
US9911201B2 (en) Imaging process initialization techniques
CN111767700B (en) Graph adjustment method and device
CN111951349B (en) Method and device for adjusting graph vertex types and electronic equipment
US20150084889A1 (en) Stroke processing device, stroke processing method, and computer program product
CN112751799B (en) Verification method and device based on picture verification code
CN109165648B (en) Image processing method, image processing device and mobile terminal
CN109993694B (en) Method and device for generating super-resolution image
US11288778B2 (en) Creation and rasterization of shapes using geometry, style settings, or location
CN111768464B (en) Graph adjustment method and device
CN110851029B (en) Method, device, terminal and storage medium for interchanging application icons
CN111784559B (en) Graph adjustment method and device
CN113496134A (en) Two-dimensional code positioning method, device, equipment and storage medium
CN112487769B (en) Cell background generation method and device
CN112785638B (en) Graphic processing method and device
US11233920B1 (en) Transforming document elements for modified document layouts
JP6520674B2 (en) Display system, display terminal, display method, and display program
CN111696169A (en) Method and device for generating equilateral polygon and electronic equipment
CN113673522B (en) Method, device and equipment for detecting inclination angle of text image and storage medium
CN109324797B (en) Desktop icon generation method, computer readable storage medium and terminal equipment

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