CN115082592A - Curve generation method, system, computer equipment and storage medium - Google Patents

Curve generation method, system, computer equipment and storage medium Download PDF

Info

Publication number
CN115082592A
CN115082592A CN202210835404.7A CN202210835404A CN115082592A CN 115082592 A CN115082592 A CN 115082592A CN 202210835404 A CN202210835404 A CN 202210835404A CN 115082592 A CN115082592 A CN 115082592A
Authority
CN
China
Prior art keywords
curve
coordinate
point
line segments
line
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.)
Pending
Application number
CN202210835404.7A
Other languages
Chinese (zh)
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.)
Guangzhou Xinjing Information Technology Service Co ltd
Original Assignee
Guangzhou Xinjing Information Technology Service 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 Guangzhou Xinjing Information Technology Service Co ltd filed Critical Guangzhou Xinjing Information Technology Service Co ltd
Priority to CN202210835404.7A priority Critical patent/CN115082592A/en
Publication of CN115082592A publication Critical patent/CN115082592A/en
Pending legal-status Critical Current

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/30Computing systems specially adapted for manufacturing

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The invention relates to a curve generating method, a system, computer equipment and a storage medium, and the technical scheme is as follows: the method comprises the following steps: receiving a plurality of coordinate points, curve widths and line shapes; sequencing the plurality of coordinate points in a drawing sequence to obtain a coordinate list; generating a plurality of line segments according to the coordinate list and the curve width; assembling the line segments to obtain an assembly curve; flattening the edge of the assembly curve to obtain a coloring curve; drawing the coloring curve according to the line shape to obtain a curve; the method and the device have the advantages of supporting the line width and the anti-aliasing effect.

Description

Curve generation method, system, computer equipment and storage medium
Technical Field
The present invention relates to the field of graphics rendering technologies, and in particular, to a method and system for generating a curve, a computer device, and a storage medium.
Background
Currently, interactive electronic devices (such as tablet computers, smart phones, and smart whiteboards) are widely used in life, work, and study of people. Along with the continuous promotion of user's demand, integrated function application is also more and more abundant in the electronic equipment, for example function application such as drawing or writing integrated in the electronic equipment, after getting into function application such as drawing or writing, the user can draw and write the operation through touch or writing instrument on electronic equipment's operation interface.
The currently used OpenGL graphic API has limited flexibility and practicability in curve drawing, cannot meet the current business requirements, and a webGL version part of browsers cannot support line width and anti-aliasing effects, so that the space to be improved is remained.
Disclosure of Invention
In view of the defects in the prior art, the present invention provides a curve generation method, system, computer device, and storage medium, which have the advantages of supporting the line width and anti-aliasing effect.
The technical purpose of the invention is realized by the following technical scheme: a curve generation method, comprising:
receiving a plurality of coordinate points, curve widths and line shapes;
sequencing the plurality of coordinate points in a drawing sequence to obtain a coordinate list;
generating a plurality of line segments according to the coordinate list and the curve width;
assembling the line segments to obtain an assembly curve;
flattening the edge of the assembly curve to obtain a coloring curve;
and drawing the coloring curve according to the line shape to obtain a curve.
Optionally, the generating a plurality of line segments according to the coordinate list and the curve width includes:
drawing two corresponding coordinate points from the coordinate list according to the drawing sequence, and connecting the two corresponding coordinate points to obtain a plurality of connecting lines;
and respectively expanding half of the curve width towards the two sides of the connecting line along the normal direction of the connecting lines according to the curve width to obtain a plurality of line segments.
Optionally, the assembling the plurality of line segments to obtain an assembly curve includes:
obtaining coordinates of four vertexes of a plurality of line segments to obtain a plurality of first starting point coordinates, second starting point coordinates, first end point coordinates and second end point coordinates;
calculating according to a normal corresponding to a common coordinate point of the two line segments to obtain the distance length of a splicing point of the two line segments;
calculating to obtain a first splicing point coordinate and a second splicing point coordinate according to the splicing point distance length of the two line segments;
and taking the first splicing point coordinate and the second splicing point coordinate as a first starting point coordinate, a second starting point coordinate, a first end point coordinate and a second end point coordinate which correspond to a common coordinate point of the two line segments, and drawing the first starting point coordinate, the second starting point coordinate, the first end point coordinate and the second end point coordinate in sequence according to a drawing sequence to obtain an assembly curve.
Optionally, the coordinate list is [ P ] 1 ,P 2 ,...,P n ](ii) a Wherein n is a positive integer;
the calculating is carried out according to the normal corresponding to the common coordinate point of the two line segments to obtain the splicing point distance length of the two line segments, and the method comprises the following steps:
let the common coordinate point of the two line segments be P i+1
Calculate the normal direction of the ith point as
Figure BDA0003747772910000021
Calculate the normal direction of the (i + 1) th point as
Figure BDA0003747772910000022
The distance between the splicing points of the two line segments is
Figure BDA0003747772910000023
Wherein w is the width of the curve.
Optionally, the calculating to obtain the first splicing point coordinate and the second splicing point coordinate according to the splicing point distance length of the two line segments includes:
calculating according to the distance length of the splicing point of the two line segments and the normal direction of the splicing point of the two line segments to obtain the coordinate of a first splicing point as follows:
Figure BDA0003747772910000031
the second splice point coordinates are: p i+1 -(P i+1 -N i+1 *W i+1 )。
Optionally, the flattening the edge of the assembly curve to obtain a coloring curve includes:
gradually blurring the edge of the assembly curve through Alpha;
Alpha_y=1.0-smoothstep(1.0-smoothValue,1.0,abs(uv.y*2-1.0));
Alpha_x=1.0-smoothstep(1.0-smoothValue,1.0,abs(uv.x*2-1.0));
wherein Alpha _ y represents an Alpha value along the y direction of the curve; alpha _ x represents the Alpha value along the curve x direction; the smoothstep (a, b, v) function represents that v is in smooth transition when the value is [ a, b ], if the value is smaller than a, 0 is taken, and if the value is larger than b, 1 is taken; smoothValue represents the gradient of the layer; uv is the texture coordinate.
Optionally, the drawing the coloring curve according to the line shape to obtain a curve includes:
defining a curve pattern according to the line shape;
obtaining the distance between the current drawing pixel point and the drawing starting point and recording the distance as the drawing distance;
and filling the coloring curve according to the curve style and the drawing distance to obtain the curve.
A curve generation system, comprising: the information receiving module is used for receiving a plurality of coordinate points, curve widths and line shapes;
the coordinate sorting module is used for sorting the coordinate points in a drawing sequence to obtain a coordinate list;
the line segment generation module is used for generating a plurality of line segments according to the coordinate list and the curve width;
the curve drawing module is used for assembling the line segments to obtain an assembly curve;
the leveling module is used for leveling the edge of the assembly curve to obtain a coloring curve;
and the linear drawing module is used for drawing the coloring curve according to the linear shape to obtain a curve.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method described above when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method.
In conclusion, the invention has the following beneficial effects: receiving the position of a curve drawing point input by a user in a screen space coordinate system, recording the position as a corresponding coordinate point, and recording the drawing sequence of the user, the width of a selected curve and the shape of the line; and then ordering the coordinate points according to the drawing sequence of the user to obtain a coordinate list, sequentially selecting coordinate point connecting lines from the coordinate list, generating a plurality of line segments with corresponding widths and line shapes according to the curve width and the line shapes, assembling the line segments according to the drawing sequence, processing the joint of the assembled line segments to obtain a curve, and performing gradual change processing on the edge of the curve to obtain a smooth curve.
Drawings
FIG. 1 is a schematic flow diagram of the present invention;
FIG. 2 is a schematic view of the assembly of wire segments in the present invention;
FIG. 3 is a block diagram of the present invention as assembled;
fig. 4 is an internal structural diagram of a computer device in an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below. Several embodiments of the invention are presented in the drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein.
In the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations. The terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
In the present invention, unless otherwise expressly stated or limited, "above" or "below" a first feature means that the first and second features are in direct contact, or that the first and second features are not in direct contact but are in contact with each other via another feature therebetween. Also, the first feature being "on," "above" and "over" the second feature includes the first feature being directly on and obliquely above the second feature, or merely indicating that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature includes the first feature being directly under and obliquely below the second feature, or simply meaning that the first feature is at a lesser elevation than the second feature. The terms "vertical," "horizontal," "left," "right," "up," "down," and the like are used for descriptive purposes only and are not intended to indicate or imply that the referenced devices or elements must be in a particular orientation, configuration, and operation, and therefore should not be construed as limiting the present invention.
The invention is described in detail below with reference to the figures and examples.
The invention provides a curve generation method, as shown in fig. 1, comprising:
step 100, receiving a plurality of coordinate points, curve widths and line shapes;
step 200, sequencing the coordinate points in a drawing sequence to obtain a coordinate list;
step 300, generating a plurality of line segments according to the coordinate list and the curve width;
step 400, assembling a plurality of line segments to obtain an assembly curve;
500, flattening the edges of the assembly curve to obtain a coloring curve;
and 600, drawing the coloring curve according to the line shape to obtain a curve.
In practical application, receiving the position of a curve drawing point input by a user in a screen space coordinate system, recording the position as a corresponding coordinate point, and recording the drawing sequence of the user, the width of a selected curve and the shape of the line; then, the coordinate points are sequenced according to the drawing sequence of a user to obtain a coordinate list, coordinate point connecting lines are sequentially selected from the coordinate list, a plurality of line segments with corresponding widths are generated according to the width of the curve, the line segments are assembled according to the drawing sequence, the joints of the assembled line segments are processed to obtain an assembly curve, and the edges of the assembly curve are flattened to obtain a coloring curve; finally, drawing the coloring curve according to the preset line shape, specifically, if the preset line shape is a solid line, filling all pixel points of the coloring curve with solids; if the preset line shape is a dotted line, filling solid parts of pixel points of the coloring curve according to the line shape, and filling hollow parts of other parts.
Wherein, for the coordinate point, three-dimensional curve points a (x, y, z), b (x, y, z), c (x, y, z), d (x, y, z) … … input by the user can be used; projecting all the three-dimensional curve points in a screen space coordinate system to obtain corresponding coordinate points A (x, y), B (x, y), C (x, y) and D (x, y) … …; for example, a sheet model used for making clothes is three-dimensional curve points, and corresponding coordinate points can be obtained by projecting each three-dimensional curve point of the sheet model in a screen space coordinate system.
Further, the generating a plurality of line segments according to the coordinate list and the curve width includes:
drawing two corresponding coordinate points from the coordinate list according to the drawing sequence, and connecting the two corresponding coordinate points to obtain a plurality of connecting lines;
and respectively expanding half of the curve width towards the two sides of the connecting line along the normal direction of the connecting lines according to the curve width to obtain a plurality of line segments.
In practical application, coordinate points in the coordinate list are connected according to a drawing sequence to obtain a plurality of connecting lines consistent with the curve drawing sequence, and then half of the curve width is expanded to two sides of the connecting lines simultaneously according to the preset curve width to obtain a plurality of line segments with the preset curve width.
Optionally, the assembling the plurality of line segments to obtain an assembly curve includes:
obtaining coordinates of four vertexes of a plurality of line segments to obtain a plurality of first starting point coordinates, second starting point coordinates, first end point coordinates and second end point coordinates;
calculating according to a normal corresponding to a common coordinate point of the two line segments to obtain the distance length of a splicing point of the two line segments;
calculating to obtain a first splicing point coordinate and a second splicing point coordinate according to the splicing point distance length of the two line segments;
and taking the first splicing point coordinate and the second splicing point coordinate as a first starting point coordinate, a second starting point coordinate, a first end point coordinate and a second end point coordinate which correspond to a common coordinate point of the two line segments, and drawing the coordinates in sequence according to a drawing sequence to obtain an assembly curve.
In practical application, because the line segments have a certain width, the coordinates of four vertexes in a coordinate system are different, so that first starting point coordinates, second starting point coordinates, first end point coordinates and second end point coordinates corresponding to a plurality of line segments are calculated firstly, then when the line segments are assembled into a curve, splicing points inevitably exist in two adjacent line segments according to the drawing sequence, the splicing points of the two line segments are processed, calculation is carried out according to the normal lines of the two line segments, the splicing point distance length of the two line segments is obtained, the splicing point distance length is used as the line width of the splicing point, the first splicing point coordinates and the second splicing point coordinates of the splicing point after splicing are obtained, and the first starting point coordinates, the second starting point coordinates, the first end point coordinates and the second end point coordinates of the splicing point are replaced by the first splicing point coordinates and the second splicing point coordinates of the splicing point, sequentially connecting and drawing according to the drawing sequence to obtain an assembly curve; the starting point has a first starting point coordinate and a second starting point coordinate, the middle splicing points have a first splicing point coordinate and a second splicing point coordinate, and the end point has a first end point coordinate and a second end point coordinate; and connecting the starting point coordinates, the splicing point coordinates and the key coordinates on the same side of each connecting line to obtain the curve.
Optionally, the coordinate list is [ P ] 1 ,P 2 ,...,P n ](ii) a Wherein n is a positive integer;
the calculating is carried out according to the normal corresponding to the common coordinate point of the two line segments to obtain the splicing point distance length of the two line segments, and the method comprises the following steps:
let the common coordinate point of the two line segments be P i+1
Calculating the normal direction of the ith point as
Figure BDA0003747772910000081
Calculate the normal direction of the (i + 1) th point as
Figure BDA0003747772910000082
The distance between the splicing points of the two line segments is
Figure BDA0003747772910000083
Wherein w is the width of the curve.
In practical application, taking section A, B as an example (as shown in FIG. 2 below), w/2 is expanded up and down along the A normal direction to generate 2 upper and lower vertexes A + (A+N A *W/2),A - (A-N A W/2) (wherein normal
Figure BDA0003747772910000084
Figure BDA0003747772910000085
) (ii) a B point is processed, namely because the B point is a middle point, corners need to be spliced, and the next point C needs to be combined to determine two vertexes of the B point; the normal direction of point B is
Figure BDA0003747772910000086
Then splicingLength of point distance
Figure BDA0003747772910000087
Further, the calculating according to the splicing point distance length of the two line segments to obtain the first splicing point coordinate and the second splicing point coordinate includes:
calculating according to the distance length of the splicing point of the two line segments and the normal direction of the splicing point of the two line segments to obtain the coordinate of a first splicing point as follows:
Figure BDA0003747772910000088
the second splice point coordinates are: p is i+1 -(P i+1 -N i+1 *W i+1 )。
Further, the step of performing gradual change processing on the curve edge to obtain a flat curve includes:
gradually blurring the curve edge through Alpha;
Alpha_y=1.0-smoothstep(1.0-smoothValue,1.0,abs(uv.y*2-1.0));
Alpha_x=1.0-smoothstep(1.0-smoothValue,1.0,abs(uv.x*2-1.0));
wherein Alpha _ y represents an Alpha value along the y direction of the curve; alpha _ x represents the Alpha value along the curve x direction; the smoothstep (a, b, v) function represents that v is in smooth transition when the value is [ a, b ], if the value is smaller than a, 0 is taken, and if the value is larger than b, 1 is taken; smoothValue represents the gradient of the layer; uv is the texture coordinate.
In practical application, uv.x is an x coordinate in texture coordinates; y is the y coordinate in the texture coordinate; the transparency is given a gradual change at the edges of the curve by Alpha, so that the edges of the curve have an anti-aliasing effect, abs (uv.x 2-1.0) and abs (uv.y 2-1.0) being equivalent to the vertical/maximum distance (W/2) of a pixel point to the midpoint of the curve.
Further, the drawing the coloring curve according to the line shape to obtain a curve includes:
defining a curve pattern according to the line shape;
obtaining the distance between the current drawing pixel point and the drawing starting point and recording the distance as the drawing distance;
and filling the coloring curve according to the curve style and the drawing distance to obtain the curve.
In practical application, during drawing, judgment needs to be carried out according to the line shape, and if the selected line shape is a solid line, the coloring curve is directly filled with solids; if the selected line is a dotted line, acquiring the distance dis between the current drawing pixel point and the drawing starting point, and recording as the drawing distance; and defining a curve style dish corresponding to the dotted line according to the line shape; and (4) taking the residue of dis according to the byte number of the curve pattern dish, judging the area where the result is located, filling if the area where the result is located is a solid area, and not filling if the area where the result is located is a hollow area. For example, assuming that the selected curve pattern dish is represented by 0b0001110000001111 using binary, it represents that one drawing cycle needs to draw 3-pixel hollow, three-pixel solid, 6-pixel hollow, 4-pixel solid, and so on, the hollow part is 0 and the solid part is 1; and then, calculating the distance dis between the current drawing pixel point and the drawing starting point, expressing the distance dis by using a binary system, and taking the rest of the line segment distance dis according to the byte number of the curve pattern dish, so that whether the current drawing pixel point is in a hollow region or a solid region can be judged.
As shown in fig. 3, the present invention also provides a curve generation system, including: the information receiving module 10 is used for receiving a plurality of coordinate points, curve widths and line shapes;
the coordinate sorting module 20 is configured to sort the plurality of coordinate points in a drawing order to obtain a coordinate list;
a line segment generating module 30, configured to generate a plurality of line segments according to the coordinate list and the curve width;
the curve drawing module 40 is used for assembling the line segments to obtain an assembly curve;
the leveling module 50 is used for leveling the edges of the assembly curve to obtain a coloring curve;
and a linear drawing module 60, configured to draw the coloring curve according to the linear shape to obtain a curve.
Further, the line segment generation module includes:
the connecting line drawing unit is used for drawing two corresponding coordinate points from the coordinate list according to the drawing sequence and connecting the two corresponding coordinate points to obtain a plurality of connecting lines;
and the line width drawing unit is used for respectively expanding half of the curve width towards the two sides of the connecting lines along the normal direction of the connecting lines according to the curve width to obtain a plurality of line segments.
Further, the curve drawing module comprises:
the vertex coordinate acquisition unit is used for acquiring coordinates of four vertexes of the line segments to obtain a plurality of first starting point coordinates, second starting point coordinates, first end point coordinates and second end point coordinates;
the length calculation unit is used for calculating according to a normal corresponding to a common coordinate point of the two line segments to obtain the distance length of a splicing point of the two line segments;
the splicing point coordinate calculation unit is used for calculating to obtain a first splicing point coordinate and a second splicing point coordinate according to the distance length of the splicing points of the two line segments;
and the curve drawing unit is used for drawing the first splicing point coordinate and the second splicing point coordinate as a first starting point coordinate, a second starting point coordinate, a first end point coordinate and a second end point coordinate which correspond to a common coordinate point of the two line segments in sequence according to the drawing sequence to obtain the assembly curve.
For specific definition of a curve generation system, reference may be made to the above definition of a curve generation method, which is not described herein again. The modules of the curve generation system can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The computer program is executed by a processor to implement a curve generation method.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
receiving a plurality of coordinate points, curve widths and line shapes;
sequencing the plurality of coordinate points in a drawing sequence to obtain a coordinate list;
generating a plurality of line segments according to the coordinate list and the curve width;
assembling the line segments to obtain an assembly curve;
flattening the edge of the assembly curve to obtain a coloring curve;
and drawing the coloring curve according to the line shape to obtain a curve.
In one embodiment, the generating line segments according to the coordinate list and the curve width includes:
drawing two corresponding coordinate points from the coordinate list according to the drawing sequence, and connecting the two corresponding coordinate points to obtain a plurality of connecting lines;
and respectively expanding half of the curve width towards the two sides of the connecting line along the normal direction of the connecting lines according to the curve width to obtain a plurality of line segments.
In one embodiment, the assembling the line segments to obtain an assembly curve includes:
obtaining coordinates of four vertexes of a plurality of line segments to obtain a plurality of first starting point coordinates, second starting point coordinates, first end point coordinates and second end point coordinates;
calculating according to a normal corresponding to a common coordinate point of the two line segments to obtain the distance length of a splicing point of the two line segments;
calculating to obtain a first splicing point coordinate and a second splicing point coordinate according to the splicing point distance length of the two line segments;
and taking the first splicing point coordinate and the second splicing point coordinate as a first starting point coordinate, a second starting point coordinate, a first end point coordinate and a second end point coordinate which correspond to a common coordinate point of the two line segments, and drawing the coordinates in sequence according to a drawing sequence to obtain an assembly curve.
In one embodiment, the coordinate list is [ P ] 1 ,P 2 ,...,P n ](ii) a Wherein n is a positive integer;
the calculating is carried out according to the normal corresponding to the common coordinate point of the two line segments to obtain the splicing point distance length of the two line segments, and the method comprises the following steps:
let the common coordinate point of the two line segments be P i+1
Calculate the normal direction of the ith point as
Figure BDA0003747772910000121
Calculate the normal direction of the (i + 1) th point as
Figure BDA0003747772910000122
The distance between the splicing points of the two line segments is
Figure BDA0003747772910000123
Wherein w is the width of the curve.
In an embodiment, the calculating the first splicing point coordinate and the second splicing point coordinate according to the distance length between the splicing points of the two line segments includes:
calculating according to the distance length of the splicing point of the two line segments and the normal direction of the splicing point of the two line segments to obtain the coordinate of a first splicing point as follows:
Figure BDA0003747772910000131
the second splice point coordinates are:
Figure BDA0003747772910000132
in one embodiment, the flattening the edges of the assembly curve to obtain a colored curve includes:
gradually blurring the edge of the assembly curve through Alpha;
Alpha_y=1.0-smoothstep(1.0-smoothValue,1.0,abs(uv.y*2-1.0));
Alpha_x=1.0-smoothstep(1.0-smoothValue,1.0,abs(uv.x*2-1.0));
wherein Alpha _ y represents an Alpha value along the y direction of the curve; alpha _ x represents the Alpha value along the curve x direction; the smoothstep (a, b, v) function represents that v is in smooth transition when the value is [ a, b ], if the value is smaller than a, 0 is taken, and if the value is larger than b, 1 is taken; smoothValue represents the gradient of the layer; uv is the texture coordinate.
In one embodiment, said plotting said shading curve according to said line shape results in a curve comprising:
defining a curve pattern according to the line shape;
obtaining the distance between the current drawing pixel point and the drawing starting point and recording the distance as the drawing distance;
and filling the coloring curve according to the curve style and the drawing distance to obtain the curve.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments, and all technical solutions belonging to the idea of the present invention belong to the protection scope of the present invention. It should be noted that modifications and embellishments within the scope of the invention may occur to those skilled in the art without departing from the principle of the invention, and are considered to be within the scope of the invention.

Claims (10)

1. A curve generation method, comprising:
receiving a plurality of coordinate points, curve widths and line shapes;
sequencing the coordinate points in a drawing sequence to obtain a coordinate list;
generating a plurality of line segments according to the coordinate list and the curve width;
assembling the line segments to obtain an assembly curve;
flattening the edge of the assembly curve to obtain a coloring curve;
and drawing the coloring curve according to the line shape to obtain a curve.
2. The method of claim 1, wherein generating line segments from the list of coordinates and a curve width comprises:
drawing two corresponding coordinate points from the coordinate list according to the drawing sequence, and connecting the two corresponding coordinate points to obtain a plurality of connecting lines;
and respectively expanding half of the curve width towards the two sides of the connecting line along the normal direction of the connecting lines according to the curve width to obtain a plurality of line segments.
3. The method of claim 2, wherein assembling the plurality of segments results in an assembly curve comprising:
obtaining coordinates of four vertexes of a plurality of line segments to obtain a plurality of first starting point coordinates, second starting point coordinates, first end point coordinates and second end point coordinates;
calculating according to a normal corresponding to a common coordinate point of the two line segments to obtain the distance length of a splicing point of the two line segments;
calculating to obtain a first splicing point coordinate and a second splicing point coordinate according to the splicing point distance length of the two line segments;
and taking the first splicing point coordinate and the second splicing point coordinate as a first starting point coordinate, a second starting point coordinate, a first end point coordinate and a second end point coordinate which correspond to a common coordinate point of the two line segments, and drawing the coordinates in sequence according to a drawing sequence to obtain an assembly curve.
4. The method of claim 3, wherein the list of coordinates is [ P [ ] 1 ,P 2 ,...,P n ](ii) a Wherein n is a positive integer;
the calculating is carried out according to the normal corresponding to the common coordinate point of the two line segments to obtain the splicing point distance length of the two line segments, and the method comprises the following steps:
let the common coordinate point of the two line segments be P i+1
Calculate the firstNormal direction of point i is
Figure FDA0003747772900000021
Calculate the normal direction of the (i + 1) th point as
Figure FDA0003747772900000022
The distance between the splicing points of the two line segments is
Figure FDA0003747772900000023
Wherein w is the width of the curve.
5. The method of claim 4, wherein calculating the first splice point coordinate and the second splice point coordinate based on the splice point distance length of the two line segments comprises:
calculating according to the distance length of the splicing point of the two line segments and the normal direction of the splicing point of the two line segments to obtain the coordinate of a first splicing point as follows: p i+1+ (P i+1 +N i+1 *W i+1 ) (ii) a The second splice point coordinates are: p i+1 -(P i+1 -N i+1 *W i+1 )。
6. The method of claim 5, wherein flattening the edges of the assembly curve to obtain a colored curve comprises:
gradually blurring the edge of the assembly curve through Alpha;
Alpha_y=1.0-smoothstep(1.0-smoothValue,1.0,abs(uv.y*2-1.0));
Alpha_x=1.0-smoothstep(1.0-smoothValue,1.0,abs(uv.x*2-1.0));
wherein Alpha _ y represents an Alpha value along the y direction of the curve; alpha _ x represents the Alpha value along the curve x direction; the smoothstep (a, b, v) function represents that v is in smooth transition when the value is [ a, b ], if the value is smaller than a, 0 is taken, and if the value is larger than b, 1 is taken; smoothValue represents the gradient of the layer; uv is the texture coordinate.
7. The method of claim 1, wherein said plotting said shading curve according to said line shape results in a curve comprising:
defining a curve pattern according to the line shape;
obtaining the distance between the current drawing pixel point and the drawing starting point and recording the distance as the drawing distance;
and filling the coloring curve according to the curve style and the drawing distance to obtain the curve.
8. A curve generation system, comprising:
the information receiving module is used for receiving a plurality of coordinate points, curve widths and line shapes;
the coordinate sorting module is used for sorting the coordinate points in a drawing sequence to obtain a coordinate list;
the line segment generation module is used for generating a plurality of line segments according to the coordinate list and the curve width;
the curve drawing module is used for assembling the line segments to obtain an assembly curve;
the leveling module is used for leveling the edge of the assembly curve to obtain a coloring curve;
and the linear drawing module is used for drawing the coloring curve according to the linear shape to obtain a curve.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210835404.7A 2022-07-15 2022-07-15 Curve generation method, system, computer equipment and storage medium Pending CN115082592A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210835404.7A CN115082592A (en) 2022-07-15 2022-07-15 Curve generation method, system, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210835404.7A CN115082592A (en) 2022-07-15 2022-07-15 Curve generation method, system, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115082592A true CN115082592A (en) 2022-09-20

Family

ID=83259725

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210835404.7A Pending CN115082592A (en) 2022-07-15 2022-07-15 Curve generation method, system, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115082592A (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 (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050270289A1 (en) * 2004-06-03 2005-12-08 Nintendo Co., Ltd. Graphics identification program
CN105701855A (en) * 2016-01-11 2016-06-22 南京师范大学 Linear map symbol anti-aliasing drawing method based on symbol structure
CN106408627A (en) * 2016-09-21 2017-02-15 中国航空无线电电子研究所 Linear symbol drawing method
CN112562036A (en) * 2020-12-10 2021-03-26 卡斯柯信号(成都)有限公司 Method for drawing configuration system turnout icon by linear polygon
WO2022011808A1 (en) * 2020-07-17 2022-01-20 南京慧尔视智能科技有限公司 Radar-based curve drawing method and apparatus, electronic device, and storage medium
CN114565701A (en) * 2022-02-28 2022-05-31 深圳市华胜软件技术有限公司 Line segment drawing method and device, electronic equipment and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050270289A1 (en) * 2004-06-03 2005-12-08 Nintendo Co., Ltd. Graphics identification program
CN105701855A (en) * 2016-01-11 2016-06-22 南京师范大学 Linear map symbol anti-aliasing drawing method based on symbol structure
CN106408627A (en) * 2016-09-21 2017-02-15 中国航空无线电电子研究所 Linear symbol drawing method
WO2022011808A1 (en) * 2020-07-17 2022-01-20 南京慧尔视智能科技有限公司 Radar-based curve drawing method and apparatus, electronic device, and storage medium
CN112562036A (en) * 2020-12-10 2021-03-26 卡斯柯信号(成都)有限公司 Method for drawing configuration system turnout icon by linear polygon
CN114565701A (en) * 2022-02-28 2022-05-31 深圳市华胜软件技术有限公司 Line segment drawing method and device, electronic equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
方雷;刘仁义;吕干;杜震洪;姚申君;: "一种动态绘制无交叉法线坡面线的新算法", 测绘学报, no. 04, 15 August 2011 (2011-08-15) *

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

Similar Documents

Publication Publication Date Title
JP6463625B2 (en) Image resizing
CN109584327B (en) Face aging simulation method, device and equipment
US8379058B2 (en) Methods and apparatuses to arbitrarily transform windows
CN107705363B (en) Road three-dimensional visual modeling method and device
CN110704087A (en) Page generation method and device, computer equipment and storage medium
CN115082592A (en) Curve generation method, system, computer equipment and storage medium
CN114119837A (en) Geometric processing compression method and device in Revit model lightweight rendering process
CN112767424B (en) Automatic subdivision method based on indoor three-dimensional point cloud space
CN105741335A (en) Fast drawing method of multi-level war-game map based on blocking structure
CN112465931B (en) Image text erasing method, related equipment and readable storage medium
CN113160369B (en) Model rendering method and device, storage medium and computer equipment
CN102200985A (en) Correspondence device and method of webpage and document object model (DOM)
CN111932566B (en) Model contour diagram generation method, device and system
CN110489510B (en) Road data processing method and device, readable storage medium and computer equipment
CN109410302B (en) Texture mapping method, texture mapping device, computer equipment and storage medium
CN112634425A (en) Model rendering method and device, storage medium and computer equipment
CN114429482A (en) Shale hole and organic matter identification method and device, computer equipment and storage medium
CN111028323A (en) Simulation method, device and equipment for water ripple in map and readable storage medium
CN108665514B (en) Font dividing method and font dividing device
CN110706351A (en) Triangular mesh model generation method and device
CN111260780A (en) Real-time terrain modification method based on elevation of altitude map
CN118212336A (en) 3D pattern generation method and system
CN114612320B (en) Image brightness optimization method, device, computer equipment and storage medium
WO2019043564A1 (en) System and method for rendering a graphical shape
CN116563490B (en) Full-automatic quadrilateral boundary layer grid generation method based on rigid mapping

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