CN111768464B - Graph adjustment method and device - Google Patents

Graph adjustment method and device Download PDF

Info

Publication number
CN111768464B
CN111768464B CN201910257556.1A CN201910257556A CN111768464B CN 111768464 B CN111768464 B CN 111768464B CN 201910257556 A CN201910257556 A CN 201910257556A CN 111768464 B CN111768464 B CN 111768464B
Authority
CN
China
Prior art keywords
polygon
adjusted
width
adjusting
height
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
Application number
CN201910257556.1A
Other languages
Chinese (zh)
Other versions
CN111768464A (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 CN201910257556.1A priority Critical patent/CN111768464B/en
Publication of CN111768464A publication Critical patent/CN111768464A/en
Application granted granted Critical
Publication of CN111768464B publication Critical patent/CN111768464B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves

Abstract

The embodiment of the application provides a graph adjusting method and a device, and relates to the technical field of computer image processing, wherein the method comprises the following steps: obtaining the number of sides and the height of the polygon to be adjusted, calculating the distance from the center point of the regular polygon determined by the obtained number of sides and the height to the top point, calculating the width of the regular polygon determined by the obtained number of sides and the height according to the distance, and adjusting the width of the polygon to be adjusted to the calculated width under the condition that the height of the polygon to be adjusted is unchanged, so as to obtain the adjusted polygon with the same top angles. Since the calculated width is the width of the regular polygon, the width of the polygon to be adjusted is adjusted to the calculated width, and the vertex angles of the adjusted polygon are equal, so that the adjusted polygon can be considered to be the regular polygon. When the scheme provided by the embodiment of the application is applied to adjust the polygon, the probability of the obtained polygon being a regular polygon can be improved.

Description

Graph adjustment method and device
Technical Field
The present application relates to the field of computer image processing technology, and in particular, to a method and apparatus for adjusting graphics.
Background
As the use of various file processing software has become more widespread, users often need to draw regular polygons by the above software. However, when the user draws the regular polygon through the software, the drawing of the polygon is generally realized by dragging the mouse, and in this case, the side lengths and the vertex angles of the drawn polygon are generally different, that is, the drawn polygon is a non-regular polygon. Therefore, the above-mentioned non-regular polygon needs to be adjusted to obtain a regular polygon.
In the prior art, when the non-regular polygon is adjusted, a user usually manually adjusts the non-regular polygon by dragging a mouse, and then judges whether the polygon reaches the equal side length and the equal vertex angle size by naked eyes.
Although the adjustment of the non-regular polygon can be realized by applying the above method, errors usually exist when judging whether the side lengths are equal and whether the vertex angles are equal by naked eyes, and therefore the probability that the polygon obtained by adjustment is the regular polygon is low.
Disclosure of Invention
The embodiment of the application aims to provide a graph adjusting method and a graph adjusting device so as to improve the probability of obtaining a regular polygon by adjusting the polygon. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a method for adjusting a graphic, where the method includes:
acquiring the number of edges and the height of the polygon to be adjusted;
calculating the distance from the center point to the top point of the regular polygon determined by the obtained edge number and the height;
calculating the width of the regular polygon determined by the obtained edge number and the height according to the distance;
and under the condition that the height of the polygon to be adjusted is kept unchanged, adjusting the width of the polygon to be adjusted to be the calculated width to obtain an adjusted polygon with equal vertex angles.
In one embodiment of the present application, the calculating the distance from the center point to the vertex of the regular polygon determined by the acquired number of sides and the height includes:
the distance r is calculated according to the following expression:
wherein h represents the acquired height, n represents the acquired edge number, and a, b and c represent preset parameters.
In one embodiment of the present application, the calculating the width of the regular polygon determined by the acquired number of sides and the height according to the distance includes:
judging whether the acquired edge number is even, if so, calculating the width w according to the following expression:
wherein mod represents a remainder operator, h represents the acquired height, n represents the acquired edge number, r represents the distance, and d represents a preset parameter.
In one embodiment of the present application, the calculating the width of the regular polygon determined by the acquired number of sides and the height according to the distance includes:
judging whether the edge number of the current polygon is an odd number, if so, calculating the width w according to the following expression:
wherein n represents the acquired edge number, r represents the distance, and e and f represent preset parameters.
In one embodiment of the present application, the adjusting the width of the polygon to be adjusted to the calculated width while keeping the height of the polygon to be adjusted unchanged, to obtain an adjusted polygon with equal included angles between adjacent sides includes:
determining adjusting point information according to the acquired edge numbers, wherein the adjusting point information is used for representing the positions of adjusting points of the regular polygon determined by the acquired edge numbers and the heights, and the adjusting points are used for adjusting the edge lengths and the angle of each vertex angle of each edge of the polygon;
and adjusting the adjusting points of the polygon to be adjusted to the positions of the adjusting points of the regular polygon determined by the obtained edge numbers and the heights according to the adjusting point information, so that the width of the polygon to be adjusted is adjusted to be the calculated width under the condition that the heights of the polygon to be adjusted are kept unchanged, and the adjusted polygon with the same vertex angles is obtained.
In one embodiment of the present application, the adjustment point is located on one side of the polygon to be adjusted and circumscribes a rectangle;
the adjusting point information is as follows: information determined by the position of the adjustment point on the circumscribed rectangle side.
In one embodiment of the present application, the adjustment point information is: the ratio of the lengths of two sides in the connected triangle of the polygon to be adjusted, wherein the connected triangle is: the triangle is formed by a first side, a second side and a third side, wherein the first side is the side where the adjusting point is located on the circumscribed rectangle, and the second side is: the third side is a side adjacent to the first side along a preset direction in the circumscribed rectangle: and the polygon to be adjusted is provided with edges which are intersected with the first edge and the second edge.
In a second aspect, an embodiment of the present application provides a device for adjusting graphics, where the device includes:
the information acquisition module is used for acquiring the number of sides and the height of the polygon to be adjusted;
a distance calculation module for calculating the distance from the center point to the vertex of the regular polygon determined by the edge number and the height;
the width calculation module is used for calculating the width of the regular polygon determined by the edge number and the height according to the distance from the center point to the top point of the regular polygon;
and the graph adjusting module is used for adjusting the width of the polygon to be adjusted to be the calculated width under the condition of keeping the height of the polygon to be adjusted unchanged, so as to obtain the adjusted polygon with the same vertex angle.
In one embodiment of the present application, the distance calculating module is specifically configured to calculate the distance r according to the following expression:
wherein h represents the acquired height, n represents the acquired edge number, and a, b and c represent preset parameters.
In one embodiment of the present application, the width calculation module is specifically configured to determine whether the number of sides of the current polygon is even, and if so, calculate the width w according to the following expression:
wherein mod represents a remainder operator, h represents the acquired height, n represents the acquired edge number, r represents the distance, and d represents a preset parameter.
In one embodiment of the present application, the width calculation module is specifically configured to determine whether the number of sides of the current polygon is an odd number, and if so, calculate the width w according to the following expression:
wherein n represents the acquired edge number, r represents the distance, and e and f represent preset parameters.
In one embodiment of the present application, the graphic adjustment module is specifically configured to:
determining adjusting point information according to the acquired edge numbers, wherein the adjusting point information is used for representing the positions of adjusting points of the regular polygon determined by the acquired edge numbers and the heights, and the adjusting points are used for adjusting the edge lengths and the angle of each vertex angle of each edge of the polygon;
and adjusting the adjusting points of the polygon to be adjusted to the positions of the adjusting points of the regular polygon determined by the obtained edge numbers and the heights according to the adjusting point information, so that the width of the polygon to be adjusted is adjusted to be the calculated width under the condition that the heights of the polygon to be adjusted are kept unchanged, and the adjusted polygon with the same vertex angles is obtained.
In one embodiment of the present application, the adjustment point is located on one side of the polygon to be adjusted and circumscribes a rectangle;
the adjusting point information is as follows: information determined by the position of the adjustment point on the circumscribed rectangle side.
In one embodiment of the present application, the adjustment point information is: the ratio of the lengths of two sides in the connected triangle of the polygon to be adjusted, wherein the connected triangle is: the triangle is formed by a first side, a second side and a third side, wherein the first side is the side where the adjusting point is located on the circumscribed rectangle, and the second side is: the third side is a side adjacent to the first side along a preset direction in the circumscribed rectangle: and the polygon to be adjusted is provided with edges which are intersected with the first edge and the second edge.
In a third aspect, an embodiment of the present application provides 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: the method steps described in the first aspect are implemented.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored therein a computer program which, when executed by a processor, implements the method steps of the first aspect described above.
In a fifth aspect, embodiments of the present application also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method steps of the first aspect described above.
From the above, when the scheme provided by the embodiment of the application is applied to adjust the polygon, the edge number and the height of the polygon to be adjusted are obtained; calculating the distance from the center point to the top point of the regular polygon determined by the obtained edge number and the height; calculating the width of the regular polygon according to the distance; and under the condition of keeping the height of the polygon to be adjusted unchanged, adjusting the width of the polygon to be adjusted to be the calculated width to obtain the adjusted polygon with the same vertex angles. Since the calculated width is the width of the regular polygon, the width of the polygon to be adjusted is adjusted to the calculated width, and the vertex angles of the adjusted polygon are equal, so that the adjusted polygon can be considered to be the regular polygon. Compared with the prior art, when the scheme provided by the embodiment of the application is used for polygon adjustment, the polygon to be adjusted is adjusted according to the width of the regular polygon obtained by calculation without depending on naked eyes, so that the probability of the regular polygon is higher, and when the scheme provided by the embodiment of the application is used for polygon adjustment, the probability of the regular polygon can be improved.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a graphic adjustment method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an embodiment of the present application;
FIG. 3 is a schematic diagram of another embodiment of the present application;
FIG. 4 is a flowchart illustrating another method for adjusting graphics according to an embodiment of the present application;
FIG. 5 is a schematic view of still another embodiment of the present application;
FIG. 6 is a schematic diagram of a graphic adjustment apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The embodiment of the application provides a graph adjusting method and a graph adjusting device, which are respectively described in detail below.
First, an execution subject of the graphic adjustment scheme provided by the embodiment of the present application will be described.
The execution subject may be a software client. For example, the file processing may be performed by a software client such as WPS, word, PDF, or may be performed by a software client for graphics processing.
In addition, the execution body may be an electronic device running the software client. Such as desktop computers, notebook computers, tablet computers, smart phones, and the like.
The graphic adjustment method provided by the embodiment of the application is described below through a specific embodiment.
Referring to fig. 1, fig. 1 is a flowchart of a graphic adjustment method according to an embodiment of the present application, where the method includes the following steps 101 to 104.
Step 101, obtaining the number of edges and the height of the polygon to be adjusted.
Specifically, the polygon to be adjusted may be a regular polygon or a non-regular polygon, which is not limited by the present application.
The height of the polygon to be adjusted may be the height of its circumscribed rectangle. For example, as shown in fig. 2, the hexagon is a polygon to be adjusted, the rectangle circumscribed by the hexagon in the figure, and the length of the vertical side of the circumscribed rectangle represents the height of the circumscribed rectangle, so the height of the hexagon may be the height of the circumscribed rectangle.
The height of the polygon to be adjusted may be the height of a vertical line segment from a vertex of the polygon to be adjusted to the opposite side. For example, as shown in fig. 3, the pentagon is a polygon to be adjusted, and the line segment marked with the "height" word is a vertical line segment from one vertex to the opposite side of the pentagon, so the length of the line segment marked with the "height" word may be the height of the pentagon.
In one implementation of the present application, the number of sides and the height of the polygon may be obtained by obtaining the number of sides and the height of the polygon input by the user. For example, the electronic device may generate a dialog box in the display interface, and the user inputs the number of sides and the height of the polygon to be adjusted in the dialog box, so that the electronic device obtains the number of sides and the height input by the user.
In another implementation manner of the present application, vertices of the polygon to be adjusted may be identified, coordinates of the identified vertices may be obtained, the number of sides of the polygon to be adjusted may be calculated according to the number of the identified vertices, and the height of the polygon to be adjusted may be calculated according to the coordinates of the identified vertices.
In another implementation manner of the application, the height of the circumscribed rectangle of the polygon to be adjusted can be obtained, and the obtained height is used as the height of the polygon to be adjusted.
Step 102, calculating the distance from the center point to the vertex of the regular polygon determined by the obtained edge number and the height.
In one embodiment of the present application, the above distance r may be calculated from the following expression:
wherein h represents the acquired height, n represents the acquired edge number, 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 sides of the polygon to be adjusted is 3 and the height is 20 pixels, the distance from the center point to the vertex of the regular triangle with the height of 20 pixels can be calculated according to the above formula:
from the calculation, the distance from the center point to the vertex of the regular triangle with the height of 20 pixels is 13 pixels.
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 application are merely described by way of example, and are not limited to the configurations provided by the embodiments of the present application.
And step 103, calculating the width of the regular polygon determined by the acquired edge number and height according to the distance from the center point to the vertex of the regular polygon.
The inventor finds that the characteristics are different when the polygons have different edge numbers in the experimental process. In view of this, in one embodiment of the present application, if the number of sides of the polygon to be adjusted is an even number, the width w of the regular polygon determined by the acquired number of sides and height is calculated according to the following expression:
wherein mod represents a remainder operator, h represents the acquired height, n represents the acquired edge number, r represents the distance from the center point to the vertex of the regular polygon, and d represents a preset parameter.
Specifically, the value of d may be 4. In this case, if the number of edges of the polygon to be adjusted is 6 and the height is 20 pixels, the width of the regular hexagon with the height of 20 pixels can be calculated according to the above formula:
from the calculation, the width of the regular hexagon with the height of 20 pixels is 23 pixels.
In addition to the above, the value of d may be other values, for example, d may be 3, 5, 6, etc. The embodiments of the present application are merely described by way of example, and are not limited to the configurations provided by the embodiments of the present application.
In another embodiment of the present application, if the number of sides of the polygon to be adjusted is an odd number, the width w of the regular polygon determined by the acquired number of sides and height is calculated according to the following expression:
wherein n represents the acquired edge number, r represents the distance from the center point to the vertex of the regular polygon, and e and f represent preset parameters.
Specifically, the value of e may be 5, and the value of f may be 4. In this case, if the number of edges of the polygon to be adjusted is 3 and the height is 20 pixels, the width of the regular triangle with the height of 20 pixels can be calculated according to the above formula, which is:
from the calculation, the width of the positive triangle with the height of 20 pixels is 23 pixels.
In addition to the above, the values of e and f may be other values, for example, e may be 3, 4, 6, etc., and f may be 2, 3, 5, etc. The embodiments of the present application are merely described by way of example, and are not limited to the configurations provided by the embodiments of the present application.
And 104, under the condition that the height of the polygon to be adjusted is kept unchanged, adjusting the width of the polygon to be adjusted to be the calculated width to obtain an adjusted polygon with equal vertex angles.
The polygon to be adjusted may be adjusted in a plurality of different ways, which will be described below.
In one implementation manner of the present application, since the number of vertices of the polygon to be adjusted is also determined when the number of edges of the polygon to be adjusted is determined, in view of this, the angles of each vertex may be calculated according to the number of vertices of the polygon to be adjusted when the vertices are equal, that is, when the angles of each vertex are equal, and then the width of the polygon to be adjusted is adjusted to the calculated width and the angles of each vertex are adjusted to the calculated angles while ensuring that the height of the polygon to be adjusted is unchanged.
In another implementation manner of the application, the adjustment of the polygon to be adjusted can be realized by adjusting the circumscribed rectangle of the polygon to be adjusted. And under the condition of keeping the height of the polygon to be adjusted unchanged, adjusting the width of the circumscribed rectangle of the polygon to be adjusted to the width of the regular polygon obtained by calculation, and obtaining the adjusted polygon with equal vertex angles and equal side lengths.
Therefore, when the scheme provided by each embodiment of the application is applied to adjust the graph, the width of the polygon to be adjusted is adjusted to be the calculated width because the calculated width is the width of the regular polygon, and the vertex angles of the adjusted polygons are equal, so that the adjusted polygons can be considered to be the regular polygons. Compared with the prior art, when the scheme provided by the embodiment of the application is used for polygon adjustment, the polygon to be adjusted is adjusted according to the width of the regular polygon obtained by calculation without depending on naked eyes, so that the probability of the regular polygon is higher, and when the scheme provided by each embodiment is used for polygon adjustment, the probability of the regular polygon can be improved.
In an embodiment of the present application, referring to fig. 4, a flowchart of another graphic adjustment method is provided, and compared with the embodiment shown in fig. 1, in the embodiment, step 104, while keeping the height of the polygon to be adjusted unchanged, adjusts the width of the polygon to be adjusted to the calculated width, and the adjusted polygon with equal vertex angles includes the following steps:
step 104A, determining the adjusting point information according to the acquired edge number.
And the adjusting point information is used for indicating the position of an adjusting point of the regular polygon determined by the acquired edge number and the acquired height, and the adjusting point is used for adjusting the edge length and the angle of each vertex angle of each edge of the polygon.
Specifically, the adjustment point may be located on one side of the polygon to be adjusted and the external rectangle, where the information of the adjustment point is: information determined by the position of the adjustment point on the circumscribed rectangle.
Regarding the adjustment point information, the embodiments of the present application provide the following two implementations.
In a first aspect, the adjustment point information may be: the ratio of the lengths of two sides of a triangle to be connected of the polygon to be adjusted, wherein the triangle to be connected is: the triangle formed by the first side, the second side and the third side, wherein the first side is the side where the adjusting point is located on the circumscribed rectangle, and the second side is: the third side is the side adjacent to the first side along the preset direction in the circumscribed rectangle: edges intersecting both the first edge and the second edge on the polygon to be adjusted. The adjusting point information may be a ratio of the first side to the second side, a ratio of the first side to the third side, a ratio of the second side to the first side, a ratio of the third side to the first side, or a ratio of the third side to the second side.
Specifically, the ratio of the lengths of two sides in the connected triangle may be the ratio of the lengths of any two sides in the connected triangle, as shown in fig. 5, and the value of the information of the adjustment point of the hexagon may be the ratio of the lengths of any two sides of the first side, the second side and the third side.
In one embodiment of the present application, the adjustment point information is a ratio of the second side to the third side. The adjustment point information is denoted by p.
Specifically, if the pattern to be adjusted is hexagonal, the p value may be:
if the pattern to be adjusted is octagonal, the p-value size may be:
in addition, the predetermined direction may be any direction of two sides of the first edge. For example, when the first side is a horizontal side of the circumscribed rectangle, the second side may be a vertical side adjacent to the first side on the left side of the first side in the circumscribed rectangle, and the second side may be a vertical side adjacent to the first side on the right side of the first side in the circumscribed rectangle. When the first side is a vertical side of the circumscribed rectangle, the second side may be a horizontal side adjacent to the first side on the upper side of the first side in the circumscribed rectangle, and the second side may also be a horizontal side adjacent to the first side on the lower side of the first side in the circumscribed rectangle.
In a second aspect, the adjustment point information may be: the ratio of the lengths of two line segments in the line segments corresponding to the edges of the regulating points in the circumscribed rectangle of the polygon to be regulated.
The line segments corresponding to the edges of the adjusting points comprise a first line segment, a second line segment and a third line segment. The first line segment is a line segment from one end point of the side of the regulating point on the external rectangle to the regulating point, the second line segment is a line segment from the other end point of the side of the regulating point on the external rectangle to the regulating point, the third line segment is a line segment between the two end points of the side of the regulating point on the external rectangle, and the ratio of the two line segments of the side of the regulating point in the external rectangle of the polygon to be regulated is the ratio of the lengths of any two line segments in the three line segments. The adjusting point information can be the length ratio of the first line segment to the second line segment, the length ratio of the first line segment to the third line segment, the length ratio of the second line segment to the first line segment, the length ratio of the third line segment to the first line segment, and the length ratio of the third line segment to the second line segment.
And 104B, adjusting the adjusting points of the polygon to be adjusted to the positions of the adjusting points of the regular polygon determined by the obtained edge numbers and the heights according to the adjusting point information, so that the width of the polygon to be adjusted is adjusted to be the calculated width under the condition that the heights of the polygon to be adjusted are kept unchanged, and the adjusted polygon with the same vertex angles is obtained.
Since the adjusting point information can determine the adjusting point position, the adjusting point information calculated in step 104A is the adjusting point information of the regular polygon, and the adjusting point of the graph to be adjusted is adjusted to the position indicated by the calculated adjusting point information, that is, the graph to be adjusted is adjusted to the regular polygon, that is, the adjusted regular polygon is adjusted to have equal vertex angles and equal side lengths.
Therefore, the adjustment points are utilized for adjustment, the vertex angles and the side lengths of the polygons to be adjusted can be directly adjusted, and the polygons to be adjusted can be more conveniently and rapidly adjusted into the adjusted polygons with equal side lengths and equal vertex angles.
Corresponding to the graph adjusting method, the embodiment of the application also provides a graph adjusting device.
Fig. 6 is a schematic structural diagram of a graphic adjustment device according to an embodiment of the present application, where the device includes:
an information obtaining module 601, configured to obtain the number of sides and the height of the polygon to be adjusted;
a distance calculating module 602, configured to calculate a distance from a center point to a vertex of the regular polygon determined by the number of sides and the height;
a width calculation module 603, configured to calculate a width of the regular polygon determined by the number of sides and the height according to a distance from a center point to a vertex of the regular polygon;
the graph adjustment module 604 is configured to adjust the width of the polygon to be adjusted to the calculated width under the condition that the height of the polygon to be adjusted is kept unchanged, so as to obtain an adjusted polygon with equal vertex angles.
In one embodiment of the present application, the distance calculating module 602 may be specifically configured to calculate the distance r according to the following expression:
wherein h represents the acquired height, n represents the acquired edge number, and a, b and c represent preset parameters.
In one embodiment of the present application, the width calculation module 603 may be specifically configured to determine whether the number of sides of the current polygon is an even number, and if so, calculate the width w according to the following expression:
wherein mod represents a remainder operator, h represents the acquired height, n represents the acquired edge number, r represents the distance, and d represents a preset parameter.
In one embodiment of the present application, the width calculation module 603 may be specifically configured to determine whether the number of sides of the current polygon is an odd number, and if so, calculate the width w according to the following expression:
wherein n represents the acquired edge number, r represents the distance, and e and f represent preset parameters.
Therefore, when the scheme provided by each embodiment of the application is applied to adjust the graph, the width of the polygon to be adjusted is adjusted to be the calculated width because the calculated width is the width of the regular polygon, and the vertex angles of the adjusted polygons are equal, so that the adjusted polygons can be considered to be the regular polygons. Compared with the prior art, when the scheme provided by the embodiment of the application is used for polygon adjustment, the polygon to be adjusted is adjusted according to the width of the regular polygon obtained by calculation without depending on naked eyes, so that the probability of the regular polygon is higher, and when the scheme provided by each embodiment is used for polygon adjustment, the probability of the regular polygon can be improved.
In one embodiment of the present application, compared to the embodiment shown in fig. 6, the graphic adjustment module 604 includes:
and the adjusting point information unit is used for determining adjusting point information according to the acquired edge number.
The adjusting point information is used for representing the position of an adjusting point of the regular polygon determined by the acquired edge number and the acquired height, and the adjusting point is used for adjusting the edge length and the angle of each vertex angle of each edge of the polygon.
And the graph adjusting unit is used for adjusting the adjusting points of the polygon to be adjusted to the positions of the adjusting points of the regular polygon determined by the acquired edge numbers and the acquired heights according to the adjusting point information, so that the width of the polygon to be adjusted is adjusted to be the calculated width under the condition that the heights of the polygon to be adjusted are kept unchanged, and the adjusted polygon with the same vertex angles is obtained.
In one embodiment of the present application, the adjustment point is located on one side of the circumscribed rectangle of the polygon to be adjusted, and the adjustment point information is: information determined by the position of the adjustment point on the circumscribed rectangle side.
In one embodiment of the present application, the adjustment point information is: the ratio of the lengths of two sides in the connected triangle of the polygon to be adjusted, wherein the connected triangle is: the triangle is formed by a first side, a second side and a third side, wherein the first side is the side where the adjusting point is located on the circumscribed rectangle, and the second side is: the third side is a side adjacent to the first side along a preset direction in the circumscribed rectangle: and the polygon to be adjusted is provided with edges which are intersected with the first edge and the second edge.
Therefore, the adjustment points are utilized for adjustment, the vertex angles and the side lengths of the polygons to be adjusted can be directly adjusted, and the polygons to be adjusted can be more conveniently and rapidly adjusted into the adjusted polygons with equal side lengths and equal vertex angles.
Corresponding to the image adjustment method, the embodiment of the application also provides electronic equipment.
In one embodiment of the present application, as shown in fig. 7, there is provided a schematic structural diagram of an electronic device, the electronic device including: a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, the memory 703 complete communication with each other through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the graphics adjustment method provided by the embodiment of the present application when executing the program stored in the memory 703.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include 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 aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the graphics adjustment methods described above.
In yet another embodiment of the present application, a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the graphics adjustment methods of the above embodiments is also provided.
It can be seen that, when the electronic device provided by the above embodiment is applied to perform graphics adjustment, when the computer program stored in the computer readable storage medium provided by the above embodiment is executed to perform graphics adjustment, and when the computer program product provided by the above embodiment is run on a computer to perform graphics adjustment, the distance from the center point to the vertex of the regular polygon determined by the obtained edge number and height is calculated by obtaining the edge number and height of the polygon to be adjusted; calculating the width of the regular polygon according to the distance; and under the condition that the height of the polygon to be adjusted is kept unchanged, adjusting the width of the polygon to be adjusted to be the calculated width to obtain an adjusted polygon with the same vertex angle, and considering the adjusted polygon as a regular polygon.
Compared with the prior art, when the scheme provided by the embodiment of the application is used for polygon adjustment, the electronic equipment, the readable storage medium and the computer program product can quickly and accurately realize the polygon adjustment method, and the polygon to be adjusted is adjusted according to the calculated width of the regular polygon without judging by naked eyes, so that the probability of the regular polygon is higher, and therefore, when the scheme provided by the embodiment of the application is used for polygon adjustment, the probability of the regular polygon can be improved.
In the above embodiments, it may be implemented in whole or in part 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, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more 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)), etc.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the apparatus embodiments, the electronic device embodiments, the computer-readable storage medium embodiments, and the computer program product embodiments, the description is relatively simple, and reference should be made to the description of method embodiments in part, since they are substantially similar to the method embodiments.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (12)

1. A method of graphic adjustment, the method comprising:
acquiring the number of edges and the height of the polygon to be adjusted;
calculating the distance from the center point to the top point of the regular polygon determined by the obtained edge number and the height;
calculating the width of the regular polygon determined by the obtained edge number and the height according to the distance;
under the condition that the height of the polygon to be adjusted is kept unchanged, adjusting the width of the polygon to be adjusted to be the calculated width to obtain an adjusted polygon with equal vertex angles;
under the condition that the height of the polygon to be adjusted is kept unchanged, adjusting the width of the polygon to be adjusted to be the calculated width to obtain an adjusted polygon with equal vertex angles, wherein the method comprises the following steps:
determining adjusting point information according to the obtained edge number, wherein the adjusting point information is used for representing the position of an adjusting point of the regular polygon; the adjusting points are used for adjusting the side length of each side of the polygon and the angle of each vertex angle, and are positioned on one side of the circumscribed rectangle of the polygon to be adjusted, the information of the adjusting points is determined by the position of the adjusting points on the side, and the information is the ratio of the lengths of two sides in the connected triangle of the polygon to be adjusted;
and adjusting the adjusting points of the polygon to be adjusted to the positions of the adjusting points of the regular polygon determined by the obtained edge numbers and the heights according to the adjusting point information, so that the width of the polygon to be adjusted is adjusted to be the calculated width under the condition that the heights of the polygon to be adjusted are kept unchanged, and the adjusted polygon with the same vertex angles is obtained.
2. The method of claim 1, wherein calculating the center-to-vertex distance of the regular polygon determined by the number of sides and the height obtained comprises:
the distance r is calculated according to the following expression:
wherein h represents the acquired height, n represents the acquired edge number, and a, b and c represent preset parameters.
3. The method according to claim 1 or 2, wherein calculating the width of the regular polygon determined by the acquired number of sides and height from the distance comprises:
judging whether the acquired edge number is even, if so, calculating the width w according to the following expression:
wherein mod represents a remainder operator, h represents the acquired height, n represents the acquired edge number, r represents the distance, and d represents a preset parameter.
4. The method according to claim 1 or 2, wherein calculating the width of the regular polygon determined by the acquired number of sides and height from the distance comprises:
judging whether the edge number of the current polygon is an odd number, if so, calculating the width w according to the following expression:
wherein n represents the acquired edge number, r represents the distance, and e and f represent preset parameters.
5. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the connected triangles are as follows: the triangle is formed by a first side, a second side and a third side, wherein the first side is the side where the adjusting point is located on the circumscribed rectangle, and the second side is: the third side is a side adjacent to the first side along a preset direction in the circumscribed rectangle: and the polygon to be adjusted is provided with edges which are intersected with the first edge and the second edge.
6. An apparatus for graphic adjustment, the apparatus comprising:
the information acquisition module is used for acquiring the number of sides and the height of the polygon to be adjusted;
a distance calculation module for calculating the distance from the center point to the vertex of the regular polygon determined by the edge number and the height;
the width calculation module is used for calculating the width of the regular polygon determined by the edge number and the height according to the distance from the center point to the top point of the regular polygon;
the graphic adjustment module is used for adjusting the width of the polygon to be adjusted to be the calculated width under the condition of keeping the height of the polygon to be adjusted unchanged, so as to obtain an adjusted polygon with equal vertex angles;
the graphic adjustment module is specifically configured to:
determining adjusting point information according to the obtained edge number, wherein the adjusting point information is used for representing the position of an adjusting point of the regular polygon; the adjusting points are used for adjusting the side length of each side of the polygon and the angle of each vertex angle, and are positioned on one side of the circumscribed rectangle of the polygon to be adjusted, the information of the adjusting points is determined by the position of the adjusting points on the side, and the information is the ratio of the lengths of two sides in the connected triangle of the polygon to be adjusted;
and adjusting the adjusting points of the polygon to be adjusted to the positions of the adjusting points of the regular polygon determined by the obtained edge numbers and the heights according to the adjusting point information, so that the width of the polygon to be adjusted is adjusted to be the calculated width under the condition that the heights of the polygon to be adjusted are kept unchanged, and the adjusted polygon with the same vertex angles is obtained.
7. The apparatus according to claim 6, wherein:
the distance calculating module is specifically configured to calculate the distance r according to the following expression:
wherein h represents the acquired height, n represents the acquired edge number, and a, b and c represent preset parameters.
8. The apparatus according to claim 6 or 7, characterized in that:
the width calculation module is specifically configured to determine whether the number of edges of the current polygon is an even number, and if so, calculate the width w according to the following expression:
wherein mod represents a remainder operator, h represents the acquired height, n represents the acquired edge number, r represents the distance, and d represents a preset parameter.
9. The apparatus according to claim 6 or 7, wherein,
the width calculation module is specifically configured to determine whether the number of edges of the current polygon is an odd number, and if so, calculate the width w according to the following expression:
wherein n represents the acquired edge number, r represents the distance, and e and f represent preset parameters.
10. The apparatus of claim 6, wherein the device comprises a plurality of sensors,
the connected triangles are as follows: the triangle is formed by a first side, a second side and a third side, wherein the first side is the side where the adjusting point is located on the circumscribed rectangle, and the second side is: the third side is a side adjacent to the first side along a preset direction in the circumscribed rectangle: and the polygon to be adjusted is provided with edges which are intersected with the first edge and the second edge.
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: method steps of any of claims 1-5 are achieved.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-5.
CN201910257556.1A 2019-04-01 2019-04-01 Graph adjustment method and device Active CN111768464B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910257556.1A CN111768464B (en) 2019-04-01 2019-04-01 Graph adjustment method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910257556.1A CN111768464B (en) 2019-04-01 2019-04-01 Graph adjustment method and device

Publications (2)

Publication Number Publication Date
CN111768464A CN111768464A (en) 2020-10-13
CN111768464B true CN111768464B (en) 2023-09-19

Family

ID=72718124

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910257556.1A Active CN111768464B (en) 2019-04-01 2019-04-01 Graph adjustment method and device

Country Status (1)

Country Link
CN (1) CN111768464B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001357409A (en) * 2000-06-13 2001-12-26 Canon Inc Picture processor, picture processing method and storage medium
WO2006117471A1 (en) * 2005-04-29 2006-11-09 Universite Pierre Et Marie Curie (Paris Vi) Method of generating a graphical interface
WO2011072938A1 (en) * 2009-12-16 2011-06-23 International Business Machines Corporation Graphical user interface to adjust and visualize competing parameters
JP2016036993A (en) * 2014-08-08 2016-03-22 大日本印刷株式会社 Data output regulation device for three-dimensional molding
CN106898033A (en) * 2017-02-22 2017-06-27 北京金双狐油气技术有限公司 One kind generation polygonal method of isopleth
WO2019012887A1 (en) * 2017-07-14 2019-01-17 大日本印刷株式会社 Shape correction device and shape correction method for graphical pattern

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8704837B2 (en) * 2004-04-16 2014-04-22 Apple Inc. High-level program interface for graphics operations
US7508400B2 (en) * 2005-03-23 2009-03-24 Zenrin Co., Ltd. Digital map data processing system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001357409A (en) * 2000-06-13 2001-12-26 Canon Inc Picture processor, picture processing method and storage medium
WO2006117471A1 (en) * 2005-04-29 2006-11-09 Universite Pierre Et Marie Curie (Paris Vi) Method of generating a graphical interface
WO2011072938A1 (en) * 2009-12-16 2011-06-23 International Business Machines Corporation Graphical user interface to adjust and visualize competing parameters
JP2016036993A (en) * 2014-08-08 2016-03-22 大日本印刷株式会社 Data output regulation device for three-dimensional molding
CN106898033A (en) * 2017-02-22 2017-06-27 北京金双狐油气技术有限公司 One kind generation polygonal method of isopleth
WO2019012887A1 (en) * 2017-07-14 2019-01-17 大日本印刷株式会社 Shape correction device and shape correction method for graphical pattern

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CAD教学中绘制正多边形的教学对策研究;谭毓澄等;《九江学院学报》(第3期);第54-56页 *

Also Published As

Publication number Publication date
CN111768464A (en) 2020-10-13

Similar Documents

Publication Publication Date Title
US10162498B2 (en) Providing selection areas for selectable objects in graphical interface
CN109753641B (en) Method and device for changing object position, electronic equipment and storage medium
KR20210018180A (en) Deep neural network normalization method and apparatus, device, and storage medium
CN109741287B (en) Image-oriented filtering method and device
US10950017B2 (en) Glyph weight modification
US9723204B2 (en) Dynamic motion path blur kernel
KR20110044204A (en) Presenting dynamic grids
US10319129B2 (en) Snapping line generation
CN111091572B (en) Image processing method and device, electronic equipment and storage medium
CN115357155A (en) Window identification method, device, equipment and computer readable storage medium
CN111523531A (en) Word processing method and device, electronic equipment and computer readable storage medium
CN114445825A (en) Character detection method and device, electronic equipment and storage medium
CN111768464B (en) Graph adjustment method and device
CN111951349B (en) Method and device for adjusting graph vertex types and electronic equipment
CN109165648B (en) Image processing method, image processing device and mobile terminal
CN111767700B (en) Graph adjustment method and device
US9594955B2 (en) Modified wallis filter for improving the local contrast of GIS related images
CN111784559A (en) Graph adjusting method and device
EP3051401A1 (en) Image display apparatus, image enlargement method, and image enlargement program
CN112233202B (en) Regular polygon drawing method and device, electronic equipment and readable storage medium
US10832442B2 (en) Displaying smart guides for object placement based on sub-objects of reference objects
US10535121B2 (en) Creation and rasterization of shapes using geometry, style settings, or location
CN111696169A (en) Method and device for generating equilateral polygon and electronic equipment
US11233920B1 (en) Transforming document elements for modified document layouts
US11631220B2 (en) Digital object surface inflation

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