CN113506356B - Method and device for drawing area map, readable medium and electronic equipment - Google Patents

Method and device for drawing area map, readable medium and electronic equipment Download PDF

Info

Publication number
CN113506356B
CN113506356B CN202110844662.7A CN202110844662A CN113506356B CN 113506356 B CN113506356 B CN 113506356B CN 202110844662 A CN202110844662 A CN 202110844662A CN 113506356 B CN113506356 B CN 113506356B
Authority
CN
China
Prior art keywords
vertex
curve
sets
coordinates
vertex set
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
CN202110844662.7A
Other languages
Chinese (zh)
Other versions
CN113506356A (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.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision 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 Douyin Vision Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN202110844662.7A priority Critical patent/CN113506356B/en
Publication of CN113506356A publication Critical patent/CN113506356A/en
Application granted granted Critical
Publication of CN113506356B publication Critical patent/CN113506356B/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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)
  • Image Generation (AREA)

Abstract

The disclosure relates to a method and a device for drawing an area map, a readable medium and electronic equipment, and relates to the technical field of image processing, wherein the method comprises the following steps: determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve; the coordinates of target vertexes included in the two vertex sets on a first coordinate axis are the same, the target vertexes are a first vertex and a last vertex, union processing is carried out on the two vertex sets so that vertexes included in the two vertex sets after the union processing are in one-to-one correspondence, a plurality of triangles are determined according to the two vertex sets after the union processing, an area diagram is drawn on a display interface according to the triangles so as to display the area diagram, the area diagram is composed of the triangles, and a closed area formed by curves corresponding to the two vertex sets is formed. The method and the device can improve the drawing efficiency of the area diagram.

Description

Method and device for drawing area map, readable medium and electronic equipment
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to a method and apparatus for drawing an area map, a readable medium, and an electronic device.
Background
With the continuous development of information technologies such as the internet and big data, various fields such as industry, government affairs, management and the like can collect and count data information by means of a visual system. The visual system can intuitively display the data information in the form of an image, and is convenient for a user to analyze the data information. An area map is generally used in a visualization system and is used for reflecting the change trend of data, and the area map comprises an upper boundary and a lower boundary (or left and right boundaries), and a closed area enclosed between the two boundaries is the area map. Normally, triangulation is performed on a closed area surrounded by two boundaries, so that the drawing of an area chart is realized. However, the shape of the area map is often irregular, so that a large amount of operations are required to complete triangulation, and the drawing efficiency of the area map is reduced.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a method for drawing an area map, the method including:
determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve; the coordinates of target vertexes included in the two vertex sets on a first coordinate axis are the same, and the target vertexes are a first vertex and a last vertex;
performing union processing on the two vertex sets, so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence;
determining a plurality of triangles according to the two vertex sets processed by the union;
and drawing an area diagram on a display interface according to the triangles so as to display the area diagram, wherein the area diagram consists of the triangles and is a closed area consisting of curves corresponding to the two vertex sets.
In a second aspect, the present disclosure provides an apparatus for drawing an area map, the apparatus comprising:
the first determining module is used for determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve; the coordinates of target vertexes included in the two vertex sets on a first coordinate axis are the same, and the target vertexes are a first vertex and a last vertex;
The processing module is used for carrying out union processing on the two vertex sets so as to enable the vertices included in the two vertex sets after the union processing to be in one-to-one correspondence;
the second determining module is used for determining a plurality of triangles according to the two vertex sets processed by the union;
and the drawing module is used for drawing an area diagram on a display interface according to the triangles so as to display the area diagram, wherein the area diagram consists of the triangles and is a closed area consisting of curves corresponding to the two vertex sets.
In a third aspect, the present disclosure provides a computer readable medium having stored thereon a computer program which when executed by a processing device performs the steps of the method of the first aspect of the present disclosure.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method of the first aspect of the disclosure.
Through the technical scheme, the method and the device for processing the graph data determine two vertex sets respectively representing two curves according to the input graph data and a preset curve function, wherein the graph data comprises coordinates of a plurality of control points, each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged, and the coordinates of target vertexes included by the two vertex sets on a first coordinate axis are the same. And then, carrying out union processing on the two vertex sets so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence. And determining a plurality of triangles according to the two vertex sets processed by the union, and finally drawing an area diagram on a display interface according to the triangles so as to display the area diagram. The area diagram consists of a plurality of triangles, and is a closed area formed by curves corresponding to two vertex sets. According to the method and the device, the vertex sets corresponding to the two curves forming the area map are processed in a union mode, so that the area map can be rapidly divided into a plurality of triangles, and the drawing efficiency of the area map is improved.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
FIG. 1 is a flow chart illustrating a method of drawing an area map according to an exemplary embodiment;
FIG. 2 is an area diagram illustrating an exemplary embodiment;
FIG. 3 is a flowchart illustrating another method of drawing an area map, according to an exemplary embodiment;
FIG. 4 is a flowchart illustrating another method of drawing an area map, according to an exemplary embodiment;
FIG. 5 is another area diagram illustrating an exemplary embodiment;
FIG. 6 is a flowchart illustrating another method of drawing an area map, according to an exemplary embodiment;
FIG. 7 is another area diagram illustrating an exemplary embodiment;
FIG. 8 is a flowchart illustrating another method of drawing an area map, according to an exemplary embodiment;
FIG. 9 is a schematic diagram of a first sub-segment and a second sub-segment shown according to an example embodiment;
FIG. 10 is a flowchart illustrating another method of drawing an area map, according to an exemplary embodiment;
FIG. 11 is a schematic diagram of an image frame shown according to an exemplary embodiment;
fig. 12 is a block diagram of a drawing apparatus of an area map shown according to an exemplary embodiment;
fig. 13 is a block diagram of another drawing apparatus of an area map shown according to an exemplary embodiment;
fig. 14 is a block diagram of another drawing apparatus of an area map shown according to an exemplary embodiment;
fig. 15 is a block diagram of another drawing apparatus of an area map shown according to an exemplary embodiment;
fig. 16 is a block diagram of another drawing apparatus of an area map shown according to an exemplary embodiment;
fig. 17 is a block diagram of another drawing apparatus of an area map shown according to an exemplary embodiment;
fig. 18 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Fig. 1 is a flowchart illustrating a method of drawing an area map according to an exemplary embodiment, as shown in fig. 1, the method including the steps of:
step 101, determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve. The two vertex sets comprise the same coordinates of the target vertex on the first coordinate axis, and the target vertex is a first vertex and a last vertex.
For example, to draw an area map, chart data for drawing the area map may be input first. The graph data includes coordinates of a plurality of control points, which are used to limit the boundary of the area map, and can be understood as data for characterizing the trend of change. For example, to draw an area graph to reflect the trend of the number of registered users over time, the area graph includes two coordinate axes, one is a time axis and the other is a registered user number axis, and the chart data is the number of registered users corresponding to a plurality of sampling moments, where the coordinate axes include coordinates of a plurality of control points: (1,200), (2,270), …, (12,1590) respectively show that the number of registered users for 1 month is 200 ten thousand, the number of registered users for 2 months is 270 ten thousand, …, and the number of registered users for 12 months is 1590 ten thousand. After the chart data is acquired, a preset curve function needs to be determined, and the curve function is used for representing the shape of the boundary of the area chart and can be set according to specific requirements of a user, for example, a first-order bezier curve, a second-order bezier curve, a third-order bezier curve and the like, and can also be other types of curve functions, which are not particularly limited in the disclosure.
The coordinates of the control points included in the graph data may be used as parameters of the curve function, so that two vertex sets are determined according to the curve function, each vertex set includes coordinates of a plurality of vertices arranged in sequence, wherein the order of each vertex in the vertex set may be determined according to the sequential increase of the coordinates on the first coordinate axis. Each vertex set is used to characterize a curve, i.e., a boundary of the area map. That is, two vertex sets characterize two boundaries of the area map. It can be understood that the graph data includes coordinates of control points corresponding to two curves, the curve is fitted according to the coordinates of the control points corresponding to one curve, so that the curve includes the corresponding control points, and then a preset number of vertices are collected on the curve to obtain a vertex set corresponding to the curve. The vertex set may or may not include control points in the graph data, which is not specifically limited by the present disclosure. Specifically, the number of collected vertices may be determined according to the curvature of the curve at each location, for example, the larger the curvature, the larger the number of collected vertices, the smaller the curvature, and the smaller the number of collected vertices.
The coordinate system in which the area map is located includes two coordinate axes: and the first coordinate axis and the second coordinate axis are used for representing the coordinates of the first vertex (the last vertex) on the first coordinate axis in two vertex sets of two boundaries of the area diagram. A straight line parallel to the first coordinate axis has a plurality of intersection points with each boundary of the area map, and a straight line parallel to the second coordinate axis has only one intersection point with each boundary of the area map. Taking the X axis as the horizontal direction and the Y axis as the vertical direction as an example, if the area diagram comprises an upper boundary and a lower boundary, the X axis is the first coordinate axis, the coordinates of the starting points of the two boundaries on the X axis are the same, and the coordinates of the ending points of the two boundaries on the X axis are the same. If the area diagram comprises a left boundary and a right boundary, the Y axis is the first coordinate axis, the coordinates of the starting points of the two boundaries on the Y axis are the same, and the coordinates of the ending points of the two boundaries on the Y axis are the same.
And 102, performing union processing on the two vertex sets, so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence.
For example, after obtaining two vertex sets, it may be first determined whether the vertices included in the two vertex sets are in one-to-one correspondence, and if each vertex in one vertex set is able to find a single vertex in the other vertex set to be in one-to-one correspondence, that is, the vertex included in the two vertex sets is indicated to be in one-to-one correspondence. The two vertices correspond to each other, and it is understood that the coordinates of the two vertices on the first coordinate axis are equal (the coordinates of the two vertices on the second coordinate axis may or may not be equal). Since the coordinates of the first vertex (and the last vertex) in the two vertex sets are the same on the first coordinate axis, the first vertex (and the last vertex) in the two vertex sets respectively correspond.
If the two vertex sets include vertices that are in one-to-one correspondence, the two vertex sets may be directly used as vertex sets after union processing. If the vertices included in the two vertex sets are not in one-to-one correspondence, the two vertex sets can be subjected to union processing, so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence. Specifically, for each vertex in each vertex set, whether the vertex exists in the other vertex set or not can be judged sequentially, if not, one vertex is added in the other vertex set, the coordinates of the added vertex on the first coordinate axis are equal to those of the vertex on the first coordinate axis, and the added vertex also meets the curve corresponding to the other vertex set, namely, the added vertex is on the curve corresponding to the other vertex set. After the above steps are performed for each vertex in each vertex set, two vertex sets after union processing can be obtained. For example, the a vertex set includes 5 vertices: (0, 10), (1, 20), (2, 10), (3, 20), (4, 10), the B vertex set includes 3 vertices: (0, 0), (2, 0), (4, 0). Two vertices (1, 20) and (3, 20) in the a vertex set, and no corresponding vertex exists in the B vertex set, then (1, 0) and (3, 0) may be added in the B vertex set. Then the union-processed a-vertex set is: (0, 10), (1, 20), (2, 10), (3, 20), (4, 10), and collecting the processed B vertex sets as (0, 0), (1, 0), (2, 0), (3, 0), (4, 0).
And step 103, determining a plurality of triangles according to the two vertex sets processed by the union.
And 104, drawing an area diagram on the display interface according to the triangles so as to display the area diagram. The area diagram consists of a plurality of triangles, and is a closed area formed by curves corresponding to two vertex sets.
For example, after the union processing, a plurality of triangles may be generated according to the obtained two vertex sets after the union processing, which may be understood as dividing a closed area formed by two curves corresponding to the two vertex sets after the union processing into a plurality of triangles. Any two adjacent vertexes in a vertex set processed by a union and corresponding vertexes of one vertex in a vertex set processed by another union can be used as three vertexes of a triangle to determine the triangle. For example, the union-processed a-vertex set is: (0, 10), (1, 20), (2, 10), (3, 20), (4, 10), and the processed B vertex set is (0, 0), (1, 0), (2, 0), (3, 0), (4, 0), and 5 vertices. Then 8 triangles can be obtained from 10 vertices: triangle composed of (0, 0), (1, 0), (0, 10), (1, 20), (1, 0), (2, 0), (1, 20), (2, 10), (2, 0), and so on. Then, an area map may be drawn on the display interface of the terminal device according to the plurality of triangles, so that the area map is displayed on the display interface, as shown in fig. 2. For example, each triangle may be rendered in turn using WebGL, thereby exhibiting an area map composed of a plurality of triangles, and may be drawn using other drawing protocols, which are not particularly limited in this disclosure. Further, when the triangle is drawn, the properties of color, transparency and the like of the triangle can be controlled. Because the vertexes in the two vertex sets after the union processing are sequentially arranged and correspond to each other one by one, when the triangles are divided, a plurality of triangles can be directly obtained according to a preset rule without executing a large amount of operations, and the efficiency of dividing the triangles can be effectively improved, so that the drawing efficiency of the area graph is improved.
In summary, according to the disclosure, two vertex sets representing two curves respectively are determined according to input chart data and a preset curve function, wherein the chart data includes coordinates of a plurality of control points, each vertex set includes coordinates of a plurality of vertices arranged in sequence, and coordinates of target vertices included in the two vertex sets on a first coordinate axis are the same. And then, carrying out union processing on the two vertex sets so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence. And determining a plurality of triangles according to the two vertex sets processed by the union, and finally drawing an area diagram on a display interface according to the triangles so as to display the area diagram. The area diagram consists of a plurality of triangles, and is a closed area formed by curves corresponding to two vertex sets. According to the method and the device, the vertex sets corresponding to the two curves forming the area map are processed in a union mode, so that the area map can be rapidly divided into a plurality of triangles, and the drawing efficiency of the area map is improved.
Fig. 3 is a flowchart illustrating another drawing method of an area map according to an exemplary embodiment, and as shown in fig. 3, the graph data includes coordinates of a control point corresponding to a first curve and coordinates of a control point corresponding to a second curve. The implementation of step 101 may include:
In step 1011, the coordinates of the control points corresponding to the first curve are used as the control parameters of the first curve function corresponding to the first curve, so as to determine the first vertex set for representing the first curve according to the function value of the first curve function.
Step 1012, using the coordinates of the control points corresponding to the second curve as the control parameters of the second curve function corresponding to the second curve, so as to determine the second vertex set for characterizing the second curve according to the function value of the second curve function.
For example, the coordinates of the control points included in the graph data may be divided into two parts, one part being the coordinates of the control points corresponding to the first curve and the other part being the coordinates of the control points corresponding to the second curve. The first curve and the second curve are two boundaries constituting an area map. The coordinates of the control points corresponding to the first curve may be used as control parameters of a first curve function corresponding to the first curve, so as to generate the first curve, and then a plurality of vertices are collected from the first curve, so as to obtain a first vertex set for representing the first curve. To collect a vertex from the first curve, it may be understood that an collected value is selected on the first coordinate axis, then the collected value is substituted into the first curve function to obtain a function value of the first curve, then the coordinate of the vertex on the first coordinate axis is the collected value, and the coordinate on the second coordinate axis is the function value. Further, the number of vertices included in the first vertex set, i.e. the number of vertices collected from the first curve, may be determined from the curvature of the first curve at each location. For example, if the curvature of the first curve is zero in the range of n to m on the first coordinate axis, that is, the first curve is a straight line in the range of n to m, n and m at both ends of the straight line may be taken as the acquisition values, and two vertices may be acquired, that is, the straight line may be represented. If the curvature of the first curve is greater than zero in the range from n to m on the first coordinate axis, then a plurality of acquisition values can be selected between n and m, and a plurality of vertexes can be acquired to represent the section of curve. The larger the curvature, the greater the number of vertices needed to represent such a curve. Likewise, the coordinates of the control points corresponding to the second curve may be used as the control parameters of the second curve function corresponding to the second curve, so as to generate the second curve, and then a plurality of vertices are collected from the second curve, so as to determine the second vertex set for representing the second curve according to the function value of the second curve function. The first curve function and the second curve function may be, for example, a first-order bezier curve, a second-order bezier curve, a third-order bezier curve, and the like, which is not particularly limited in the present disclosure.
Fig. 4 is a flowchart illustrating another method for drawing an area map according to an exemplary embodiment, and as shown in fig. 4, step 101 may further include the steps of:
step 1013, determining whether an intersection point exists between the first curve and the second curve according to the first curve function and the second curve function.
If there is an intersection between the first curve and the second curve, the coordinates of the intersection are added to the first vertex set and the second vertex set, respectively, in step 1014.
In some specific application scenarios, two boundaries of the area map may intersect, as shown in fig. 5, where the intersection of the two boundaries should be: and the coordinates of a and b are respectively added into vertex sets corresponding to the two boundaries. Firstly, judging whether an intersection point exists between a first curve and a second curve by utilizing a first curve function and a second curve function. If there is no intersection between the first curve and the second curve, then step 102 may continue. If there are intersections (one, two or more) between the first curve and the second curve, the coordinates of the intersections may be calculated and added to the first vertex set and the second vertex set, respectively, that is, the coordinates of the intersections are included in both the first vertex set and the second vertex set. Specifically, the coordinates of the intersection point may be sequentially added to the first vertex set and the second vertex set according to the size of the coordinates of the intersection point on the first coordinate axis, that is, the first vertex set and the second vertex set to which the intersection point is added, and each vertex is still arranged according to the size of the coordinates on the first coordinate axis. In this way, the first vertex set and the second vertex set with the coordinates of the intersection point are added, so that the intersection of two boundaries of the area map can be represented, and a plurality of triangles can be accurately obtained correspondingly in step 103, so that the area map with the intersection of the two boundaries is drawn, and the applicable scene of the area map drawing is improved.
Fig. 6 is a flowchart illustrating another method of drawing an area map according to an exemplary embodiment, and as shown in fig. 6, the implementation of step 102 may include:
step 1021, for each vertex included in the third vertex set, determining whether a corresponding vertex exists in the fourth vertex set according to the coordinates of the vertex on the first coordinate axis.
Step 1022, if the vertex corresponding to the vertex does not exist in the fourth vertex set, adding an interpolation vertex corresponding to the vertex in the fourth vertex set, where the coordinate of the interpolation vertex corresponding to the vertex on the first coordinate axis is the same as the coordinate of the vertex on the first coordinate axis, and the interpolation vertex corresponding to the vertex is located on the curve corresponding to the fourth vertex set.
The third vertex set is any vertex set, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets.
For example, when performing the union processing on the two vertex sets, one of the two vertex sets may be first used as the third vertex set, and the other vertex set may be used as the fourth vertex set. Then, for each vertex included in the third vertex set, whether a corresponding vertex exists in the fourth vertex set can be searched according to the coordinate of the vertex on the first coordinate axis, and if the vertex which is the same as the coordinate of the vertex on the first coordinate axis exists in the fourth vertex set, the vertex is the vertex corresponding to the vertex.
If the fourth vertex set does not have the same vertex as the vertex on the first coordinate axis, then an interpolation vertex corresponding to the vertex can be added in the fourth vertex set, the coordinate of the interpolation vertex corresponding to the vertex on the first coordinate axis is the same as the coordinate of the vertex on the first coordinate axis, and the interpolation vertex corresponding to the vertex is located on a curve corresponding to the fourth vertex set. That is, the coordinates of the interpolated vertex corresponding to the vertex on the second coordinate axis may be determined according to the curve corresponding to the fourth vertex set. Specifically, in one implementation manner, the coordinates of the interpolation vertex corresponding to the vertex on the second coordinate axis may be brought into the curve function of the curve corresponding to the fourth vertex set, so that the function value of the curve function is used as the coordinates of the interpolation vertex corresponding to the vertex on the second coordinate axis. For example, one vertex in the third vertex set is (3, 10), the first coordinate axis is the X axis, the second coordinate axis is the Y axis, and the curve function of the curve corresponding to the fourth vertex set is: y=7x, then 3 can be taken into the curve function, and the coordinate of the interpolation vertex corresponding to the vertex on the second coordinate axis is 3*7 =21. That is, the interpolation vertex corresponding to the vertex is (3, 21). In another implementation, the fourth vertex set may be searched for the coordinates on the first coordinate axis, two vertices closest to the vertex, and then the coordinates of the interpolated vertex corresponding to the vertex on the second coordinate axis are determined according to the two closest vertices. For example, in the third vertex set, one vertex is (3, 10), the first coordinate axis is the X axis, the second coordinate axis is the Y axis, and in the fourth vertex set, the coordinates on the X axis are (2, 18) and (4,36) on the two vertices closest to the vertex, then a line segment can be determined according to (2, 18) and (4,36), and on the line segment, when the coordinates on the X axis are 3, the coordinates on the corresponding Y axis are 27, that is, the interpolated vertex corresponding to the vertex is (3, 27).
In one implementation, step 103 may be:
for each vertex included in the third vertex set, determining a triangle according to the vertex, the adjacent vertex of the vertex, and the corresponding vertex of the vertex, wherein the adjacent vertex of the vertex is the vertex adjacent to the vertex in the third vertex set, the corresponding vertex of the vertex is the vertex corresponding to the vertex in the fourth vertex set, and the triangle comprises an edge perpendicular to the first coordinate axis.
The third vertex set is any vertex set after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
For example, when determining a plurality of triangles, one of the two vertex sets after union processing may be first used as the third vertex set, and the other vertex set may be used as the fourth vertex set. For each vertex included in the third set of vertices, the neighboring vertex of the vertex, the corresponding vertex, and then a triangle may be determined from the three vertices. The adjacent vertex of the vertex is a vertex adjacent to the vertex in the third vertex set, for example, a vertex before the vertex in the third vertex set may be a vertex after the vertex. The corresponding vertex of the vertex is the vertex corresponding to the vertex in the fourth vertex set, namely the coordinate of the vertex corresponding to the vertex on the first coordinate axis is equal to the coordinate of the vertex on the first coordinate axis. Thus, a triangle defined by the vertex, the adjacent vertices to the vertex, and the corresponding vertex must include an edge perpendicular to the first coordinate axis, i.e., the connection between the vertex and the vertex to which the vertex corresponds. In this way, since the vertices are in one-to-one correspondence and are arranged in order of size in the two vertex sets after the union processing, a plurality of triangles can be rapidly divided. Taking two vertex sets after union processing as shown in fig. 7 as an example, a C vertex set after union processing is: (0, 5), (1, 15), (2, 5), (3, 10), (4, 20), and the processed D vertex set is (0, 0), (1, 0), (2, 0), (3, 0), (4, 0), and 5 vertices. For (0, 5) in the C vertex set after the union processing, the adjacent vertex of the vertex is (1, 15), and the corresponding vertex of the vertex is (0, 0), then (0, 5), (1, 15), (0, 0) may be formed into a triangle, and so on, so as to obtain the area diagram composed of a plurality of triangles as shown in fig. 7.
Fig. 8 is a flowchart illustrating another method of drawing an area map according to an exemplary embodiment, as shown in fig. 8, the method may further include, before step 103:
step 105, determining a plurality of first sub-line segments according to every two adjacent vertices included in the third vertex set, and determining a plurality of second sub-line segments according to every two adjacent vertices included in the fourth vertex set, where the first sub-line segments are in one-to-one correspondence with the second sub-line segments.
Step 106, if there are at least two continuous target first sub-segments with the same slope, and the slope of the second sub-segment corresponding to each target first sub-segment is the same as the slope of the target first sub-segment, deleting the merged vertex in the third vertex set, and deleting the vertex corresponding to the merged vertex in the fourth vertex set. The merged vertex is a vertex other than the first vertex and the last vertex among the plurality of vertices that make up the continuous at least two target first sub-segments.
The third vertex set is any vertex set after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
For example, in a specific application scenario, there may be an overlapping portion between two boundaries of the area map, and if the slopes of the overlapping portions are identical (i.e., the overlapping portions are straight lines), the overlapping portions may be described by using only two vertices at both ends of the overlapping portions. Thus, before determining the plurality of triangles, the two boundaries of the area map may be divided into a plurality of sub-line segments per two adjacent vertices. Any one of the two vertex sets after the union processing is taken as a third vertex set, the other vertex set is taken as a fourth vertex set, and a plurality of first sub-line segments, namely a plurality of first sub-line segments, form a curve corresponding to the third vertex set can be determined according to every two adjacent vertices included in the third vertex set. And determining a plurality of second sub-line segments according to every two adjacent vertexes included in the fourth vertex set, wherein the plurality of second sub-line segments form a curve corresponding to the fourth vertex set. Because the vertexes in the third vertex set are in one-to-one correspondence with the vertexes in the fourth vertex set, the first sub-line segments are in one-to-one correspondence with the second sub-line segments.
If there are at least two continuous target first sub-segments with the same slope, and the second sub-segment corresponding to each target first sub-segment has the same slope as the target first sub-segment, that is, the line segment formed by at least two continuous target first sub-segments and the line segment formed by at least two corresponding second sub-segments are parallel, then in the third vertex set, the merged vertex may be deleted, and in the fourth vertex set, the vertex corresponding to the merged vertex may be deleted. The merging vertex is a vertex except the first vertex and the last vertex in a plurality of vertexes forming at least two continuous target first sub-line segments. In this way, the number of vertices included in the third vertex set and the fourth vertex set can be reduced, and accordingly, the number of triangles determined in step 103 is also reduced, thereby further improving the drawing efficiency of the area map. As shown in fig. 9, the third vertex set includes: (1, 2), (2, 4), (3, 6), (4, 8), the fourth vertex set comprising: (1, 7), (2, 9), (3, 11), (4, 13), wherein the dashed lines represent the first and second sub-line segments. In the third vertex set, the slope of the sub-line segment composed of (1, 2) to (2, 4) is 2, the slope of the sub-line segment composed of (2, 4) to (3, 6) is 2, and the slope of the sub-line segment composed of (3, 6) to (4, 8) is 2. In the fourth vertex set, the slope of the sub-line segment composed of (1, 7) to (2, 9) is 2, the slope of the sub-line segment composed of (2, 9) to (3, 11) is 2, and the slope of the sub-line segment composed of (3, 11) to (4, 13) is 2. Then, (2, 4), (3, 6) in the third vertex set may be deleted, while, (2, 9), (3, 11) in the fourth vertex set may be deleted, thereby reducing the number of vertices included in the third vertex set and the fourth vertex set.
Fig. 10 is a flowchart illustrating another method of drawing an area map according to an exemplary embodiment, and as shown in fig. 10, the implementation of step 104 may include:
in step 1041, according to the display position specified by the current image frame to be displayed, a display triangle is determined in the plurality of triangles, and the coordinates of three vertices constituting the display triangle on the first coordinate axis are smaller than or equal to the coordinates of the display position on the first coordinate axis.
In step 1042, the image frame is drawn according to the display triangle, and the image frame is displayed on the display interface, wherein the image frame comprises a target area diagram composed of the display triangle.
For example, in a specific application scenario, the area map may be displayed by means of animation. The animation includes a plurality of image frames, each of which can specify a display position of the area map, the display position being used to indicate a position to which the area map is displayed in the image frame. As the time sequence of each image frame in the animation increases, the coordinates of the designated display position on the first coordinate axis also become larger, so that the area diagram is displayed in an animation manner. For example, the area map has a coordinate range of 1 to 100 on the first coordinate axis, the animation includes 100 image frames, the display position designated by the 1 st image frame is 1, the display position designated by the 2 nd image frame is 2, and so on, the display position designated by the 100 th image frame is 100. Taking the image frame as an example, the display position designated by the image frame is 20, the image frame is displayed in the area map, and the coordinate of the first coordinate axis is the portion before 20. Specifically, for the display position specified by the image frame to be currently displayed, the display triangle may be determined first in the plurality of triangles determined in step 103, and the remaining triangles may be determined as hidden triangles. The coordinates of three vertexes forming the display triangle on the first coordinate axis are smaller than or equal to the coordinates of the display position on the first coordinate axis, that is, the coordinates of each position in the display triangle on the first coordinate axis are smaller than or equal to the coordinates of the display position on the first coordinate axis.
Thereafter, an image frame may be drawn according to the display triangle and displayed on the display interface, the image frame including a target area map, that is, the target area map may be a part or all of the area map, the target area map being a closed area composed of the display triangle. Taking the area diagram shown in fig. 7 as an example by way of animation, two adjacent image frames may be shown as (a) and (b) in fig. 11, where (a) in fig. 11 designates a display position of 2, and (b) in fig. 11 designates a display position of 3. Specifically, when drawing an image frame, only the display triangle may be drawn in the image frame, or all the triangles may be drawn in the image frame, and the transparency of the display triangle is set to a value smaller than 1, and the transparency of the hidden triangle is set to 1, that is, the hidden triangle is not displayed in the image frame. Therefore, the animation of the area map can be quickly realized directly according to the triangle obtained in the step 103 and the display position appointed by each image frame, and the calculation of the vertex and the triangulation are not needed to be carried out again for each image frame, so that the calculation amount is greatly reduced, and the display efficiency of the animation of the area map is improved.
In summary, according to the disclosure, two vertex sets representing two curves respectively are determined according to input chart data and a preset curve function, wherein the chart data includes coordinates of a plurality of control points, each vertex set includes coordinates of a plurality of vertices arranged in sequence, and coordinates of target vertices included in the two vertex sets on a first coordinate axis are the same. And then, carrying out union processing on the two vertex sets so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence. And determining a plurality of triangles according to the two vertex sets processed by the union, and finally drawing an area diagram on a display interface according to the triangles so as to display the area diagram. The area diagram consists of a plurality of triangles, and is a closed area formed by curves corresponding to two vertex sets. According to the method and the device, the vertex sets corresponding to the two curves forming the area map are processed in a union mode, so that the area map can be rapidly divided into a plurality of triangles, and the drawing efficiency of the area map is improved.
Fig. 12 is a block diagram of an apparatus for drawing an area map according to an exemplary embodiment, and as shown in fig. 12, the apparatus 200 includes:
the first determining module 201 is configured to determine two vertex sets according to input graph data and a preset curve function, where the graph data includes coordinates of a plurality of control points, and each vertex set includes coordinates of a plurality of vertices arranged in sequence, and is used to characterize a curve. The two vertex sets comprise the same coordinates of the target vertex on the first coordinate axis, and the target vertex is a first vertex and a last vertex.
And the processing module 202 is configured to perform union processing on the two vertex sets, so that vertices included in the two vertex sets after the union processing are in one-to-one correspondence.
A second determining module 203, configured to determine a plurality of triangles according to the two vertex sets after the union processing.
The drawing module 204 is configured to draw an area map on the display interface according to the plurality of triangles, so as to display the area map, where the area map is composed of the plurality of triangles and is a closed area composed of curves corresponding to the two vertex sets.
Fig. 13 is a block diagram of another drawing apparatus of an area map according to an exemplary embodiment, and as shown in fig. 13, the map data includes coordinates of control points corresponding to a first curve and coordinates of control points corresponding to a second curve. The first determination module 201 may include:
the first determining submodule 2011 is configured to use coordinates of a control point corresponding to the first curve as a control parameter of a first curve function corresponding to the first curve, so as to determine a first vertex set used for representing the first curve according to a function value of the first curve function.
A second determining submodule 2012 is configured to use coordinates of a control point corresponding to the second curve as a control parameter of a second curve function corresponding to the second curve, so as to determine a second vertex set for characterizing the second curve according to a function value of the second curve function.
Fig. 14 is a block diagram of another drawing apparatus of an area map, which is shown in an exemplary embodiment, as shown in fig. 14, the first determining module 201 may further include:
a first judging submodule 2013, configured to judge whether an intersection point exists between the first curve and the second curve according to the first curve function and the second curve function.
The first adding submodule 2014 is configured to add coordinates of an intersection point to the first vertex set and the second vertex set if the intersection point exists between the first curve and the second curve.
Fig. 15 is a block diagram of another area diagram drawing apparatus shown according to an exemplary embodiment, and as shown in fig. 15, the processing module 202 may include:
the second judging sub-module 2021 is configured to judge, for each vertex included in the third vertex set, whether a corresponding vertex exists in the fourth vertex set according to coordinates of the vertex on the first coordinate axis.
The second adding sub-module 2022 is configured to add, if the vertex corresponding to the vertex does not exist in the fourth vertex set, an interpolation vertex corresponding to the vertex in the fourth vertex set, where a coordinate of the interpolation vertex corresponding to the vertex on the first coordinate axis is the same as a coordinate of the vertex on the first coordinate axis, and the interpolation vertex corresponding to the vertex is located on a curve corresponding to the fourth vertex set.
The third vertex set is any vertex set, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets.
In one application scenario, the second determining module 203 may be configured to:
for each vertex included in the third vertex set, determining a triangle according to the vertex, the adjacent vertex of the vertex, and the corresponding vertex of the vertex, wherein the adjacent vertex of the vertex is the vertex adjacent to the vertex in the third vertex set, the corresponding vertex of the vertex is the vertex corresponding to the vertex in the fourth vertex set, and the triangle comprises an edge perpendicular to the first coordinate axis.
The third vertex set is any vertex set after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
Fig. 16 is a block diagram of another apparatus for drawing an area map, according to an exemplary embodiment, as shown in fig. 16, the apparatus 200 may further include:
the third determining module 205 is configured to determine, before determining the plurality of triangles according to the two vertex sets processed by the union, a plurality of first sub-line segments according to every two adjacent vertices included in the third vertex set, and determine a plurality of second sub-line segments according to every two adjacent vertices included in the fourth vertex set, where the first sub-line segments are in one-to-one correspondence with the second sub-line segments.
And the deleting module 206 is configured to delete the merged vertex in the third vertex set and delete the vertex corresponding to the merged vertex in the fourth vertex set if there are at least two continuous target first sub-segments with the same slope and the second sub-segment corresponding to each target first sub-segment has the same slope as the target first sub-segment. The merged vertex is a vertex other than the first vertex and the last vertex among the plurality of vertices that make up the continuous at least two target first sub-segments.
The third vertex set is any vertex set after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
Fig. 17 is a block diagram of another drawing apparatus of an area map, shown in fig. 17, according to an exemplary embodiment, the drawing module 204 may include:
and a third determining submodule 2041, configured to determine a display triangle among the triangles according to the display position specified by the image frame to be displayed currently, where coordinates of three vertices constituting the display triangle on the first coordinate axis are smaller than or equal to coordinates of the display position on the first coordinate axis.
And a rendering submodule 2042 for rendering an image frame according to the display triangle and displaying the image frame on the display interface, the image frame including a target area map composed of the display triangle.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
In summary, according to the disclosure, two vertex sets representing two curves respectively are determined according to input chart data and a preset curve function, wherein the chart data includes coordinates of a plurality of control points, each vertex set includes coordinates of a plurality of vertices arranged in sequence, and coordinates of target vertices included in the two vertex sets on a first coordinate axis are the same. And then, carrying out union processing on the two vertex sets so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence. And determining a plurality of triangles according to the two vertex sets processed by the union, and finally drawing an area diagram on a display interface according to the triangles so as to display the area diagram. The area diagram consists of a plurality of triangles, and is a closed area formed by curves corresponding to two vertex sets. According to the method and the device, the vertex sets corresponding to the two curves forming the area map are processed in a union mode, so that the area map can be rapidly divided into a plurality of triangles, and the drawing efficiency of the area map is improved.
Referring now to fig. 18, a schematic diagram of a configuration of an electronic device (e.g., an execution body, i.e., a terminal device, in the embodiments shown in the present disclosure) 300 suitable for implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 18 is merely an example, and should not impose any limitation on the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 18, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
In general, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 308 including, for example, magnetic tape, hard disk, etc.; and communication means 309. The communication means 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. While fig. 18 illustrates an electronic device 300 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via a communication device 309, or installed from a storage device 308, or installed from a ROM 302. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing means 301.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the terminal devices, servers, may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve; the coordinates of target vertexes included in the two vertex sets on a first coordinate axis are the same, and the target vertexes are a first vertex and a last vertex; performing union processing on the two vertex sets, so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence; determining a plurality of triangles according to the two vertex sets processed by the union; and drawing an area diagram on a display interface according to the triangles, wherein the area diagram consists of the triangles and is a closed area consisting of curves corresponding to the vertex sets.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented in software or hardware. The name of a module is not limited to the module itself in some cases, and for example, the first determining module may be described as "a module that determines two vertex sets".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, example 1 provides a method for drawing an area map, including: determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve; the coordinates of target vertexes included in the two vertex sets on a first coordinate axis are the same, and the target vertexes are a first vertex and a last vertex; performing union processing on the two vertex sets, so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence; determining a plurality of triangles according to the two vertex sets processed by the union; and drawing an area diagram on a display interface according to the triangles so as to display the area diagram, wherein the area diagram consists of the triangles and is a closed area consisting of curves corresponding to the two vertex sets.
According to one or more embodiments of the present disclosure, example 2 provides the method of example 1, the graph data including coordinates of the control point corresponding to a first curve and coordinates of the control point corresponding to a second curve; the determining two vertex sets according to the input chart data and a preset curve function comprises the following steps: the coordinates of the control points corresponding to the first curve are used as control parameters of a first curve function corresponding to the first curve, so that a first vertex set used for representing the first curve is determined according to the function value of the first curve function; and taking the coordinates of the control points corresponding to the second curve as control parameters of a second curve function corresponding to the second curve, so as to determine a second vertex set used for representing the second curve according to the function value of the second curve function.
Example 3 provides the method of example 2, according to one or more embodiments of the present disclosure, the determining two vertex sets according to the input chart data and the preset curve function, further comprising: judging whether an intersection point exists between the first curve and the second curve according to the first curve function and the second curve function; if the intersection point exists between the first curve and the second curve, the coordinates of the intersection point are respectively added to the first vertex set and the second vertex set.
In accordance with one or more embodiments of the present disclosure, example 4 provides the method of example 1, the union processing of the two vertex sets comprising: judging whether corresponding vertexes exist in the fourth vertex set or not according to the coordinates of the vertexes on the first coordinate axis aiming at each vertex included in the third vertex set; if the vertex corresponding to the vertex does not exist in the fourth vertex set, adding an interpolation vertex corresponding to the vertex in the fourth vertex set, wherein the coordinate of the interpolation vertex corresponding to the vertex on the first coordinate axis is the same as the coordinate of the vertex on the first coordinate axis, and the interpolation vertex corresponding to the vertex is positioned on a curve corresponding to the fourth vertex set; the third vertex set is any one of the vertex sets, and the fourth vertex set is a vertex set other than the third vertex set of the two vertex sets.
Example 5 provides the method of example 1, according to one or more embodiments of the present disclosure, the determining a plurality of triangles from the two vertex sets processed by the union, comprising: for each vertex included in the third vertex set, determining one triangle according to the vertex, the adjacent vertex of the vertex, and the corresponding vertex of the vertex, wherein the adjacent vertex of the vertex is the vertex adjacent to the vertex in the third vertex set, the corresponding vertex of the vertex is the vertex corresponding to the vertex in the fourth vertex set, and the triangle comprises an edge perpendicular to the first coordinate axis; the third vertex set is any one of the vertex sets after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
In accordance with one or more embodiments of the present disclosure, example 6 provides the method of example 1, before the determining a plurality of triangles from the two vertex sets processed according to the union, the method further comprising: determining a plurality of first sub-line segments according to every two adjacent vertexes included in a third vertex set, and determining a plurality of second sub-line segments according to every two adjacent vertexes included in a fourth vertex set, wherein the first sub-line segments are in one-to-one correspondence with the second sub-line segments; if there are at least two continuous target first sub-line segments with the same slope, and the slope of the second sub-line segment corresponding to each target first sub-line segment is the same as the slope of the target first sub-line segment, deleting a merging vertex in the third vertex set, and deleting a vertex corresponding to the merging vertex in the fourth vertex set; the merging vertexes are vertexes except for a first vertex and a last vertex in a plurality of vertexes forming at least two continuous target first sub-line segments; the third vertex set is any one of the vertex sets after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
According to one or more embodiments of the present disclosure, example 7 provides the method of examples 1 to 6, the drawing an area map on a display interface according to a plurality of the triangles, including: determining a display triangle in a plurality of triangles according to a display position designated by a current image frame to be displayed, wherein the coordinates of three vertexes forming the display triangle on a first coordinate axis are smaller than or equal to the coordinates of the display position on the first coordinate axis; and drawing the image frame according to the display triangle, and displaying the image frame on the display interface, wherein the image frame comprises a target area diagram, and the target area diagram consists of the display triangle.
According to one or more embodiments of the present disclosure, example 8 provides a drawing apparatus of an area map, including: the first determining module is used for determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve; the coordinates of target vertexes included in the two vertex sets on a first coordinate axis are the same, and the target vertexes are a first vertex and a last vertex; the processing module is used for carrying out union processing on the two vertex sets so as to enable the vertices included in the two vertex sets after the union processing to be in one-to-one correspondence; the second determining module is used for determining a plurality of triangles according to the two vertex sets processed by the union; and the drawing module is used for drawing an area diagram on a display interface according to the triangles so as to display the area diagram, wherein the area diagram consists of the triangles and is a closed area consisting of curves corresponding to the two vertex sets.
According to one or more embodiments of the present disclosure, example 9 provides a computer-readable medium having stored thereon a computer program which, when executed by a processing device, implements the steps of the methods described in examples 1 to 7.
In accordance with one or more embodiments of the present disclosure, example 10 provides an electronic device, comprising: a storage device having a computer program stored thereon; processing means for executing the computer program in the storage means to realize the steps of the method described in examples 1 to 7.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims. The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.

Claims (8)

1. A method for drawing an area map, the method comprising:
determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve; the coordinates of target vertexes included in the two vertex sets on a first coordinate axis are the same, and the target vertexes are a first vertex and a last vertex;
performing union processing on the two vertex sets, so that the vertices included in the two vertex sets after the union processing are in one-to-one correspondence;
Determining a plurality of triangles according to the two vertex sets processed by the union;
drawing an area diagram on a display interface according to a plurality of triangles so as to display the area diagram, wherein the area diagram consists of the triangles and is a closed area formed by curves corresponding to two vertex sets;
the union processing of the two vertex sets comprises:
judging whether corresponding vertexes exist in the fourth vertex set or not according to the coordinates of the vertexes on the first coordinate axis aiming at each vertex included in the third vertex set;
if the vertex corresponding to the vertex does not exist in the fourth vertex set, adding an interpolation vertex corresponding to the vertex in the fourth vertex set, wherein the coordinate of the interpolation vertex corresponding to the vertex on the first coordinate axis is the same as the coordinate of the vertex on the first coordinate axis, and the interpolation vertex corresponding to the vertex is positioned on a curve corresponding to the fourth vertex set;
the third vertex set is any one of the vertex sets, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets;
before the determining of the plurality of triangles from the two vertex sets processed by the union, the method further comprises:
Determining a plurality of first sub-line segments according to every two adjacent vertexes included in a third vertex set, and determining a plurality of second sub-line segments according to every two adjacent vertexes included in a fourth vertex set, wherein the first sub-line segments are in one-to-one correspondence with the second sub-line segments;
if there are at least two continuous target first sub-line segments with the same slope, and the slope of the second sub-line segment corresponding to each target first sub-line segment is the same as the slope of the target first sub-line segment, deleting a merging vertex in the third vertex set, and deleting a vertex corresponding to the merging vertex in the fourth vertex set; the merging vertexes are vertexes except for a first vertex and a last vertex in a plurality of vertexes forming at least two continuous target first sub-line segments;
the third vertex set is any one of the vertex sets after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
2. The method of claim 1, wherein the chart data includes coordinates of the control point corresponding to a first curve and coordinates of the control point corresponding to a second curve; the determining two vertex sets according to the input chart data and a preset curve function comprises the following steps:
The coordinates of the control points corresponding to the first curve are used as control parameters of a first curve function corresponding to the first curve, so that a first vertex set used for representing the first curve is determined according to the function value of the first curve function;
and taking the coordinates of the control points corresponding to the second curve as control parameters of a second curve function corresponding to the second curve, so as to determine a second vertex set used for representing the second curve according to the function value of the second curve function.
3. The method of claim 2, wherein determining two vertex sets from the input graph data and a preset curve function further comprises:
judging whether an intersection point exists between the first curve and the second curve according to the first curve function and the second curve function;
if the intersection point exists between the first curve and the second curve, the coordinates of the intersection point are respectively added to the first vertex set and the second vertex set.
4. The method of claim 1, wherein the determining a plurality of triangles from the two vertex sets processed by the union comprises:
For each vertex included in the third vertex set, determining one triangle according to the vertex, the adjacent vertex of the vertex, and the corresponding vertex of the vertex, wherein the adjacent vertex of the vertex is the vertex adjacent to the vertex in the third vertex set, the corresponding vertex of the vertex is the vertex corresponding to the vertex in the fourth vertex set, and the triangle comprises an edge perpendicular to the first coordinate axis;
the third vertex set is any one of the vertex sets after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
5. The method of any of claims 1-4, wherein the drawing an area map on a display interface from a plurality of the triangles comprises:
determining a display triangle in a plurality of triangles according to a display position designated by a current image frame to be displayed, wherein the coordinates of three vertexes forming the display triangle on a first coordinate axis are smaller than or equal to the coordinates of the display position on the first coordinate axis;
and drawing the image frame according to the display triangle, and displaying the image frame on the display interface, wherein the image frame comprises a target area diagram, and the target area diagram consists of the display triangle.
6. An apparatus for drawing an area map, the apparatus comprising:
the first determining module is used for determining two vertex sets according to input chart data and a preset curve function, wherein the chart data comprises coordinates of a plurality of control points, and each vertex set comprises coordinates of a plurality of vertexes which are sequentially arranged and is used for representing a curve; the coordinates of target vertexes included in the two vertex sets on a first coordinate axis are the same, and the target vertexes are a first vertex and a last vertex;
the processing module is used for carrying out union processing on the two vertex sets so as to enable the vertices included in the two vertex sets after the union processing to be in one-to-one correspondence;
the second determining module is used for determining a plurality of triangles according to the two vertex sets processed by the union;
the drawing module is used for drawing an area diagram on a display interface according to the triangles so as to display the area diagram, wherein the area diagram consists of the triangles and is a closed area formed by curves corresponding to the two vertex sets;
the processing module is configured to determine, for each vertex included in the third vertex set, whether a corresponding vertex exists in the fourth vertex set according to coordinates of the vertex on the first coordinate axis; if the vertex corresponding to the vertex does not exist in the fourth vertex set, adding an interpolation vertex corresponding to the vertex in the fourth vertex set, wherein the coordinate of the interpolation vertex corresponding to the vertex on the first coordinate axis is the same as the coordinate of the vertex on the first coordinate axis, and the interpolation vertex corresponding to the vertex is positioned on a curve corresponding to the fourth vertex set; the third vertex set is any one of the vertex sets, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets;
The apparatus further comprises:
the third determining module is used for determining a plurality of first sub-line segments according to every two adjacent vertexes included in the third vertex set before determining a plurality of triangles according to the two vertex sets processed by the union, and determining a plurality of second sub-line segments according to every two adjacent vertexes included in the fourth vertex set, wherein the first sub-line segments are in one-to-one correspondence with the second sub-line segments;
the deleting module is used for deleting the combined vertex in the third vertex set and deleting the vertex corresponding to the combined vertex in the fourth vertex set if the slopes of at least two continuous target first sub-line segments are the same and the slopes of the second sub-line segments corresponding to each target first sub-line segment are the same as the slopes of the target first sub-line segments; the merging vertexes are vertexes except for a first vertex and a last vertex in a plurality of vertexes forming at least two continuous target first sub-line segments;
the third vertex set is any vertex set after union processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union processing.
7. A computer readable medium on which a computer program is stored, characterized in that the program, when being executed by a processing device, carries out the steps of the method according to any one of claims 1-5.
8. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method according to any one of claims 1-5.
CN202110844662.7A 2021-07-26 2021-07-26 Method and device for drawing area map, readable medium and electronic equipment Active CN113506356B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110844662.7A CN113506356B (en) 2021-07-26 2021-07-26 Method and device for drawing area map, readable medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110844662.7A CN113506356B (en) 2021-07-26 2021-07-26 Method and device for drawing area map, readable medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN113506356A CN113506356A (en) 2021-10-15
CN113506356B true CN113506356B (en) 2023-09-01

Family

ID=78014630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110844662.7A Active CN113506356B (en) 2021-07-26 2021-07-26 Method and device for drawing area map, readable medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113506356B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117422793B (en) * 2023-12-19 2024-03-15 弈芯科技(杭州)有限公司 Curve graph processing method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7928984B1 (en) * 2007-08-31 2011-04-19 Adobe Systems Incorporated Efficient data packaging for rendering bézier curves on a GPU
CN107085602A (en) * 2017-03-31 2017-08-22 北京知聚科技有限公司 The generation method and computer-readable storage medium of statistical chart
CN107480274A (en) * 2017-08-21 2017-12-15 北京小度信息科技有限公司 Zone boundary information processing method and device
CN109544661A (en) * 2018-10-23 2019-03-29 金蝶软件(中国)有限公司 Area drawing drawing method, device, computer equipment and storage medium
CN109840929A (en) * 2017-11-24 2019-06-04 北京神州泰岳软件股份有限公司 A kind of method and apparatus for realizing that Dynamic Baseline figure is drawn based on Echarts
CN111399729A (en) * 2020-03-10 2020-07-10 北京字节跳动网络技术有限公司 Image drawing method and device, readable medium and electronic equipment
CN111681300A (en) * 2020-06-02 2020-09-18 西安电子科技大学 Method for obtaining target area composed of outline sketch lines
CN111784796A (en) * 2020-06-22 2020-10-16 上海米哈游天命科技有限公司 Terrain grid generation method, device, equipment and medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10692298B2 (en) * 2018-01-31 2020-06-23 International Business Machines Corporation Adaptive labeling of network graphs

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7928984B1 (en) * 2007-08-31 2011-04-19 Adobe Systems Incorporated Efficient data packaging for rendering bézier curves on a GPU
CN107085602A (en) * 2017-03-31 2017-08-22 北京知聚科技有限公司 The generation method and computer-readable storage medium of statistical chart
CN107480274A (en) * 2017-08-21 2017-12-15 北京小度信息科技有限公司 Zone boundary information processing method and device
CN109840929A (en) * 2017-11-24 2019-06-04 北京神州泰岳软件股份有限公司 A kind of method and apparatus for realizing that Dynamic Baseline figure is drawn based on Echarts
CN109544661A (en) * 2018-10-23 2019-03-29 金蝶软件(中国)有限公司 Area drawing drawing method, device, computer equipment and storage medium
CN111399729A (en) * 2020-03-10 2020-07-10 北京字节跳动网络技术有限公司 Image drawing method and device, readable medium and electronic equipment
CN111681300A (en) * 2020-06-02 2020-09-18 西安电子科技大学 Method for obtaining target area composed of outline sketch lines
CN111784796A (en) * 2020-06-22 2020-10-16 上海米哈游天命科技有限公司 Terrain grid generation method, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
线上电视柜视觉形态现状研究;蒋心怡等;《家具与室内装饰》(第5期);全文 *

Also Published As

Publication number Publication date
CN113506356A (en) 2021-10-15

Similar Documents

Publication Publication Date Title
CN112184738B (en) Image segmentation method, device, equipment and storage medium
CN111291244B (en) House source information display method, device, terminal and storage medium
CN112150490B (en) Image detection method, device, electronic equipment and computer readable medium
CN110795196A (en) Window display method, device, terminal and storage medium
CN113506356B (en) Method and device for drawing area map, readable medium and electronic equipment
CN113205601B (en) Roaming path generation method and device, storage medium and electronic equipment
CN112150491B (en) Image detection method, device, electronic equipment and computer readable medium
CN112257598B (en) Method and device for identifying quadrangle in image, readable medium and electronic equipment
CN111273884A (en) Image display method and device and electronic equipment
CN113741750B (en) Cursor position updating method and device and electronic equipment
CN114419299A (en) Virtual object generation method, device, equipment and storage medium
CN110796144B (en) License plate detection method, device, equipment and storage medium
CN111563214B (en) Reference line processing method and device
CN110825480A (en) Picture display method and device, electronic equipment and computer readable storage medium
CN112395826B (en) Text special effect processing method and device
CN111753230B (en) Reference line processing method and device
CN111783390B (en) Dimension label adjusting method and device and electronic equipment
CN115908143B (en) Vehicle cross-layer parking method, device, electronic equipment and computer readable medium
CN115033324B (en) Method and device for displaying diagrams in three-dimensional space page, electronic equipment and medium
CN116894933B (en) Three-dimensional model comparison method, device, equipment and storage medium
CN114327188B (en) Form layout method, form layout device, electronic equipment and computer readable medium
CN111311665B (en) Video processing method and device and electronic equipment
CN112822418B (en) Video processing method and device, storage medium and electronic equipment
CN111026983B (en) Method, device, medium and electronic equipment for realizing hyperlink
CN114816606B (en) Self-adaptive adjustment method and device of window graduated scale, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant