CN113506356A - Drawing method and device of area map, readable medium and electronic equipment - Google Patents

Drawing method and device of area map, readable medium and electronic equipment Download PDF

Info

Publication number
CN113506356A
CN113506356A CN202110844662.7A CN202110844662A CN113506356A CN 113506356 A CN113506356 A CN 113506356A CN 202110844662 A CN202110844662 A CN 202110844662A CN 113506356 A CN113506356 A CN 113506356A
Authority
CN
China
Prior art keywords
vertex
curve
sets
coordinates
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110844662.7A
Other languages
Chinese (zh)
Other versions
CN113506356B (en
Inventor
周欣宇
陈屹
马浩
杨文海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology 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

Images

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 graph data and a preset curve function, wherein the graph 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 method comprises the steps that target vertexes included by two vertex sets are identical in coordinate on a first coordinate axis, the target vertexes are a first vertex and a last vertex, the two vertex sets are subjected to union processing, so that the 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 graph is drawn on a display interface according to the triangles to display the area graph, the area graph is composed of the triangles, and is a closed area formed by curves corresponding to the two vertex sets. The area map drawing method and the area map drawing device can improve drawing efficiency of the area map.

Description

Drawing method and device of 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 an 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, data information is collected and counted by a visualization system in various fields such as industry, government affairs and management. The visualization system can visually display the data information in the form of images, so that a user can conveniently analyze the data information. An area map is generally used in a visualization system to reflect a change trend of data, the area map includes an upper boundary and a lower boundary (or a left boundary and a right boundary), and a closed region enclosed between the two boundaries is the area map. Usually, triangulation is performed on a closed region enclosed by two boundaries, so as to draw an area map. However, the shape of the area map is often irregular, which results in 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 graph data and a preset curve function, wherein the graph 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 set processing on the two vertex sets so that vertexes included in the two vertex sets after union set processing are in one-to-one correspondence;
determining a plurality of triangles according to the two vertex sets after union processing;
drawing an area graph on a display interface according to the triangles to display the area graph, wherein the area graph is composed of the triangles and is a closed area composed of curves corresponding to the two vertex sets.
In a second aspect, the present disclosure provides an apparatus for mapping an area map, the apparatus comprising:
the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining two vertex sets according to input graph data and a preset curve function, the graph data comprises coordinates of a plurality of control points, and each vertex set comprises the 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 set processing on the two vertex sets so as to enable the vertexes in the two vertex sets after union set 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 after union processing;
and the drawing module is used for drawing an area graph on a display interface according to the triangles so as to display the area graph, and the area graph is composed of the triangles and is a closed area composed 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 apparatus, 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 the computer program in the storage means to implement the steps of the method of the first aspect of the present disclosure.
According to the technical scheme, the method comprises the steps of firstly determining two vertex sets respectively representing two curves according to input graph data and a preset curve function, wherein the graph data comprise 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, which are 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 as to enable the vertexes in the two vertex sets after union processing to be in one-to-one correspondence. And determining a plurality of triangles according to the two vertex sets after union processing, and finally drawing an area graph on a display interface according to the plurality of triangles to display the area graph. The area graph is composed of a plurality of triangles and is a closed area composed of curves corresponding to two vertex sets. According to the area graph drawing method and device, the vertex sets corresponding to the two curves forming the area graph are subjected to union processing, the area graph can be rapidly divided into the triangles, and therefore the drawing efficiency of the area graph is improved.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
FIG. 1 is a flow chart illustrating a method of rendering an area map in accordance with an exemplary embodiment;
FIG. 2 is an area diagram shown in accordance with an exemplary embodiment;
FIG. 3 is a flow chart illustrating another area map rendering method in accordance with an exemplary embodiment;
FIG. 4 is a flow chart illustrating another area map rendering method in accordance with an exemplary embodiment;
FIG. 5 is another area diagram shown in accordance with an exemplary embodiment;
FIG. 6 is a flow chart illustrating another area map rendering method in accordance with an exemplary embodiment;
FIG. 7 is another area diagram shown in accordance with an exemplary embodiment;
FIG. 8 is a flow chart illustrating another area map rendering method in accordance with an exemplary embodiment;
FIG. 9 is a schematic diagram illustrating a first sub-line segment and a second sub-line segment in accordance with an exemplary embodiment;
FIG. 10 is a flow chart illustrating another area map rendering method in accordance with an exemplary embodiment;
FIG. 11 is a schematic diagram of an image frame shown in accordance with an exemplary embodiment;
FIG. 12 is a block diagram illustrating an area map rendering mechanism in accordance with an exemplary embodiment;
FIG. 13 is a block diagram illustrating another area map rendering apparatus in accordance with an exemplary embodiment;
FIG. 14 is a block diagram of another area map rendering device shown in accordance with an exemplary embodiment;
FIG. 15 is a block diagram illustrating another area map rendering apparatus in accordance with an exemplary embodiment;
FIG. 16 is a block diagram illustrating another area map rendering apparatus in accordance with an exemplary embodiment;
FIG. 17 is a block diagram illustrating another area map rendering apparatus in accordance with an exemplary embodiment;
FIG. 18 is a block diagram illustrating an electronic device in accordance with 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 are shown in the 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 rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the 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. Moreover, 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 "include" and variations thereof as used herein are 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". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Fig. 1 is a flow chart illustrating a method of rendering an area map, as shown in fig. 1, according to an exemplary embodiment, the method comprising the steps of:
step 101, according to input graph data and a preset curve function, determining two vertex sets, wherein the graph 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 target vertex points included by the two vertex point sets have the same coordinate on the first coordinate axis, and the target vertex points are the first vertex point and the last vertex point.
For example, to draw an area map, chart data for drawing the area map may be input first. The coordinates of a plurality of control points for limiting the boundaries of the area map are included in the map data, and the map data can be understood as data for characterizing the trend of change. For example, to draw an area graph to reflect the change trend of the number of registered users with time, the area graph includes two coordinate axes, one is a time axis and the other is a number of registered users, and the graph data is the number of registered users corresponding to a plurality of sampling times, which includes the coordinates of a plurality of control points: (1,200), (2,270), …, and (12,1590) respectively indicate that the number of registered users in 1 month is 200 ten thousand, the number of registered users in 2 months is 270 ten thousand, and the number of registered users in … and 12 months is 1590 ten thousand. After the graph data is obtained, a preset curve function needs to be determined, where the curve function is used to represent the shape of the boundary of the area graph and may be set according to specific requirements of a user, for example, the preset curve function may be a first order bezier curve, a second order bezier curve, a third order bezier curve, or the like, or may be other types of curve functions, and the disclosure is not limited specifically.
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 including coordinates of a plurality of vertices arranged in sequence, wherein the order of each vertex in the vertex set may be determined in such a manner that the coordinates on the first coordinate axis increase in sequence. Each set of vertices is used to characterize a curve, i.e. a boundary of the area map. That is, two sets of vertices, characterize the 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 vertexes are collected on the curve, so as 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 this disclosure. In particular, the number of vertices collected may be determined according to the curvature of the curve at each point, for example, the larger the curvature, the larger the number of vertices collected, and the smaller the curvature, the smaller the number of vertices collected.
The coordinate system of the area diagram comprises two coordinate axes: and the first coordinate axis and the second coordinate axis are used for representing two vertex sets of two boundaries of the area graph, and the coordinates of the first vertex (and the last vertex) on the first coordinate axis are the same. The straight line parallel to the first axis has a plurality of intersections with each boundary of the area map, and the straight line parallel to the second axis has only one intersection 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 map includes two upper and lower boundaries, 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 map includes two boundaries on the left and right, the Y axis is the first coordinate axis, the coordinates of the start points of the two boundaries on the Y axis are the same, and the coordinates of the end 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 vertexes in the two vertex sets after union processing are in one-to-one correspondence.
For example, after obtaining two vertex sets, it may be determined whether vertices included in the two vertex sets are in one-to-one correspondence, and if each vertex in one vertex set is found, a unique vertex corresponding to the vertex in the other vertex set can be found, that is, the vertex included in the two vertex sets is in one-to-one correspondence. The two vertexes correspond to each other, and it is understood that coordinates of the two vertexes on the first coordinate axis are equal (the coordinates of the two vertexes on the second coordinate axis may be equal or may not be equal). Since the coordinates of the first vertex (and the last vertex) in the first coordinate axis are the same in the two vertex sets, the first vertex (and the last vertex) in the two vertex sets correspond to each other.
If the vertices included in the two vertex sets are in one-to-one correspondence, the two vertex sets can be directly used as the vertex set after union processing. If the vertices included in the two vertex sets do not correspond to each other, the two vertex sets may be subjected to union processing, so that the vertices included in the two vertex sets after union processing correspond to each other. Specifically, for each vertex in each vertex set, it may be determined sequentially whether the vertex exists in the other vertex set, and if not, one vertex is added to the other vertex set, the coordinate of the added vertex on the first coordinate axis is equal to the coordinate of the vertex on the first coordinate axis, and the added vertex also satisfies the curve corresponding to the other vertex set, that is, the added vertex is on the curve corresponding to the other vertex set. After the steps are executed for each vertex in each vertex set, two vertex sets after union processing can be obtained. For example, the set of A vertices 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 of (1,20) and (3,20) in the set of a vertices, and no corresponding vertex in the set of B vertices, then (1,0) and (3,0) may be added in the set of B vertices. Then the set of a vertices after union processing is: (0,10), (1,20), (2,10), (3,20) and (4,10), and the B vertices after the union processing are (0,0), (1,0), (2,0), (3,0) and (4, 0).
And 103, determining a plurality of triangles according to the two vertex sets after union processing.
And 104, drawing an area graph on the display interface according to the plurality of triangles to display the area graph. The area graph is composed of a plurality of triangles and is a closed area composed of curves corresponding to two vertex sets.
For example, after the union processing is performed, a plurality of triangles may be generated according to the two vertex sets obtained after the union processing, and it may be understood that a closed region formed by two curves corresponding to the two vertex sets after the union processing is divided into a plurality of triangles. Any two adjacent vertexes in one union-processed vertex set and the corresponding vertexes of one vertex in the other union-processed vertex set can be used as three vertexes of a triangle to determine the triangle. For example, the set of a vertices after union processing is: 5 vertexes (0,10), (1,20), (2,10), (3,20), (4,10), and 5 vertexes in total are set as (0,0), (1,0), (2,0), (3,0), (4,0) of the B vertexes after the union processing. Then 8 triangles can be derived from the 10 vertices: triangles 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 as to display the area map on the display interface, as shown in fig. 2. For example, each triangle may be sequentially rendered using WebGL to reveal an area map composed of a plurality of triangles, and other drawing protocols may be used to draw the area map, which is not specifically limited by this disclosure. Furthermore, when the triangle is drawn, the attributes of the triangle, such as color, transparency and the like, can be controlled. Because the vertexes in the two vertex sets after the union set processing are sequentially arranged and in one-to-one correspondence, 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, the efficiency of dividing the triangles can be effectively improved, and the drawing efficiency of the area graph is improved.
In summary, according to the present disclosure, first, two vertex sets respectively representing two curves are determined according to input graph data and a preset curve function, where the graph 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 as to enable the vertexes in the two vertex sets after union processing to be in one-to-one correspondence. And determining a plurality of triangles according to the two vertex sets after union processing, and finally drawing an area graph on a display interface according to the plurality of triangles to display the area graph. The area graph is composed of a plurality of triangles and is a closed area composed of curves corresponding to two vertex sets. According to the area graph drawing method and device, the vertex sets corresponding to the two curves forming the area graph are subjected to union processing, the area graph can be rapidly divided into the triangles, and therefore the drawing efficiency of the area graph is improved.
Fig. 3 is a flowchart illustrating another area map plotting method according to an exemplary embodiment, where the graph data includes coordinates of control points corresponding to a first curve and coordinates of control points corresponding to a second curve, as shown in fig. 3. The implementation of step 101 may include:
step 1011, using the coordinates of the control point corresponding to the first curve as the control parameters of the first curve function corresponding to the first curve, so as to determine a 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 point corresponding to the second curve as the control parameter of the second curve function corresponding to the second curve, so as to determine a 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 is the coordinates of the control points corresponding to the first curve, and the other part is the coordinates of the control points corresponding to the second curve. The first curve and the second curve are two boundaries constituting the area map. The coordinates of the control point corresponding to the first curve may be used as the control parameter of the 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 characterizing the first curve. To acquire a vertex from the first curve, it may be understood that an acquisition value is selected on the first coordinate axis, and then the acquisition value is substituted into the first curve function to obtain a function value of the first curve, so that the coordinate of the vertex on the first coordinate axis is the acquisition value, and the coordinate on the second coordinate axis is the function value. Further, the number of vertices included in the first set of vertices, i.e., the number of vertices collected from the first curve, may be determined according to the curvature of the first curve at each location. For example, if the curvature of the first curve is zero in the range from n to m on the first coordinate axis, that is, the first curve is a straight line in the range from n to m, then n and m at two ends of the straight line may be used as the collected values, and two vertices are collected, that is, the straight line may be represented. If the curvature of the first curve is greater than zero in the range of n to m on the first coordinate axis, a plurality of collected values can be selected between n and m, and a plurality of vertexes are collected to represent the curve. The larger the curvature, the larger the number of vertices required to represent this curve. Similarly, the coordinates of the control point corresponding to the second curve may be used as the control parameter 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 a second vertex set for characterizing 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, or the like, which is not specifically limited by the present disclosure.
Fig. 4 is a flowchart illustrating another area map drawing method according to an exemplary embodiment, and as shown in fig. 4, step 101 may further include the following steps:
and 1013, 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.
And 1014, if an intersection point exists between the first curve and the second curve, adding the coordinates of the intersection point to the first vertex set and the second vertex set respectively.
In some specific application scenarios, the two boundaries of the area map may intersect, as shown in fig. 5, when the intersection point of the two boundaries should be: and a and b coordinates are respectively added to the vertex sets corresponding to the two boundaries. Firstly, a first curve function and a second curve function are utilized to judge whether an intersection point exists between the first curve and the second curve. If there is no intersection between the first curve and the second curve, then execution may continue with step 102. If there are intersections (which may be one, two or more) between the first and second curves, the coordinates of the intersections may be calculated and added to the first and second vertex sets, respectively, that is, the coordinates of the intersections are included in both the first and second vertex sets. Specifically, the coordinates of the intersection points may be added to the first vertex set and the second vertex set in order according to the size of the coordinates of the intersection points on the first coordinate axis, that is, in the first vertex set and the second vertex set to which the intersection points are added, each vertex is still arranged in order according to the size of the coordinates on the first coordinate axis. Therefore, the first vertex set and the second vertex set added with the coordinates of the intersection point can represent that two boundaries of the area graph are intersected, and accordingly a plurality of triangles can be accurately obtained in step 103, so that the area graph with the two intersected boundaries is drawn, and the applicable scene of drawing the area graph is improved.
Fig. 6 is a flowchart illustrating another area map drawing method 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, according to the coordinate of the vertex on the first coordinate axis, determining whether a corresponding vertex exists in the fourth vertex set.
In step 1022, if there is no vertex corresponding to the vertex in the fourth vertex set, an interpolated vertex corresponding to the vertex is added to the fourth vertex set, the coordinate of the interpolated 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 interpolated 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 union processing on two vertex sets, one vertex set of the two vertex sets may be used as a third vertex set, and the other vertex set may be used as a fourth vertex set. Then, for each vertex included in the third vertex set, whether a corresponding vertex exists may be first searched in the fourth vertex set according to the coordinate of the vertex on the first coordinate axis, and if a vertex that is the same as the coordinate of the vertex on the first coordinate axis exists in the fourth vertex set, the vertex corresponding to the vertex is determined.
If there is no vertex in the fourth vertex set that is the same as the coordinate of the vertex on the first coordinate axis, an interpolated vertex corresponding to the vertex that is the same as the coordinate of the vertex on the first coordinate axis and is located on the curve corresponding to the fourth vertex set may be added 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 an implementation manner, the coordinate of the interpolated vertex corresponding to the vertex on the second coordinate axis may be substituted into the curve function of the curve corresponding to the fourth vertex set, so as to use the function value of the curve function as the coordinate of the interpolated 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 an X axis, the second coordinate axis is a Y axis, and the curve function of the curve corresponding to the fourth vertex set is: if y is 7x, then the curve function may be substituted by 3, and the coordinates of the interpolated vertex corresponding to the vertex on the second coordinate axis are obtained as 3 x 7 is 21. That is, the interpolation vertex corresponding to this vertex is (3, 21). In another implementation, the coordinates on the first coordinate axis, the two vertices closest to the vertex, may be searched for in the fourth vertex set, and then the coordinates on the second coordinate axis of the interpolated vertex corresponding to the vertex may be determined according to the two closest vertices. For example, if one vertex in the third vertex set is (3,10), the first coordinate axis is an X axis, the second coordinate axis is a Y axis, and the two vertices closest to the vertex in the fourth vertex set are (2,18) and (4,36) in the coordinates on the X axis, a line segment may be determined according to (2,18) and (4,36), and when the coordinates on the X axis is 3, the corresponding coordinates on the Y axis is 27, that is, the interpolated vertex corresponding to the vertex is (3,27) on the line segment.
In one implementation, step 103 may be:
and aiming at each vertex in the third vertex set, determining a triangle according to the vertex, the vertex adjacent to the vertex and the vertex corresponding to the vertex, wherein the vertex adjacent to the vertex in the third vertex set is the vertex adjacent to the vertex, the vertex corresponding to the vertex in the fourth vertex set is the vertex corresponding to the vertex, and the triangle comprises an edge perpendicular to the first coordinate axis.
The third vertex set is a vertex set after any union set processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union set processing.
For example, when determining a plurality of triangles, any one of two vertex sets after union processing may be regarded as a third vertex set, and the other may be regarded as a 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 from the three vertices may be determined. The vertex adjacent to the vertex is a vertex adjacent to the vertex in the third vertex set, and may be, for example, a vertex before the vertex in the third vertex set or a vertex after the vertex. The vertex corresponding to the vertex is the vertex corresponding to the vertex in the fourth vertex set, that is, 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, its neighbors, and its corresponding vertex must include an edge perpendicular to the first coordinate axis, i.e., a line connecting the vertex and its corresponding vertex. In this way, since the vertices in the two vertex sets after the union processing are in one-to-one correspondence and arranged in the order of size, a plurality of triangles can be quickly divided. Taking the two vertex sets after union processing shown in fig. 7 as an example, the C vertex set after union processing is: 5 vertexes (0,5), (1,15), (2,5), (3,10), (4,20), and the D vertex sets after the union processing are (0,0), (1,0), (2,0), (3,0), (4,0), and 5 vertexes in total. For (0,5) in the C vertex set after union processing, the neighboring 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 combined into one triangle, and so on, and an area map composed of a plurality of triangles may be obtained as shown in fig. 7.
Fig. 8 is a flowchart illustrating another area map rendering method according to an exemplary embodiment, and as shown in fig. 8, before step 103, the method may further include:
and 105, determining a plurality of first sub-line segments according to every two adjacent vertexes in the third vertex set, and determining a plurality of second sub-line segments according to every two adjacent vertexes in the fourth vertex set, wherein the first sub-line segments correspond to the second sub-line segments one to one.
And 106, if the slopes of at least two continuous target first sub-line segments are the same, 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 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 except a first vertex and a last vertex among the plurality of vertices constituting the continuous at least two target first sub-line segments.
The third vertex set is a vertex set after any union set processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union set processing.
For example, in a specific application scenario, there may be overlapping portions 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 can be described by only using two vertices at two ends of the overlapping portions. Therefore, before determining the plurality of triangles, the two boundaries of the area map may be divided into a plurality of sub-line segments according to every two adjacent vertices. To illustrate that any one of the two vertex sets after the union processing is used as a third vertex set, and the other one is used as a fourth vertex set, a plurality of first sub-line segments may be determined according to every two adjacent vertices included in the third vertex set, that is, the plurality of first sub-line segments form a curve corresponding to the third vertex set. And determining a plurality of second sub-line segments according to every two adjacent vertexes 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 correspond to the vertexes in the fourth vertex set one by one, the first sub-line segments correspond to the second sub-line segments one by one.
If the slopes of at least two continuous target first sub-line segments are the same, 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, that is, the line segment formed by at least two continuous target first sub-line segments is parallel to the line segment formed by at least two corresponding second sub-line segments, the merged vertex may be deleted in the third vertex set, and the vertex corresponding to the merged vertex may be deleted in the fourth vertex set. The merged 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 includes: (1,7), (2,9), (3,11), (4,13), wherein the dotted line represents the first sub-line segment and the second sub-line segment. 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 set of vertices may be deleted, while (2,9), (3,11) in the fourth set of vertices may be deleted, thereby reducing the number of vertices included in the third and fourth sets of vertices.
Fig. 10 is a flowchart illustrating another area map drawing method according to an exemplary embodiment, and as shown in fig. 10, the implementation of step 104 may include:
step 1041, determining a display triangle among the plurality of triangles according to the display position specified by the current image frame to be displayed, wherein the coordinates of three vertexes forming the display triangle on the first coordinate axis are all less than or equal to the coordinates of the display position on the first coordinate axis.
And 1042, drawing an image frame according to the display triangle, and displaying the image frame on a display interface, wherein the image frame comprises a target area map, and the target area map consists of the display triangle.
For example, in a specific application scenario, the area map may be presented by way 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 in the image frame to which the area map is displayed. As the time sequence of each image frame in the animation increases, the coordinate of the designated display position on the first coordinate axis becomes larger, so that the area map is displayed in an animation mode. For example, the coordinate range of the area map on the first coordinate axis is 1-100, 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 with the designated display position of 20, this means that the image frame is displayed in the area map in a portion with the first coordinate axis before 20. Specifically, for the display position specified by the image frame to be currently displayed, a display triangle may be determined in the plurality of triangles determined in step 103, and the remaining triangles may be determined as hidden triangles. The coordinates of the three vertexes forming the display triangle on the first coordinate axis are all 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 all smaller than or equal to the coordinates of the display position on the first coordinate axis.
Then, an image frame may be drawn according to the display triangle and displayed on the display interface, where the image frame includes a target area map, that is, the target area map may be a part or all of the area map, and the target area map is an enclosed area composed of the display triangles. Taking the area map shown in fig. 7 as an example, two adjacent image frames may be as shown in (a) and (b) of fig. 11, where (a) of fig. 11 designates a display position of 2 and (b) of fig. 11 designates a display position of 3. Specifically, when the image frame is drawn, 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 rapidly realized directly according to the triangle obtained in the step 103 and the display position appointed by each image frame, and the vertex is not required to be recalculated and triangulation is not required to be performed again aiming at each image frame, so that the calculation amount is greatly reduced, and the animation display efficiency of the area map is improved.
In summary, according to the present disclosure, first, two vertex sets respectively representing two curves are determined according to input graph data and a preset curve function, where the graph 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 as to enable the vertexes in the two vertex sets after union processing to be in one-to-one correspondence. And determining a plurality of triangles according to the two vertex sets after union processing, and finally drawing an area graph on a display interface according to the plurality of triangles to display the area graph. The area graph is composed of a plurality of triangles and is a closed area composed of curves corresponding to two vertex sets. According to the area graph drawing method and device, the vertex sets corresponding to the two curves forming the area graph are subjected to union processing, the area graph can be rapidly divided into the triangles, and therefore the drawing efficiency of the area graph is improved.
Fig. 12 is a block diagram illustrating an area map drawing apparatus 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 represent a curve. The target vertex points included by the two vertex point sets have the same coordinate on the first coordinate axis, and the target vertex points are the first vertex point and the last vertex point.
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 union processing are in one-to-one correspondence.
And a second determining module 203, configured to determine a plurality of triangles according to the two vertex sets after union processing.
The drawing module 204 is configured to draw an area map on the display interface according to the plurality of triangles to display the area map, where the area map is composed of a plurality of triangles and is a closed area composed of curves corresponding to two vertex sets.
Fig. 13 is a block diagram illustrating another area map plotting apparatus according to an exemplary embodiment, and as shown in fig. 13, 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 first determining module 201 may include:
the first determining sub-module 2011 is configured to use the coordinates of the control point corresponding to the first curve as the control parameter of the first curve function corresponding to the first curve, so as to determine the first vertex set used for characterizing the first curve according to the function value of the first curve function.
The second determining sub-module 2012 is configured to use the coordinates of the 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 used for characterizing the second curve according to the function value of the second curve function.
Fig. 14 is a block diagram illustrating another area map drawing apparatus according to an exemplary embodiment, and as shown in fig. 14, the first determining module 201 may further include:
and the first judging submodule 2013 is used for 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.
And the first adding submodule 2014 is used for adding the coordinates of the intersection point to the first vertex set and the second vertex set respectively if the intersection point exists between the first curve and the second curve.
Fig. 15 is a block diagram illustrating another area map drawing apparatus according to an exemplary embodiment, and as shown in fig. 15, the processing module 202 may include:
the second determining submodule 2021 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 a coordinate of the vertex on the first coordinate axis.
The second adding sub-module 2022 is configured to, if there is no vertex corresponding to the vertex in the fourth vertex set, add an interpolated vertex corresponding to the vertex to the fourth vertex set, where coordinates of the interpolated vertex corresponding to the vertex on the first coordinate axis are the same as coordinates of the vertex on the first coordinate axis, and the interpolated 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.
In an application scenario, the second determining module 203 may be configured to:
and aiming at each vertex in the third vertex set, determining a triangle according to the vertex, the vertex adjacent to the vertex and the vertex corresponding to the vertex, wherein the vertex adjacent to the vertex in the third vertex set is the vertex adjacent to the vertex, the vertex corresponding to the vertex in the fourth vertex set is the vertex corresponding to the vertex, and the triangle comprises an edge perpendicular to the first coordinate axis.
The third vertex set is a vertex set after any union set processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union set processing.
Fig. 16 is a block diagram illustrating another area map drawing apparatus according to an exemplary embodiment, and as shown in fig. 16, the apparatus 200 may further include:
the third determining module 205 is configured to determine, before determining a plurality of triangles according to the two vertex sets after the union processing, a plurality of first sub-line segments according to every two adjacent vertices included in the third vertex set, and 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 correspond to the second sub-line segments one to one.
And a deleting module 206, 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 consecutive 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. The merged vertex is a vertex except a first vertex and a last vertex among the plurality of vertices constituting the continuous at least two target first sub-line segments.
The third vertex set is a vertex set after any union set processing, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets after union set processing.
Fig. 17 is a block diagram illustrating another area map drawing apparatus according to an exemplary embodiment, and as shown in fig. 17, the drawing module 204 may include:
the third determining submodule 2041 is configured to determine, according to the display position specified by the current image frame to be displayed, a display triangle among the plurality of triangles, where coordinates of three vertices constituting the display triangle on the first coordinate axis are all smaller than or equal to coordinates of the display position on the first coordinate axis.
The drawing submodule 2042 is configured to draw an image frame according to the display triangles and display the image frame on the display interface, where the image frame includes a target area map, and the target area map is composed of the display triangles.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In summary, according to the present disclosure, first, two vertex sets respectively representing two curves are determined according to input graph data and a preset curve function, where the graph 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 as to enable the vertexes in the two vertex sets after union processing to be in one-to-one correspondence. And determining a plurality of triangles according to the two vertex sets after union processing, and finally drawing an area graph on a display interface according to the plurality of triangles to display the area graph. The area graph is composed of a plurality of triangles and is a closed area composed of curves corresponding to two vertex sets. According to the area graph drawing method and device, the vertex sets corresponding to the two curves forming the area graph are subjected to union processing, the area graph can be rapidly divided into the triangles, and therefore the drawing efficiency of the area graph is improved.
Referring now to fig. 18, a schematic diagram of an electronic device (e.g., an execution body, i.e., a terminal device, in the illustrated embodiment of the present disclosure) 300 suitable for implementing an embodiment of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 18 is only an example, and should not bring any limitation to the functions and the 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 graphic processor, etc.) 301 that 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 necessary 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.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, 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 devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device 300 to communicate wirelessly or by wire with other devices 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 alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present 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 contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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, optical cables, RF (radio frequency), etc., 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 interconnect with any form or medium of digital data communication (e.g., a communications 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 network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled 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 graph data and a preset curve function, wherein the graph 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 set processing on the two vertex sets so that vertexes included in the two vertex sets after union set processing are in one-to-one correspondence; determining a plurality of triangles according to the two vertex sets after union processing; and drawing an area graph on a display interface according to the plurality of triangles, wherein the area graph is composed of the plurality of triangles and is a closed area composed of curves corresponding to the two vertex sets.
Computer program code for carrying out operations for the present disclosure may be written in any combination of 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart 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 by software or hardware. Where the name of a module does not in some cases constitute a definition of the module itself, for example, the first determining module may also be described as a "module determining two vertex sets".
The functions described herein above 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: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), 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. A 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.
Example 1 provides a method of drawing an area map, including: determining two vertex sets according to input graph data and a preset curve function, wherein the graph 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 set processing on the two vertex sets so that vertexes included in the two vertex sets after union set processing are in one-to-one correspondence; determining a plurality of triangles according to the two vertex sets after union processing; drawing an area graph on a display interface according to the triangles to display the area graph, wherein the area graph is composed of the triangles and is a closed area composed of curves corresponding to the two vertex sets.
Example 2 provides the method of example 1, the graph data including coordinates of the control point for a first curve, and coordinates of the control point for a second curve, according to one or more embodiments of the present disclosure; determining two vertex sets according to the input chart data and a preset curve function, wherein the determining comprises the following steps: using the coordinates of the control point corresponding to the first curve as a control parameter of a first curve function corresponding to the first curve, and determining a first vertex set for characterizing the first curve according to a function value of the first curve function; and taking the coordinates of the control point corresponding to the second curve as the control parameters of a second curve function corresponding to the second curve, and determining a second vertex set for representing the second curve according to the function value of the second curve function.
Example 3 provides the method of example 2, the determining two vertex sets from the input graph data and a 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.
Example 4 provides the method of example 1, and the merging two sets of vertices includes: for each vertex in the third vertex set, judging whether a corresponding vertex exists in the fourth vertex set according to the coordinate 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 the curve corresponding to the fourth vertex set; the third vertex set is any one vertex set, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets.
Example 5 provides the method of example 1, wherein determining a plurality of triangles from the two sets of vertices after union processing comprises: for each vertex included in the third vertex set, determining a triangle according to the vertex, a vertex adjacent to the vertex and a vertex corresponding to the vertex, wherein the vertex adjacent to the vertex is a vertex adjacent to the vertex in the third vertex set, the vertex corresponding to the vertex is a vertex corresponding to the vertex in the fourth vertex set, and the triangle includes an edge perpendicular to the first coordinate axis; the third vertex set is the vertex set after any union set processing, and the fourth vertex set is the vertex set except the third vertex set in the two vertex sets after union set processing.
Example 6 provides the method of example 1, before determining the plurality of triangles from the two sets of vertices processed according to the union, the method further comprising: determining a plurality of first sub-line segments according to every two adjacent vertexes in a third vertex set, and determining a plurality of second sub-line segments according to every two adjacent vertexes in a fourth vertex set, wherein the first sub-line segments correspond to the second sub-line segments one to one; if the slopes of at least two continuous target first sub-line segments are the same, and the slope of a 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 merged vertex in the third vertex set, and deleting a vertex corresponding to the merged vertex in the fourth vertex set; the merged vertex is a vertex except 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 the vertex set after any union set processing, and the fourth vertex set is the vertex set except the third vertex set in the two vertex sets after union set processing.
Example 7 provides the method of examples 1-6, the drawing an area map on a display interface according to the plurality of triangles including: determining a display triangle in the plurality of triangles according to the display position appointed by the current image frame to be displayed, wherein the coordinates of three vertexes forming the display triangle on a first coordinate axis are all smaller than or equal to the coordinates of the display position on the first coordinate axis; 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 map, and the target area map is composed of the display triangle.
Example 8 provides an area map drawing apparatus, according to one or more embodiments of the present disclosure, including: the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining two vertex sets according to input graph data and a preset curve function, the graph data comprises coordinates of a plurality of control points, and each vertex set comprises the 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 set processing on the two vertex sets so as to enable the vertexes in the two vertex sets after union set 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 after union processing; and the drawing module is used for drawing an area graph on a display interface according to the triangles so as to display the area graph, and the area graph is composed of the triangles and is a closed area composed of curves corresponding to the two vertex sets.
Example 9 provides a computer-readable medium having stored thereon a computer program that, when executed by a processing apparatus, implements the steps of the methods of examples 1-7, in accordance with one or more embodiments of the present disclosure.
Example 10 provides, in accordance with one or more embodiments of the present disclosure, 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 implement the steps of the methods of examples 1-7.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while 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. Under 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 limitations on the scope of the 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 disclosed as example forms of implementing the claims. With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims (10)

1. A method for drawing an area map, the method comprising:
determining two vertex sets according to input graph data and a preset curve function, wherein the graph 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 set processing on the two vertex sets so that vertexes included in the two vertex sets after union set processing are in one-to-one correspondence;
determining a plurality of triangles according to the two vertex sets after union processing;
drawing an area graph on a display interface according to the triangles to display the area graph, wherein the area graph is composed of the triangles and is a closed area composed of curves corresponding to the two vertex sets.
2. The method of claim 1, wherein the graph data includes coordinates of the control point for a first curve and coordinates of the control point for a second curve; determining two vertex sets according to the input chart data and a preset curve function, wherein the determining comprises the following steps:
using the coordinates of the control point corresponding to the first curve as a control parameter of a first curve function corresponding to the first curve, and determining a first vertex set for characterizing the first curve according to a function value of the first curve function;
and taking the coordinates of the control point corresponding to the second curve as the control parameters of a second curve function corresponding to the second curve, and determining a second vertex set 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 based on the input graph data and a predetermined 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 said merging the two vertex sets comprises:
for each vertex in the third vertex set, judging whether a corresponding vertex exists in the fourth vertex set according to the coordinate 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 the curve corresponding to the fourth vertex set;
the third vertex set is any one vertex set, and the fourth vertex set is a vertex set except the third vertex set in the two vertex sets.
5. The method according to claim 1, wherein determining a plurality of triangles from the two vertex sets after union processing comprises:
for each vertex included in the third vertex set, determining a triangle according to the vertex, a vertex adjacent to the vertex and a vertex corresponding to the vertex, wherein the vertex adjacent to the vertex is a vertex adjacent to the vertex in the third vertex set, the vertex corresponding to the vertex is a vertex corresponding to the vertex in the fourth vertex set, and the triangle includes an edge perpendicular to the first coordinate axis;
the third vertex set is the vertex set after any union set processing, and the fourth vertex set is the vertex set except the third vertex set in the two vertex sets after union set processing.
6. The method of claim 1, wherein prior to said determining a plurality of triangles from said two sets of vertices processed from a union, the method further comprises:
determining a plurality of first sub-line segments according to every two adjacent vertexes in a third vertex set, and determining a plurality of second sub-line segments according to every two adjacent vertexes in a fourth vertex set, wherein the first sub-line segments correspond to the second sub-line segments one to one;
if the slopes of at least two continuous target first sub-line segments are the same, and the slope of a 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 merged vertex in the third vertex set, and deleting a vertex corresponding to the merged vertex in the fourth vertex set; the merged vertex is a vertex except 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 the vertex set after any union set processing, and the fourth vertex set is the vertex set except the third vertex set in the two vertex sets after union set processing.
7. The method according to any one of claims 1-6, wherein said drawing an area map on a display interface according to a plurality of said triangles comprises:
determining a display triangle in the plurality of triangles according to the display position appointed by the current image frame to be displayed, wherein the coordinates of three vertexes forming the display triangle on a first coordinate axis are all smaller than or equal to the coordinates of the display position on the first coordinate axis;
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 map, and the target area map is composed of the display triangle.
8. An apparatus for mapping an area, the apparatus comprising:
the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining two vertex sets according to input graph data and a preset curve function, the graph data comprises coordinates of a plurality of control points, and each vertex set comprises the 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 set processing on the two vertex sets so as to enable the vertexes in the two vertex sets after union set 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 after union processing;
and the drawing module is used for drawing an area graph on a display interface according to the triangles so as to display the area graph, and the area graph is composed of the triangles and is a closed area composed of curves corresponding to the two vertex sets.
9. A computer-readable medium, on which a computer program is stored, characterized in that the program, when being executed by processing means, carries out the steps of the method of any one of claims 1 to 7.
10. 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 carry out the steps of the method according to any one of claims 1 to 7.
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 true CN113506356A (en) 2021-10-15
CN113506356B 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)

Cited By (1)

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

Citations (9)

* 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
US20190236848A1 (en) * 2018-01-31 2019-08-01 International Business Machines Corporation Adaptive labeling of network graphs
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

Patent Citations (9)

* 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
US20190236848A1 (en) * 2018-01-31 2019-08-01 International Business Machines Corporation Adaptive labeling of network graphs
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 (3)

* Cited by examiner, † Cited by third party
Title
FABRIZIO FRATI: "Straight-line drawings of outerplanar graphs in O(dnlogn) area", 《COMPUTATIONAL GEOMETRY》 *
王欣洁;: "空间函数图形的绘制及方法研究", 智能计算机与应用, no. 02 *
蒋心怡等: "线上电视柜视觉形态现状研究", 《家具与室内装饰》, no. 5 *

Cited By (2)

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

Also Published As

Publication number Publication date
CN113506356B (en) 2023-09-01

Similar Documents

Publication Publication Date Title
CN112184738B (en) Image segmentation method, device, equipment and storage medium
CN111243049B (en) Face image processing method and device, readable medium and electronic equipment
CN110298851B (en) Training method and device for human body segmentation neural network
CN110795196A (en) Window display method, device, terminal and storage medium
CN115908679A (en) Texture mapping method, device, equipment and storage medium
CN114742934A (en) Image rendering method and device, readable medium and electronic equipment
CN116310036A (en) Scene rendering method, device, equipment, computer readable storage medium and product
CN113506356B (en) Method and device for drawing area map, readable medium and electronic equipment
CN112150491B (en) Image detection method, device, electronic equipment and computer readable medium
CN111915532B (en) Image tracking method and device, electronic equipment and computer readable medium
CN111461965B (en) Picture processing method and device, electronic equipment and computer readable medium
CN113205601A (en) Roaming path generation method and device, storage medium and electronic equipment
CN111258582A (en) Window rendering method and device, computer equipment and storage medium
CN115778590A (en) Dental model section line generation method, device, equipment and medium
CN115272060A (en) Transition special effect diagram generation method, device, equipment and storage medium
CN115170714A (en) Scanned image rendering method and device, electronic equipment and storage medium
CN114419299A (en) Virtual object generation method, device, equipment and storage medium
CN114723600A (en) Method, device, equipment, storage medium and program product for generating cosmetic special effect
CN110825480A (en) Picture display method and device, electronic equipment and computer readable storage medium
CN116894933B (en) Three-dimensional model comparison method, device, equipment and storage medium
CN112395826B (en) Text special effect processing method and device
CN111563214B (en) Reference line processing method and device
CN115908143B (en) Vehicle cross-layer parking method, device, electronic equipment and computer readable medium
CN112822418B (en) Video processing method and device, storage medium and electronic equipment
CN111753230B (en) Reference line processing method and device

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