CN111951349A - Method and device for adjusting graph vertex type and electronic equipment - Google Patents
Method and device for adjusting graph vertex type and electronic equipment Download PDFInfo
- Publication number
- CN111951349A CN111951349A CN201910410662.9A CN201910410662A CN111951349A CN 111951349 A CN111951349 A CN 111951349A CN 201910410662 A CN201910410662 A CN 201910410662A CN 111951349 A CN111951349 A CN 111951349A
- Authority
- CN
- China
- Prior art keywords
- vertex
- control point
- target
- type
- coordinates
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000004364 calculation method Methods 0.000 claims description 53
- 238000004891 communication Methods 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 11
- 230000004048 modification Effects 0.000 claims description 5
- 238000012986 modification Methods 0.000 claims description 5
- 241001442234 Cosa Species 0.000 claims 2
- 244000089409 Erythrina poeppigiana Species 0.000 claims 2
- 235000009776 Rathbunia alamosensis Nutrition 0.000 claims 2
- 230000008569 process Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000003491 array Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Processing Or Creating Images (AREA)
Abstract
The embodiment of the invention provides a method and a device for adjusting a graph vertex type and electronic equipment. The method comprises the following steps: when a type adjusting instruction aiming at a target vertex of a target graph, which is sent by terminal equipment, is detected, an object configuration file corresponding to the target graph is obtained; and adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so that the coordinates of each control point corresponding to the target vertex are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier. In the embodiment of the invention, the terminal equipment can automatically adjust the coordinates of each control point corresponding to the target vertex in the graph, so that the problem that the vertex type of the vertex cannot be accurately adjusted when a user manually adjusts the coordinates of each control point corresponding to the target vertex is avoided, and the accuracy of adjusting the vertex type of the graph vertex is improved.
Description
Technical Field
The present invention relates to the field of graphics modification technologies, and in particular, to a method and an apparatus for adjusting a vertex type of a graphic, and an electronic device.
Background
In teletext office software, a user can draw a graphic of various shapes, e.g., circles, rectangles, triangles, etc., consisting of line segments or arcs. Wherein each graph comprises a plurality of vertexes, and two control points are arranged near each vertex, as shown in fig. 1, and points a, b, c and d are four vertexes of the graph circle. In general, vertex types in an image may be classified into smooth vertices, straight vertices, and corner vertices. The user may alter the shape of the graph by adjusting the type of vertices in the graph. For example, the user may adjust the circular figure to a parallelogram by adjusting the vertex types of the four vertices of the circle from smooth vertices to corner vertices.
Currently, when the vertex type of a graph is converted from a smooth vertex (a straight vertex) to a corner vertex, a user may first convert the vertex type of a vertex in the graph recorded in a configuration file corresponding to software from a smooth vertex (a straight vertex) to a corner vertex. Then, the user manually adjusts the two control points of the vertex until the line segment (or arc) between the vertex of the adjusted vertex type and its adjacent vertex is made a straight line, so that the vertex type of the graph can be converted from a smooth vertex (straight vertex) to a corner vertex.
Obviously, when the vertex type of the graph is manually adjusted from a smooth vertex (a straight vertex) to a corner vertex by the current user, the line segment (or the circular arc) between the vertex of the adjusted vertex type and the adjacent vertex cannot be accurately and efficiently adjusted to be a straight line.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for adjusting a graph vertex type and electronic equipment, so as to improve the accuracy of adjusting the vertex type of the graph vertex.
The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for adjusting a vertex type of a graph, where the method includes:
when a type adjusting instruction aiming at a target vertex of a target graph, which is sent by terminal equipment, is detected, an object configuration file corresponding to the target graph is obtained; the object configuration file comprises type identification of the target vertex and coordinates of at least two control points corresponding to the target vertex; the type adjusting instruction is used for adjusting the vertex type of the target vertex into a vertex type corresponding to the corner vertex identification;
modifying the vertex type of the target vertex in the object configuration file into a vertex type corresponding to the corner vertex identification;
aiming at each control point, determining a strategy and coordinates of the control point according to preset coordinates of the control point, and determining the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification;
and modifying the coordinates of each control point corresponding to the target vertex in the object configuration file so as to adjust the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier.
Optionally, the coordinates of the control point may include a first abscissa and a first ordinate;
the step of determining, for each control point, coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is adjusted to the vertex type corresponding to the corner vertex identifier according to a preset control point coordinate determination policy and the coordinates of the control point may include:
calculating a second abscissa of the control point according to a control point abscissa calculation formula preset in the strategy and the first abscissa, and calculating a second ordinate of the control point according to the control point ordinate calculation formula in the strategy and the first ordinate;
and combining the second abscissa and the second ordinate into the coordinate of the control point when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification.
Optionally, the step of calculating a second abscissa of the control point according to the control point abscissa calculation formula preset in the strategy and the first abscissa, and calculating a second ordinate of the control point according to the control point ordinate calculation formula in the strategy and the first ordinate, may include:
determining a first distance between the target vertex and the control point corresponding to the target vertex based on a preset linear distance calculation formula;
determining a first relative angle between the target vertex and a first adjacent vertex of the target vertex based on a preset relative angle determination formula, wherein the first adjacent vertex is a vertex which is adjacent to the target vertex and has the same direction as the control point corresponding to the target vertex;
inputting the first distance and the first relative angle into a control point abscissa calculation formula in the determination strategy to obtain a second abscissa of the control point corresponding to the target vertex;
and inputting the first distance and the first relative angle into a control point ordinate calculation formula in the determination strategy to obtain a second ordinate of the control point corresponding to the target vertex.
Optionally, the preset linear distance calculation formula may be:
h is a first distance between the target vertex and each control point corresponding to the target vertex, and x1And y1The first coordinate of the control point being the target vertex, x and y the target vertexCoordinates of the points;
the preset relative angle determination formula may be:
wherein a is a first relative angle between a target vertex and a first adjacent vertex of the target vertex, x and y are coordinates of the target vertex, and x 'and y' are coordinates of the first adjacent vertex adjacent to the target vertex;
the control point abscissa calculation formula may be:
x′1=h×cos a
wherein, x'1A second abscissa of a control point corresponding to the target vertex;
the control point ordinate calculation formula may be:
y′1=h×sin a
wherein, y'1And the second ordinate of the control point corresponding to the target vertex.
In a second aspect, an embodiment of the present invention provides an apparatus for adjusting a vertex type of a graph, where the apparatus includes:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring an object configuration file corresponding to a target graph when a type adjustment instruction aiming at a target vertex of the target graph, which is sent by terminal equipment, is detected; the object configuration file comprises type identification of the target vertex and coordinates of at least two control points corresponding to the target vertex; the type adjusting instruction is used for adjusting the vertex type of the target vertex into a vertex type corresponding to the corner vertex identification;
a modification module, configured to modify the vertex type of the target vertex in the object configuration file to a vertex type corresponding to the corner vertex identifier;
the determining module is used for determining a strategy and coordinates of the control point according to preset coordinates of the control point for each control point, and determining the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification;
and the adjusting module is used for adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so as to adjust the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier.
Optionally, the coordinates of each control point include a first abscissa and a first ordinate;
the determining module may include:
the calculation unit is used for calculating a second abscissa of the control point according to a control point abscissa calculation formula preset in the strategy and the first abscissa, and calculating a second ordinate of the control point according to a control point ordinate calculation formula in the strategy and the first ordinate;
and the composition unit is used for composing the coordinates of the control point when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification by the second abscissa and the second ordinate.
Optionally, the computing unit may include:
the first distance determining subunit is configured to determine, based on a preset linear distance calculation formula, a first distance between the target vertex and the control point corresponding to the target vertex;
the first relative angle determining subunit is used for determining a first relative angle between the target vertex and a first adjacent vertex of the target vertex based on a preset relative angle determining formula, wherein the first adjacent vertex is a vertex which is adjacent to the target vertex and has the same direction as the control point corresponding to the target vertex;
the second abscissa determining subunit is configured to input the first distance and the first relative angle into the control point abscissa calculation formula in the determination policy, so as to obtain a second abscissa of the control point corresponding to the target vertex;
and the second ordinate determining subunit is configured to input the first distance and the first relative angle into the control point ordinate calculation formula in the determination policy, so as to obtain a second ordinate of the control point corresponding to the target vertex.
Optionally, the preset linear distance calculation formula may be:
h is a first distance between the target vertex and the control point corresponding to the target vertex, and x1And y1The first coordinate of the control point of the target vertex, and the coordinates of the target vertex in x and y;
the preset relative angle determination formula is as follows:
wherein a is a first relative angle between a target vertex and a first adjacent vertex of the target vertex, x and y are coordinates of the target vertex, and x 'and y' are coordinates of the first adjacent vertex adjacent to the target vertex;
the control point abscissa calculation formula may be:
x′1=h×cos a
wherein, x'1A second abscissa of a control point corresponding to the target vertex;
the control point ordinate calculation formula may be:
y′1=h×sin a
wherein, y'1And the second ordinate of the control point corresponding to the target vertex.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
the processor is used for realizing the following method steps when executing the program stored in the memory:
when a type adjusting instruction aiming at a target vertex of a target graph, which is sent by terminal equipment, is detected, an object configuration file corresponding to the target graph is obtained; the object configuration file comprises type identification of the target vertex and coordinates of at least two control points corresponding to the target vertex; the type adjusting instruction is used for adjusting the vertex type of the target vertex into a vertex type corresponding to the corner vertex identification;
modifying the vertex type of the target vertex in the object configuration file into a vertex type corresponding to the corner vertex identification;
aiming at each control point, determining a strategy and coordinates of the control point according to preset coordinates of the control point, and determining the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification;
and adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so that the coordinates of each control point corresponding to the target graph are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identification.
In a fourth aspect, the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above methods for adjusting a vertex type of a graph.
In a fifth aspect, embodiments of the present invention further provide a computer program product containing instructions, which when run on a computer, cause the computer to perform any of the above-mentioned methods for adjusting vertex types of graphics.
The embodiment of the invention provides a method and a device for adjusting a graph vertex type and electronic equipment. The method comprises the following steps: when a type adjusting instruction aiming at a target vertex of a target graph, which is sent by terminal equipment, is detected, an object configuration file corresponding to the target graph is obtained; and adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so that the coordinates of each control point corresponding to the target vertex are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier. In the embodiment of the invention, the terminal equipment can automatically adjust the coordinates of each control point corresponding to the target vertex in the graph, so that the problem that the vertex type of the vertex cannot be accurately adjusted when a user manually adjusts the coordinates of each control point corresponding to the target vertex is avoided, and the accuracy of adjusting the vertex type of the graph vertex is improved.
Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
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 an exemplary diagram of a graph vertex provided in an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating a method for adjusting a vertex type of a graph according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating another method for adjusting vertex types of a graph according to an embodiment of the present disclosure;
FIG. 4 is a schematic structural diagram of an apparatus for adjusting vertex type of a graph according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
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.
In order to improve the accuracy of adjusting the vertex type of the graph vertex, embodiments of the present invention provide a method and an apparatus for adjusting the vertex type of the graph, and an electronic device, which are described in detail below.
First, a method for adjusting a vertex type of a graph according to an embodiment of the present invention is described below.
The application provides a method for adjusting the graph vertex type, which can be applied to terminal equipment. The terminal equipment can be equipment provided with image-text office software such as Microsoft or wps office. For example, the device may be a mobile phone or a tablet PC, or may be a Personal Computer (PC), a television, or the like.
Referring to fig. 2, fig. 2 is a schematic flowchart of a method for adjusting a vertex type of a graph according to an embodiment of the present invention, where the method includes the following steps:
s201, when a type adjusting instruction which is sent by the terminal device and aims at a target vertex of the target graph is detected, an object configuration file corresponding to the target graph is obtained.
In practical application, in the graphic office software, a user can draw various shapes of graphs consisting of line segments or circular arcs. Meanwhile, the terminal device installed with the image-text office software stores object configuration files corresponding to various images drawn by the user through the office software. In the embodiment of the invention, the vertex to be subjected to vertex type adjustment in the target graph is called a target vertex. The object configuration file can contain type identification of a target vertex and coordinates of at least two control points corresponding to the target vertex; in the embodiment of the invention, the number of the control points corresponding to the target vertex is two. The type adjustment instructions are for adjusting the vertex type of the target vertex to a vertex type corresponding to the corner vertex identification.
In implementation, the graphic office software is provided with an interface for human-computer interaction, and when a user needs to adjust the vertex type of a target vertex on a target graph on the interface, the user can click the target vertex of the target graph on the interface. And the terminal equipment correspondingly generates a type adjusting instruction aiming at the target vertex of the target graph. When the terminal device detects a generated type adjustment instruction for a target vertex of a target graph, the terminal device obtains an object configuration file corresponding to the target graph.
S202, the vertex type of the target vertex in the object configuration file is modified into the vertex type corresponding to the corner vertex identification.
In implementation, after acquiring the object configuration file corresponding to the target graph, the terminal device may modify the current vertex type of the target vertex recorded in the object configuration file to the vertex type corresponding to the corner vertex identifier.
The vertex identifier may be any identifier for distinguishing different vertex types, for example, the vertex type corresponding to the corner vertex identifier may be a character string such as 1, a, or B, and the present invention is not limited in particular.
S203, aiming at each control point, determining a strategy according to the preset control point coordinates and the control point coordinates, and determining the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification.
In the embodiment of the present invention, two control points corresponding to the target vertex may be referred to as a first control point and a second control point, respectively. Meanwhile, the coordinates of each control point of the target vertex before the vertex type is adjusted may be referred to as first coordinates.
Wherein the first coordinate may include a first abscissa and a first ordinate.
In implementation, after modifying the vertex type of the target vertex in the object configuration file to the vertex type corresponding to the corner vertex identifier, the terminal device needs to modify the coordinates of the two control points corresponding to the target vertex in the object configuration corresponding to the target vertex, so that the target vertex type can be accurately adjusted to the vertex type corresponding to the corner vertex identifier. For each control point of the target vertex, the terminal device may determine, according to a preset coordinate calculation formula in the preset control point coordinate determination policy and the first coordinate of the control point before the vertex type of the target vertex is adjusted, the second coordinate of the control point after the vertex type of the target vertex is adjusted to the corner vertex type.
Optionally, an embodiment of the present invention provides a specific processing procedure for determining second coordinates of control points corresponding to a target vertex, where the specific processing procedure includes the following steps:
calculating a second abscissa of the control point according to a control point abscissa calculation formula and a first abscissa preset in the strategy, and calculating a second ordinate of the control point according to a control point ordinate calculation formula and the first ordinate in the strategy; and combining the second abscissa and the second ordinate into the coordinate of the control point when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification.
In implementation, the terminal device may calculate the second abscissa of each control point according to a preset control point abscissa calculation formula, and then calculate the second ordinate of each control point according to a preset control point ordinate calculation formula. And combining the determined second abscissa and the second ordinate to determine a second coordinate of each control point corresponding to the target vertex.
Optionally, an embodiment of the present invention further provides a specific processing procedure for determining a second abscissa and a second ordinate of each control point, as shown in fig. 3, which may include the following steps:
s301, determining a first distance between a target vertex and the control point corresponding to the target vertex based on a preset linear distance calculation formula.
In practice, the "first and second" in the embodiments of the present invention are used only for distinguishing different subjects. For example, the first control point and the second control point represent only two different control points corresponding to the target vertex.
In the embodiment of the present invention, the following formula may be adopted to calculate the first distance between the target vertex and the control point corresponding to the target vertex:
h is a first distance between the target vertex and each control point corresponding to the target vertex, and x1And y1The first coordinate of the control point for the target vertex, the coordinates of the x and y target vertices.
S302, based on a preset relative angle determination formula, determining a first relative angle between a target vertex and a first adjacent vertex of the target vertex, where the first adjacent vertex is a vertex which is adjacent to the target vertex and has the same direction as the control point corresponding to the target vertex.
In the embodiment of the present invention, the following formula may be adopted to calculate the first relative angle between the target vertex and the first adjacent vertex of the target vertex:
wherein a is a first relative angle between the target vertex and a first adjacent vertex of the target vertex, x and y are coordinates of the target vertex, and x 'and y' are coordinates of the first adjacent vertex adjacent to the target vertex.
And S303, inputting the first distance and the first relative angle into a control point abscissa calculation formula in a determination strategy to obtain a second abscissa of the control point corresponding to the target vertex.
In the embodiment of the present invention, the following formula may be adopted to calculate the second abscissa of the control point corresponding to the target vertex:
x′1=h×cos a
wherein, x'1Is a target vertexA second abscissa of the corresponding control point.
S304, inputting the first distance and the first relative angle into a control point ordinate calculation formula in the determination strategy to obtain a second ordinate of the control point corresponding to the target vertex.
In the embodiment of the present invention, the following formula may be adopted to calculate the second ordinate of the control point corresponding to the target vertex:
y′1=h×sin a
wherein, y'1And the second ordinate of the control point corresponding to the target vertex.
S204, adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file, so that the coordinates of each control point corresponding to the target vertex are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identification.
In an implementation, after the terminal device determines the second coordinates of each control point through step S203 described above, the terminal device may use the determined second coordinates as the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the corner vertex type. And the coordinates of each control point of the target vertex in the object configuration file corresponding to the target vertex are adjusted, so that the coordinates of each control point corresponding to the target vertex in the object configuration file corresponding to the target vertex are modified, and the vertex type of the vertex can be accurately adjusted from a smooth vertex or a straight vertex to a corner vertex.
The embodiment of the invention provides a method for adjusting the type of a graph vertex. When a type adjusting instruction aiming at a target vertex of a target graph, which is sent by terminal equipment, is detected, an object configuration file corresponding to the target graph is obtained; and adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so that the coordinates of each control point corresponding to the target vertex are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier. In the embodiment of the invention, the terminal equipment can automatically adjust the coordinates of each control point corresponding to the target vertex in the graph, so that the problem that the vertex type of the vertex cannot be accurately adjusted when a user manually adjusts the coordinates of each control point corresponding to the target vertex is avoided, and the accuracy of adjusting the vertex type of the graph vertex is improved.
Based on the same technical concept, corresponding to the embodiment of the method shown in fig. 2, an embodiment of the present invention further provides an apparatus for adjusting a vertex type of a graph, as shown in fig. 4, the apparatus includes:
an obtaining module 401, configured to obtain an object configuration file corresponding to a target graph when a type adjustment instruction for a target vertex of the target graph sent by a terminal device is detected; the object configuration file comprises type identification of a target vertex and coordinates of at least two control points corresponding to the target vertex; the type adjusting instruction is used for adjusting the vertex type of the target vertex into a vertex type corresponding to the corner vertex identification;
a modification module 402, configured to modify a vertex type of a target vertex in the object configuration file into a vertex type corresponding to the corner vertex identifier;
a determining module 403, configured to determine, for each control point, coordinates of each control point corresponding to a target vertex when the vertex type of the target vertex is adjusted to a vertex type corresponding to a corner vertex identifier according to a preset control point coordinate determination policy and the coordinates of the control point;
an adjusting module 404, configured to adjust coordinates of each control point corresponding to the target vertex in the object configuration file, so that the coordinates of each control point corresponding to the target graph are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier.
In the embodiment of the present invention, the coordinates of the control point include a first abscissa and a first ordinate;
a determination module, which may include:
the calculating unit is used for calculating a second abscissa of the control point according to a control point abscissa calculation formula and a first abscissa preset in the strategy, and calculating a second ordinate of the control point according to a control point ordinate calculation formula and a first ordinate in the strategy;
and the composition unit is used for composing the second abscissa and the second ordinate into the coordinate of the control point when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification.
In this embodiment of the present invention, the computing unit may include:
the first distance determining subunit is configured to determine, based on a preset linear distance calculation formula, a first distance between a target vertex and the control point corresponding to the target vertex;
the first relative angle determining subunit is used for determining a first relative angle between the target vertex and a first adjacent vertex of the target vertex based on a preset relative angle determining formula, wherein the first adjacent vertex is a vertex which is located in the same direction as the control point corresponding to the target vertex and is adjacent to the target vertex;
the second abscissa determining subunit is used for inputting the first distance and the first relative angle into an abscissa calculation formula of the control point in the determination strategy to obtain a second abscissa of the control point corresponding to the target vertex;
and the second ordinate determining subunit is used for inputting the first distance and the first relative angle into the control point ordinate calculation formula in the determination strategy to obtain a second ordinate of the control point corresponding to the target vertex.
In the embodiment of the present invention, the preset linear distance calculation formula is:
h is a first distance between the target vertex and each control point corresponding to the target vertex, and x1And y1First coordinates of control points which are target vertices, coordinates of x and y target vertices;
the preset relative angle determination formula is as follows:
wherein a is a first relative angle between the target vertex and a first adjacent vertex of the target vertex, x and y are coordinates of the target vertex, and x 'and y' are coordinates of the first adjacent vertex adjacent to the target vertex;
the control point abscissa calculation formula is:
x′1=h×cos a
wherein, x'1A second abscissa of the control point corresponding to the target vertex;
the control point ordinate calculation formula is as follows:
y′1=h×sin a
wherein, y'1And the second ordinate of the control point corresponding to the target vertex.
The embodiment of the invention provides a device for adjusting the graph vertex type. When a type adjusting instruction aiming at a target vertex of a target graph, which is sent by terminal equipment, is detected, an object configuration file corresponding to the target graph is obtained; and adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so that the coordinates of each control point corresponding to the target vertex are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier. In the embodiment of the invention, the terminal equipment can automatically adjust the coordinates of each control point corresponding to the target vertex in the graph, so that the problem that the vertex type of the vertex cannot be accurately adjusted when a user manually adjusts the coordinates of each control point corresponding to the target vertex is avoided, and the accuracy of adjusting the vertex type of the graph vertex is improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, where the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501, when executing the program stored in the memory 503, implements the following steps:
when a type adjusting instruction aiming at a target vertex of a target graph, which is sent by terminal equipment, is detected, an object configuration file corresponding to the target graph is obtained; the object configuration file comprises type identification of a target vertex and coordinates of at least two control points corresponding to the target vertex; the type adjusting instruction is used for adjusting the vertex type of the target vertex into a vertex type corresponding to the corner vertex identification;
modifying the vertex type of the target vertex in the object configuration file into a vertex type corresponding to the corner vertex identification;
aiming at each control point, determining a strategy and coordinates of the control point according to preset coordinates of the control point, and determining the coordinates of each control point corresponding to a target vertex when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification;
and adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so that the coordinates of each control point corresponding to the target vertex are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier.
In addition, other implementation manners of the method implemented by the processor 501 executing the program stored in the memory 503 are the same as those mentioned in the foregoing method embodiment, and are not described herein again.
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 also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
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, when executed by a processor, implements the steps of any of the above methods for adjusting a vertex type of a graph.
In another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method for adjusting any of the above-described vertex types of graphics.
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, as for the apparatus, the electronic device, and the computer-readable storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to the description, reference may be made to some portions of the description 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, improvement and the like made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims (9)
1. A method for adjusting vertex types of a graph, the method comprising:
when a type adjusting instruction aiming at a target vertex of a target graph, which is sent by terminal equipment, is detected, an object configuration file corresponding to the target graph is obtained; the object configuration file comprises type identification of the target vertex and coordinates of at least two control points corresponding to the target vertex; the type adjusting instruction is used for adjusting the vertex type of the target vertex into a vertex type corresponding to the corner vertex identification;
modifying the vertex type of the target vertex in the object configuration file into a vertex type corresponding to the corner vertex identification;
aiming at each control point, determining a strategy and coordinates of the control point according to preset coordinates of the control point, and determining the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification;
and adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so that the coordinates of each control point corresponding to the target graph are adjusted to be the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identification.
2. The method of claim 1, wherein the coordinates of the control point comprise a first abscissa and a first ordinate;
the step of determining, for each control point, coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is adjusted to the vertex type corresponding to the corner vertex identifier according to a preset control point coordinate determination policy and the control point coordinate includes:
calculating a second abscissa of the control point according to a control point abscissa calculation formula preset in the strategy and the first abscissa, and calculating a second ordinate of the control point according to the control point ordinate calculation formula in the strategy and the first ordinate;
and when the vertex type of the target vertex formed by the second abscissa and the second ordinate is adjusted to be the vertex type corresponding to the corner vertex identification, the coordinate of the control point is obtained.
3. The method according to claim 2, wherein the step of calculating a second abscissa of the control point according to the control point abscissa calculation formula preset in the strategy and the first abscissa, and calculating a second ordinate of the control point according to the control point ordinate calculation formula preset in the strategy and the first ordinate comprises:
determining a first distance between the target vertex and the control point corresponding to the target vertex based on a preset linear distance calculation formula;
determining a first relative angle between the target vertex and a first adjacent vertex of the target vertex based on a preset relative angle determination formula, wherein the first adjacent vertex is a vertex which is adjacent to the target vertex and has the same direction as the control point corresponding to the target vertex;
inputting the first distance and the first relative angle into a control point abscissa calculation formula in the determination strategy to obtain a second abscissa of the control point corresponding to the target vertex;
and inputting the first distance and the first relative angle into a control point ordinate calculation formula in the determination strategy to obtain a second ordinate of the control point corresponding to the target vertex.
4. The method of claim 3, wherein the predetermined linear distance is calculated by the formula:
h is a first distance between the target vertex and each control point corresponding to the target vertex, and x1And y1The first coordinate of the control point of the target vertex, and the coordinates of the target vertex in x and y;
the preset relative angle determination formula is as follows:
wherein a is a first relative angle between a target vertex and a first adjacent vertex of the target vertex, x and y are coordinates of the target vertex, and x 'and y' are coordinates of the first adjacent vertex adjacent to the target vertex;
the control point abscissa calculation formula is as follows:
x′1=h×cosa
wherein, x'1A second abscissa of a control point corresponding to the target vertex;
the control point vertical coordinate calculation formula is as follows:
y′1=h×sina
wherein, y'1And the second ordinate of the control point corresponding to the target vertex.
5. An apparatus for adjusting vertex type of a graph, the apparatus comprising:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring an object configuration file corresponding to a target graph when a type adjustment instruction aiming at a target vertex of the target graph, which is sent by terminal equipment, is detected; the object configuration file comprises type identification of the target vertex and coordinates of at least two control points corresponding to the target vertex; the type adjusting instruction is used for adjusting the vertex type of the target vertex into a vertex type corresponding to the corner vertex identification;
a modification module, configured to modify the vertex type of the target vertex in the object configuration file to a vertex type corresponding to the corner vertex identifier;
the determining module is used for determining a strategy and coordinates of the control point according to preset coordinates of the control point for each control point, and determining the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is adjusted to be the vertex type corresponding to the corner vertex identification;
and the adjusting module is used for adjusting the coordinates of each control point corresponding to the target vertex in the object configuration file so as to adjust the coordinates of each control point corresponding to the target vertex when the vertex type of the target vertex is the vertex type corresponding to the corner vertex identifier.
6. The apparatus of claim 5, wherein the coordinates of the control point comprise a first abscissa and a first ordinate;
the determining module includes:
the calculation unit is used for calculating a second abscissa of the control point according to a control point abscissa calculation formula preset in the strategy and the first abscissa, and calculating a second ordinate of the control point according to a control point ordinate calculation formula in the strategy and the first ordinate;
and the composition unit is used for adjusting the vertex type of the target vertex formed by the second abscissa and the second ordinate into the coordinate of the control point when the vertex type corresponding to the corner vertex identifier is adjusted.
7. The apparatus of claim 6,
the calculation unit includes:
a first distance determining subunit, configured to determine, based on a preset linear distance calculation formula, a first distance between the target vertex and the control point corresponding to the target vertex;
the first relative angle determining subunit is used for determining a first relative angle between the target vertex and a first adjacent vertex of the target vertex based on a preset relative angle determining formula, wherein the first adjacent vertex is a vertex which is adjacent to the target vertex and has the same direction as the control point corresponding to the target vertex;
the second abscissa determining subunit is configured to input the first distance and the first relative angle into the control point abscissa calculation formula in the determination policy, so as to obtain a second abscissa of the control point corresponding to the target vertex;
and the second ordinate determining subunit is configured to input the first distance and the first relative angle into the control point ordinate calculation formula in the determination policy, so as to obtain a second ordinate of the control point corresponding to the target vertex.
8. The apparatus of claim 7, wherein the predetermined linear distance is calculated by the following formula:
h is a first distance between the target vertex and each control point corresponding to the target vertex, and x1And y1The first coordinate of the control point of the target vertex, and the coordinates of the target vertex in x and y;
the preset relative angle determination formula is as follows:
wherein a is a first relative angle between a target vertex and a first adjacent vertex of the target vertex, x and y are coordinates of the target vertex, and x 'and y' are coordinates of the first adjacent vertex adjacent to the target vertex;
the control point abscissa calculation formula is as follows:
x′1=h×cosa
wherein, x'1Is the target roofA second abscissa of the corresponding control point;
the control point vertical coordinate calculation formula is as follows:
y′1=h×sina
wherein, y'1And the second ordinate of the control point corresponding to the target vertex.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 4 when executing a program stored in the memory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910410662.9A CN111951349B (en) | 2019-05-17 | 2019-05-17 | Method and device for adjusting graph vertex types and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910410662.9A CN111951349B (en) | 2019-05-17 | 2019-05-17 | Method and device for adjusting graph vertex types and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111951349A true CN111951349A (en) | 2020-11-17 |
CN111951349B CN111951349B (en) | 2024-03-22 |
Family
ID=73336817
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910410662.9A Active CN111951349B (en) | 2019-05-17 | 2019-05-17 | Method and device for adjusting graph vertex types and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111951349B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115880133A (en) * | 2023-01-31 | 2023-03-31 | 南京砺算科技有限公司 | Graphic processing unit and terminal equipment |
WO2024066949A1 (en) * | 2022-09-29 | 2024-04-04 | 华为技术有限公司 | Graphic drawing method and apparatus |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001331812A (en) * | 2000-05-18 | 2001-11-30 | Sony Corp | Device and method for generating graphic information, image processor, information processor and recording medium |
JP2001331807A (en) * | 2000-05-18 | 2001-11-30 | Sony Corp | Device and method for transforming graphic information, image processor, information processor and recording medium |
US20110148867A1 (en) * | 2009-12-22 | 2011-06-23 | Fujitsu Limited | Shape optimization technique |
JP2012169732A (en) * | 2011-02-10 | 2012-09-06 | Tokyo Metropolitan Industrial Technology Research Institute | Information processor, computer program and information processing method |
JP2013045295A (en) * | 2011-08-24 | 2013-03-04 | Casio Comput Co Ltd | Image processor, image processing method, and program |
CN104361619A (en) * | 2014-10-28 | 2015-02-18 | 长沙景嘉微电子股份有限公司 | Horizontal line filling based 2D (2-dimensional) graph IP (intellectual property) core implementation method |
CN104507047A (en) * | 2014-12-15 | 2015-04-08 | 福建星网锐捷网络有限公司 | Method and device for acquiring POI (point of interest) areas |
-
2019
- 2019-05-17 CN CN201910410662.9A patent/CN111951349B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001331812A (en) * | 2000-05-18 | 2001-11-30 | Sony Corp | Device and method for generating graphic information, image processor, information processor and recording medium |
JP2001331807A (en) * | 2000-05-18 | 2001-11-30 | Sony Corp | Device and method for transforming graphic information, image processor, information processor and recording medium |
US20110148867A1 (en) * | 2009-12-22 | 2011-06-23 | Fujitsu Limited | Shape optimization technique |
JP2012169732A (en) * | 2011-02-10 | 2012-09-06 | Tokyo Metropolitan Industrial Technology Research Institute | Information processor, computer program and information processing method |
JP2013045295A (en) * | 2011-08-24 | 2013-03-04 | Casio Comput Co Ltd | Image processor, image processing method, and program |
CN104361619A (en) * | 2014-10-28 | 2015-02-18 | 长沙景嘉微电子股份有限公司 | Horizontal line filling based 2D (2-dimensional) graph IP (intellectual property) core implementation method |
CN104507047A (en) * | 2014-12-15 | 2015-04-08 | 福建星网锐捷网络有限公司 | Method and device for acquiring POI (point of interest) areas |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2024066949A1 (en) * | 2022-09-29 | 2024-04-04 | 华为技术有限公司 | Graphic drawing method and apparatus |
CN115880133A (en) * | 2023-01-31 | 2023-03-31 | 南京砺算科技有限公司 | Graphic processing unit and terminal equipment |
Also Published As
Publication number | Publication date |
---|---|
CN111951349B (en) | 2024-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10373359B2 (en) | Method and device for erasing a writing path on an infrared electronic white board, and a system for writing on an infrared electronic white board | |
US9697423B1 (en) | Identifying the lines of a table | |
US10782861B2 (en) | Objects alignment and distribution layout | |
CN109697414B (en) | Text positioning method and device | |
WO2020140976A1 (en) | Image acquisition method, device, point-reading device, electronic device and storage medium | |
CN108961267B (en) | Picture processing method, picture processing device and terminal equipment | |
CN111290684B (en) | Image display method, image display device and terminal equipment | |
US10083218B1 (en) | Repairing tables | |
CN111951349A (en) | Method and device for adjusting graph vertex type and electronic equipment | |
CN109444905B (en) | Dynamic object detection method and device based on laser and terminal equipment | |
CN108932704B (en) | Picture processing method, picture processing device and terminal equipment | |
CN112770044A (en) | Method and device for taking self-timer image | |
CN112052647A (en) | Document editing method and device, electronic equipment and readable storage medium | |
US8694509B2 (en) | Method and apparatus for managing for handwritten memo data | |
CN110851029B (en) | Method, device, terminal and storage medium for interchanging application icons | |
CN112751799B (en) | Verification method and device based on picture verification code | |
CN114415876A (en) | Hand-drawn image processing method and device and electronic equipment | |
CN111696169A (en) | Method and device for generating equilateral polygon and electronic equipment | |
CN111767700B (en) | Graph adjustment method and device | |
CN111768464B (en) | Graph adjustment method and device | |
CN111199144B (en) | Document content altering method and device, electronic equipment and readable storage medium | |
US9652878B2 (en) | Electronic device and method for adjusting page | |
CN110189279B (en) | Model training method and device, electronic equipment and storage medium | |
CN116071755B (en) | Text positioning method, device and equipment in electronic seal and storage medium | |
CN109976601B (en) | Common screen display window segmentation method and system |
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 |