CN110111425B - 3D font oblique angle generation method, medium, device and apparatus - Google Patents
3D font oblique angle generation method, medium, device and apparatus Download PDFInfo
- Publication number
- CN110111425B CN110111425B CN201910376972.3A CN201910376972A CN110111425B CN 110111425 B CN110111425 B CN 110111425B CN 201910376972 A CN201910376972 A CN 201910376972A CN 110111425 B CN110111425 B CN 110111425B
- Authority
- CN
- China
- Prior art keywords
- straight line
- font
- contour
- bezier curve
- control polygon
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
- G06T17/20—Finite element generation, e.g. wire-frame surface description, tesselation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
- G06T19/20—Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/66—Analysis of geometric attributes of image moments or centre of gravity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2200/00—Indexing scheme for image data processing or generation, in general
- G06T2200/08—Indexing scheme for image data processing or generation, in general involving all processing steps from image acquisition to 3D model generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2219/00—Indexing scheme for manipulating 3D models or images for computer graphics
- G06T2219/20—Indexing scheme for editing of 3D models
- G06T2219/2021—Shape modification
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- Computer Graphics (AREA)
- Software Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Architecture (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Image Generation (AREA)
Abstract
The invention discloses a 3D font oblique angle generation method, medium, equipment and device, comprising the following steps: acquiring each original contour of the Truetype font; sequentially connecting the end point of each section of straight line in each original contour with three control points of each quadratic Bezier curve to generate a control polygon; calculating the normal of each straight-line segment, and calculating the normal of each vertex of the control polygon; controlling the original contour to retract along the normal direction; in the process of controlling the polygon to retract, detecting whether the control polygon collides or not, and controlling the vertex where the collision occurs and the straight line segment where the collision occurs to stop moving; respectively sampling a straight line and a secondary Bezier curve in the original contour and a straight line and a secondary Bezier curve in the retracted contour to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh; therefore, the triangular meshes at the oblique angles are prevented from being intersected in the three-dimensional conversion process of the two-dimensional font, and the sensory effect of the finally generated 3D font is improved.
Description
Technical Field
The invention relates to the technical field of font processing, in particular to a 3D font oblique angle generation method, medium, equipment and device.
Background
In the process of three-dimensional conversion of a two-dimensional font, an inner oblique angle is often required to be generated in the outline of the font so as to increase the expressive force of the font.
However, in the existing process of three-dimensionally transforming a two-dimensional font, when a font to be processed is a font with a complex outline (for example, a chinese font), the triangular meshes of the oblique angles are easy to intersect with each other, and the rendering effect of the finally generated three-dimensional font is further affected.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the art described above. Therefore, an object of the present invention is to provide a method for generating an oblique angle of a 3D font, which can prevent triangular meshes of the oblique angle from intersecting each other during a three-dimensional conversion process of a two-dimensional font, and improve a sensory effect of a finally generated 3D font.
A second object of the invention is to propose a computer-readable storage medium.
A third object of the invention is to propose a computer device.
The fourth purpose of the invention is to provide a 3D font oblique angle generating device.
In order to achieve the above object, an embodiment of the first aspect of the present invention provides a method for generating an oblique angle of a 3D font, including the following steps: acquiring each original contour of the Truetype font, wherein each original contour comprises a straight line and a quadratic Bezier curve which are connected end to end; sequentially connecting the end point of each straight line in each original contour with three control points of each quadratic Bezier curve to generate a control polygon; calculating the normal of each straight-line segment of the control polygon, and calculating the normal of each vertex of the control polygon according to the normal of each straight-line segment of the control polygon; along the normal direction of each vertex of the control polygon, controlling each vertex to gradually move towards the inside of the original contour so as to enable the control polygon to be retracted; in the process of controlling the polygon to retract, detecting whether collision occurs between vertexes of the control polygon and between the straight line segments, and controlling the vertexes where the collision occurs and the straight line segments where the collision occurs to stop moving; and respectively sampling each section of straight line and each secondary Bezier curve in the original contour and each section of straight line and each secondary Bezier curve in the retracted contour to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh.
According to the oblique angle generation method of the 3D font, firstly, each original contour of the Truetype font is obtained, wherein each original contour comprises a straight line and a quadratic Bezier curve which are connected end to end; sequentially connecting the end point of each straight line in each original contour with three control points of each quadratic Bezier curve to generate a control polygon; calculating the normal of each straight line segment of the control polygon, and calculating the normal of each vertex of the control polygon according to the normal of each straight line segment of the control polygon; along the normal direction of each vertex of the control polygon, controlling each vertex to gradually move towards the inside of the original contour so as to enable the control polygon to be retracted; in the process of controlling the polygon to contract inwards, detecting whether collision occurs between vertexes of the control polygon and between the straight line segments, and controlling the vertexes with collision and the straight line segments with collision to stop moving; sampling each section of straight line and each secondary Bezier curve in the original outline and each section of straight line and each secondary Bezier curve in the shrunk outline respectively to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh, thereby realizing the purpose of avoiding the triangular mesh intercrossing of the oblique angle in the process of three-dimensional conversion of the two-dimensional font and improving the sensory effect of the finally generated 3D font.
In addition, the oblique angle generating method for 3D font proposed by the above embodiment of the present invention may further have the following additional technical features:
optionally, during the process of controlling the polygon to retract, the original contour follows to retract.
Optionally, a sampling manner of each straight line and each quadratic bezier curve in the original contour is the same as that of each straight line and each quadratic bezier curve in the retracted contour, so that sampling points on the original contour are the same as and in one-to-one correspondence to sampling points on the retracted contour.
Optionally, two adjacent sampling points on the original contour and two adjacent sampling points on the retracted contour are combined to form two triangles, so as to generate the triangulated mesh.
To achieve the above object, a second aspect of the present invention provides a computer-readable storage medium, on which a 3D font skew angle generation program is stored, where the 3D font skew angle generation program, when executed by a processor, implements the 3D font skew angle generation method as described above.
According to the computer-readable storage medium of the embodiment of the invention, by storing the oblique angle generating program of the 3D font, when the oblique angle generating program of the 3D font is executed by the processor, the oblique angle generating method of the 3D font is realized, the triangular meshes of oblique angles are prevented from being intersected with each other in the process of three-dimensional conversion of the two-dimensional font, and the sensory effect of the finally generated 3D font is improved.
In order to achieve the above object, a third embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the oblique angle generation method for 3D fonts as described above.
According to the computer equipment provided by the embodiment of the invention, the processor executes the oblique angle generation method of the 3D font, so that the triangular meshes of oblique angles are prevented from being intersected in the three-dimensional conversion process of the two-dimensional font, and the sensory effect of the finally generated 3D font is improved.
In order to achieve the above object, a fourth aspect of the present invention provides an apparatus for generating oblique angles of a 3D font, including: the acquisition module is used for acquiring each original contour of the Truetype font, wherein each original contour comprises a straight line and a quadratic Bezier curve which are connected end to end; the first generation module is used for sequentially connecting the end point of each section of straight line in each original contour with three control points of each quadratic Bezier curve to generate a control polygon; the calculation module is used for calculating the normal of each straight line segment of the control polygon and calculating the normal of each vertex of the control polygon according to the normal of each straight line segment of the control polygon; the control module is used for controlling each vertex to gradually move towards the inside of the original contour along the normal direction of each vertex of the control polygon so as to enable the control polygon to carry out retraction, detecting whether collision occurs between the vertexes of the control polygon and between the straight line segments in the process of controlling the polygon to carry out retraction, and controlling the vertexes which collide and the straight line segments which collide to stop moving; and the second generation module is used for respectively sampling each section of straight line and each quadratic Bezier curve in the original contour and each section of straight line and each quadratic Bezier curve in the retracted contour to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh.
According to the oblique angle generating device of the 3D font, each original contour of the Truetype font is obtained through an obtaining module, wherein each original contour comprises a straight line and a secondary Bezier curve which are connected end to end; after each original contour of the Truetype font is obtained, sequentially connecting an end point of each straight line in each original contour and three control points of each quadratic Bezier curve through a first generation module to generate a control polygon; the normal of each straight line segment of the polygon is controlled by the computing module to be computed, and the normal of each vertex of the control polygon is computed according to the normal of each straight line segment of the control polygon; after the calculation is finished, controlling each vertex to move gradually towards the inside of the original contour through a control module along the normal direction of each vertex of the control polygon so as to enable the control polygon to carry out retraction, detecting whether collision occurs between the vertexes of the control polygon and between the straight line segments in the process of controlling the polygon to carry out retraction, and controlling the vertexes which collide and the straight line segments which collide to stop moving; after the inner contraction is finished, sampling each section of straight line and each secondary Bezier curve in the original contour and each section of straight line and each secondary Bezier curve in the inner contracted contour respectively through a second generation module to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh; therefore, the triangular meshes at the oblique angles are prevented from being intersected in the three-dimensional conversion process of the two-dimensional font, and the sensory effect of the finally generated 3D font is improved.
In addition, the oblique angle generating apparatus for 3D font according to the above embodiment of the present invention may further have the following additional technical features:
optionally, during the process of controlling the polygon to retract, the original contour follows to retract.
Optionally, a sampling manner of each straight line and each quadratic bezier curve in the original contour is the same as that of each straight line and each quadratic bezier curve in the retracted contour, so that sampling points on the original contour are the same as and in one-to-one correspondence to sampling points on the retracted contour.
Optionally, the second generating module is further configured to form two triangles by two adjacent sampling points on the original contour and two corresponding adjacent sampling points on the retracted contour, so as to generate the triangulated mesh.
Drawings
FIG. 1 is a flowchart illustrating a method for generating an oblique angle of a 3D font according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an original outline and control polygons according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating an effect of controlling polygon retraction according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a collision detection process for controlling polygon retraction according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a triangulated mesh generation process according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a three-dimensional font generation effect according to an embodiment of the present invention;
fig. 7 is a block diagram illustrating an oblique angle generating apparatus for a 3D font according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
In the process of three-dimensional conversion of the existing two-dimensional font, triangular meshes at oblique angles are easy to intersect, so that the rendering effect of the finally generated three-dimensional font is influenced; according to the oblique angle generation method of the 3D font, firstly, each original contour of the Truetype font is obtained, wherein each original contour comprises a straight line and a quadratic Bezier curve which are connected end to end; sequentially connecting the end point of each section of straight line in each original contour with three control points of each quadratic Bezier curve to generate a control polygon; calculating the normal of each straight-line segment of the control polygon, and calculating the normal of each vertex of the control polygon according to the normal of each straight-line segment of the control polygon; along the normal direction of each vertex of the control polygon, controlling each vertex to gradually move towards the inside of the original contour so as to enable the control polygon to be retracted; in the process of controlling the polygon to contract inwards, detecting whether collision occurs between vertexes of the control polygon and between the straight line segments, and controlling the vertexes with collision and the straight line segments with collision to stop moving; sampling each section of straight line and each secondary Bezier curve in the original outline and each section of straight line and each secondary Bezier curve in the shrunk outline respectively to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh, thereby realizing the purpose of avoiding the triangular mesh intercrossing of the oblique angle in the process of three-dimensional conversion of the two-dimensional font and improving the sensory effect of the finally generated 3D font.
In order to better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
Fig. 1 is a schematic flow diagram of a 3D font skew angle generation method according to an embodiment of the present invention, and as shown in fig. 1, the 3D font skew angle generation method includes the following steps:
s101, acquiring each original contour of the Truetype font.
And S102, sequentially connecting the end point of each straight line in each original contour and three control points of each quadratic Bezier curve to generate a control polygon.
That is to say, each original contour of the Truetype font is obtained, wherein each original contour comprises straight lines connected end to end and a quadratic bezier curve, and after each original contour of the Truetype font is obtained, the end points of each straight line in each original contour and three control points of each quadratic bezier curve are sequentially connected to generate a control polygon corresponding to the original contour.
As an example, a Truetype glyph may be defined by one or more closed directed contours, where each contour does not intersect itself, nor with other contours; moreover, the original contour is surrounded by a control polygon which is generated by sequentially connecting the end point of each straight line in each original contour and the three control points of each quadratic Bezier curve, and the shape of the control polygon is similar to that of the contour; specifically, as shown in fig. 2, the original contour abde is an original contour composed of two straight line segments and two quadratic bezier curves, where a point a and a point b, a point d and a point e are two end points of the two straight line segments in the original contour, respectively, and a point b, a point c and a point d are three control points corresponding to the quadratic bezier curves located above; the point e, the point f and the point a are three control points corresponding to the lower quadratic Bezier curve, and two end points of each section of straight line are sequentially connected with the three control points of each quadratic Bezier curve; that is, the end points of the straight line and the control points of the quadratic bezier curve are sequentially connected to generate the control polygon abcdef.
S103, calculating the normal of each straight line segment of the control polygon, and calculating the normal of each vertex of the control polygon according to the normal of each straight line segment of the control polygon.
As an example, in the process of calculating the normal of a straight line segment in the control polygon, first, a midpoint of the straight line segment is obtained, and a straight line passing through the midpoint and perpendicular to the straight line segment is the normal of the straight line segment; furthermore, the two straight line segments are connected to form a vertex, and a straight line corresponding to a connecting line between an intersection point formed by the normal lines of the two intersecting straight line segments and the vertex is the normal line of the vertex.
And S104, controlling each vertex to gradually move towards the inside of the original contour along the normal direction of each vertex of the control polygon so as to retract the control polygon.
That is, each vertex is controlled to move gradually toward the inside of the original contour along the normal direction of each vertex, and thus, the polygon is controlled to shrink inward as a whole during the movement of the vertex.
In some embodiments, during the control polygon inward compression, the original contour is inward compressed following the control polygon movement.
As an example, as shown in fig. 3, fig. 3 is a schematic flow chart of moving vertices of a control polygon to perform inner-reduction on the control polygon and an original contour, in which two solid lines are used to represent the control polygon and the original contour, respectively, arrows are used to represent normals of the vertices, and two dotted lines are used to represent the control polygon after inner-reduction along a normal direction of each vertex and the contour after inner-reduction following the control polygon, respectively.
S105, in the process of the control polygon retraction, whether collision occurs between the vertexes of the control polygon and between the straight line segments or not is detected, and the vertexes where the collision occurs and the straight line segments where the collision occurs are controlled to stop moving.
That is, in the process of performing the inward contraction of the control polygon, whether the collision occurs between the vertex and the vertex of the control polygon and between the straight line segment and the straight line segment is detected, and if the collision occurs between the vertex and the vertex or between the straight line segment and the straight line segment, the inward contraction motion of the collided vertex or the collided straight line segment is terminated.
As an example, first, a collision distance threshold is preset, during the process of performing inward contraction on the control polygon, the distance between the vertex and the vertex of the control polygon and the distance between the non-adjacent straight line segments are monitored in real time, whether the distance between the vertex and the distance between the non-adjacent straight line segments are smaller than the preset collision distance threshold is judged, if the judgment result is yes, it is considered that collision occurs between the current vertex and the vertex or between the non-adjacent straight line segments and the straight line segments, and the inward contraction motion of the collided vertex or the collided straight line segments is terminated.
As another example, as shown in fig. 4, fig. 4 is a schematic flow chart of collision detection during the process of shrinking the control polygon, as shown in fig. 4 (a), points 1, 2, 3, 4, and 5 represent the respective vertices of the control polygon, and points 1 ', 2 ', 3 ', 4 ', and 5 ' represent the respective vertices of the control polygon after shrinking; as shown in fig. 4 (B), during the process of performing the inward contraction of the control polygon, monitoring the distance between the vertices in the control polygon, and if the distance between the vertex 4 'and the vertex 5' is smaller than the preset collision distance threshold, determining that the vertex 4 'and the vertex 5' collide with each other, and stopping the inward contraction motion of the vertex 4 'and the vertex 5'; as shown in fig. 4 (C), after the retraction motion of the vertex 4 ' and the vertex 5 ' is stopped, the other vertices of the polygon are controlled to continue to retract, at this time, the distance between the non-adjacent straight line segments 1 ' -2 ' and 3 ' -4 ' is smaller than the preset collision distance threshold, that is, the two straight line segments are about to intersect, it is determined that the straight line segments 1 ' -2 ' and 3 ' -4 ' collide, the retraction motion of the corresponding vertex 1 ', 2 ', and 3 ' is stopped, and finally, when all the vertices stop the retraction motion, the retraction profile shown in fig. 4 (D) is obtained.
S106, sampling each section of straight line and each secondary Bezier curve in the original contour and each section of straight line and each secondary Bezier curve in the retracted contour respectively to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh.
That is, each section of straight line and each quadratic bezier curve in the original contour are sampled, each section of straight line and each quadratic bezier curve in the retracted contour are sampled, a triangulated mesh is generated according to the sampling results of the straight line and the quadratic bezier curve, and then an oblique angle is generated according to the generated triangulated mesh.
As an example, each straight line in the original profile and each quadratic bezier curve and each straight line in the shrunk-in profile and each quadratic bezier curve are in a one-to-one correspondence relationship, and in the process of sampling the two, the same sampling mode is adopted, so that the sampling points on the original profile and the sampling points on the shrunk-in profile are the same and are in one-to-one correspondence; then, assuming that the plane where the original profile is located is X-Y, translating the retracted profile in the positive direction of the Z axis, after the translation is completed, two corresponding sets of sampling point pairs (namely four sampling points) are arranged in each pair of corresponding sampling sections in the retracted profile and the original profile, so that two triangles can be generated by connecting according to the four sampling points, after the generation of the triangles is sequentially performed according to the sampling points, the generation of the triangulated mesh is completed, and then the generation of the oblique angles can be performed according to the triangulated mesh.
As another example, as shown in fig. 5, as shown in a diagram (E) in fig. 5, the diagram (E) is a schematic diagram of an unprocessed control polygon and an original contour, as shown in a diagram (F) in fig. 5, and the diagram (F) is a schematic diagram of a sampling result after sampling the original contour; as shown in a diagram (G) in fig. 5, the diagram (G) is a schematic diagram of a sampling result after the sampling of the contracted contour; as shown in diagram (H) in fig. 5, diagram (H) is a schematic diagram of the effect after triangularization is performed according to the sampling results of the original contour and the retracted contour; as shown in fig. 5 (I), the diagram (I) is a schematic diagram of the effect of the glyph e after generating the oblique angle according to the triangulated mesh.
In addition, in order to more intuitively embody the improvement degree of the final visual effect of the three-dimensional font by generating the three-dimensional font oblique angle by the oblique angle generating method for the 3D font according to the embodiment of the present invention, an effect schematic diagram for generating the three-dimensional font oblique angle in the prior art is compared with an effect schematic diagram for generating the three-dimensional font oblique angle by the oblique angle generating method for the 3D font according to the embodiment of the present invention; as shown in fig. 6, as shown in fig. 6 (J), the diagram (J) is a schematic diagram of an effect of generating a three-dimensional font skew angle in the prior art, as shown in fig. (J), after a "manuscript" character is subjected to skew angle generation in the prior art, in a final three-dimensional font generated by the prior art, multiple skew angles are intersected with each other, and a visual effect of the final three-dimensional font is greatly affected, as shown in fig. 6 (K), the schematic diagram of an effect of generating a three-dimensional font skew angle by the skew angle generation method for a 3D font according to the embodiment of the present invention is shown in fig. K, after the skew angle generation method for a "manuscript" character according to the embodiment of the present invention is subjected to skew angle generation, the skew angles are not intersected with each other, and as compared with the prior art, a visual effect of the 3D font is greatly improved.
In summary, according to the oblique angle generation method for the 3D font in the embodiment of the present invention, first, each original contour of the Truetype font is obtained, where each original contour includes a straight line and a quadratic bezier curve that are joined end to end; sequentially connecting the end point of each section of straight line in each original contour with three control points of each quadratic Bezier curve to generate a control polygon; calculating the normal of each straight line segment of the control polygon, and calculating the normal of each vertex of the control polygon according to the normal of each straight line segment of the control polygon; along the normal direction of each vertex of the control polygon, controlling each vertex to gradually move towards the inside of the original contour so as to enable the control polygon to be retracted; in the process of controlling the polygon to contract inwards, detecting whether collision occurs between vertexes of the control polygon and between the straight line segments, and controlling the vertexes with collision and the straight line segments with collision to stop moving; sampling each section of straight line and each secondary Bezier curve in the original outline and each section of straight line and each secondary Bezier curve in the shrunk outline respectively to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh, thereby realizing the purpose of avoiding the triangular mesh intercrossing of the oblique angle in the process of three-dimensional conversion of the two-dimensional font and improving the sensory effect of the finally generated 3D font.
In order to implement the foregoing embodiment, an embodiment of the present invention further provides a computer-readable storage medium on which an oblique angle generating program of a 3D font is stored, where the oblique angle generating program of the 3D font realizes the oblique angle generating method of the 3D font as described above when being executed by a processor.
According to the computer readable storage medium of the embodiment of the invention, the oblique angle generating program of the 3D font is stored, so that when being executed by the processor, the oblique angle generating program of the 3D font realizes the oblique angle generating method of the 3D font, thereby realizing the purpose of avoiding triangular meshes of oblique angles from intersecting with each other in the process of three-dimensional conversion of the two-dimensional font, and improving the sensory effect of the finally generated 3D font.
In order to implement the foregoing embodiments, an embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the processor implements the oblique angle generation method for a 3D font as described above.
According to the computer equipment provided by the embodiment of the invention, the processor executes the oblique angle generation method of the 3D font, so that the triangular meshes of oblique angles are prevented from being intersected in the three-dimensional conversion process of the two-dimensional font, and the sensory effect of the finally generated 3D font is improved.
In order to implement the foregoing embodiment, as shown in fig. 7, an embodiment of the present invention further provides an oblique angle generating device for a 3D font, including: the device comprises an acquisition module 10, a first generation module 20, a calculation module 30, a control module 40 and a second generation module 50.
The obtaining module 10 is configured to obtain each original contour of the Truetype font, where each original contour includes a straight line and a quadratic bezier curve that are joined end to end;
the first generating module 20 is configured to sequentially connect an end point of each straight line in each original contour and three control points of each quadratic bezier curve to generate a control polygon;
the calculation module 30 is configured to calculate a normal of each straight-line segment of the control polygon, and calculate a normal of each vertex of the control polygon according to the normal of each straight-line segment of the control polygon;
the control module 40 is configured to control each vertex to move gradually towards the inside of the original contour along a normal direction of each vertex of the control polygon, so as to perform retraction on the control polygon, detect whether a collision occurs between the vertices and between the straight line segments of the control polygon during the process of performing retraction on the control polygon, and control the vertices and the straight line segments which have the collision to stop moving;
the second generating module 50 is configured to sample each segment of straight line and each quadratic bezier curve in the original contour and each segment of straight line and each quadratic bezier curve in the retracted contour to generate a triangulated mesh, and generate an oblique angle according to the triangulated mesh.
In some embodiments, the original contour follows the polygon during the control of the polygon to perform the inner-reduction.
In some embodiments, each straight line and each quadratic bezier curve in the original profile are sampled in the same manner as each straight line and each quadratic bezier curve in the retracted profile, so that the sampling points on the original profile are the same as and in one-to-one correspondence with the sampling points on the retracted profile.
In some embodiments, the second generating module 50 is further configured to form two triangles by two adjacent sampling points on the original contour and two corresponding adjacent sampling points on the retracted contour, so as to generate the triangulated mesh.
It should be noted that the above description about the oblique angle generating method for the 3D font in fig. 1 is also applicable to the oblique angle generating apparatus for the 3D font, and is not repeated herein.
In summary, according to the oblique angle generating device for the 3D font in the embodiment of the present invention, each original contour of the Truetype font is obtained by the obtaining module, where each original contour includes a straight line and a quadratic bezier curve that are connected end to end; after each original contour of the Truetype font is obtained, sequentially connecting an end point of each straight line in each original contour and three control points of each quadratic Bezier curve through a first generation module to generate a control polygon; the normal of each straight line segment of the polygon is controlled by the computing module to be computed, and the normal of each vertex of the control polygon is computed according to the normal of each straight line segment of the control polygon; after the calculation is finished, controlling each vertex to move gradually towards the inside of the original contour through a control module along the normal direction of each vertex of the control polygon so as to enable the control polygon to carry out retraction, detecting whether collision occurs between the vertexes of the control polygon and between the straight line segments in the process of controlling the polygon to carry out retraction, and controlling the vertexes which collide and the straight line segments which collide to stop moving; after the inner contraction is finished, sampling each section of straight line and each secondary Bezier curve in the original contour and each section of straight line and each secondary Bezier curve in the inner contracted contour respectively through a second generation module to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh; therefore, the triangular meshes at the oblique angles are prevented from being mutually crossed in the three-dimensional conversion process of the two-dimensional font, and the sensory effect of the finally generated 3D font is improved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
In the description of the present invention, it is to be understood that the terms "first", "second" and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any 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 description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
In the present invention, unless otherwise expressly stated 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 formed; can be mechanically or electrically connected; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood according to specific situations by those of ordinary skill in the art.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the terminology used in the description presented above should not be understood as necessarily referring to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are exemplary and not to be construed as limiting the present invention, and that changes, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
Claims (10)
1. A3D font oblique angle generation method is characterized by comprising the following steps:
acquiring each original contour of the Truetype font, wherein each original contour comprises a straight line and a quadratic Bezier curve which are connected end to end;
sequentially connecting the end point of each section of straight line in each original contour with three control points of each quadratic Bezier curve to generate a control polygon;
calculating the normal of each straight-line segment of the control polygon, and calculating the normal of each vertex of the control polygon according to the normal of each straight-line segment of the control polygon;
along the normal direction of each vertex of the control polygon, controlling each vertex to gradually move towards the inside of the original contour so as to enable the control polygon to be retracted;
detecting whether collision occurs between vertexes of the control polygon and between the straight line segments in the process of retracting the control polygon, and controlling the vertexes with collision and the straight line segments with collision to stop moving;
sampling each section of straight line and each secondary Bezier curve in the original contour and each section of straight line and each secondary Bezier curve in the retracted contour respectively to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh.
2. The method for generating an oblique angle of a 3D font according to claim 1, wherein the original outline is followed by the inner shrinkage during the inner shrinkage of the control polygon.
3. The oblique angle generation method for 3D font according to claim 1 or 2, characterized in that each straight line and each quadratic bezier curve in the original contour are sampled in the same way as each straight line and each quadratic bezier curve in the retracted contour, so that the sampling points on the original contour are the same and in one-to-one correspondence with the sampling points on the retracted contour.
4. The oblique angle generation method for 3D font according to claim 3, characterized in that two adjacent sampling points on the original contour and two corresponding adjacent sampling points on the retracted contour are formed into two triangles to generate the triangulated mesh.
5. A computer-readable storage medium, on which an oblique angle generation program for a 3D font is stored, the oblique angle generation program for the 3D font, when executed by a processor, implementing the oblique angle generation method for the 3D font according to any one of claims 1 to 4.
6. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the oblique angle generation method for a 3D font according to any one of claims 1 to 4.
7. An apparatus for generating an oblique angle of a 3D font, comprising:
the acquiring module is used for acquiring each original contour of the Truetype font, wherein each original contour comprises a straight line and a quadratic Bezier curve which are connected end to end;
the first generation module is used for sequentially connecting the end point of each section of straight line in each original contour with three control points of each quadratic Bezier curve to generate a control polygon;
the calculation module is used for calculating the normal of each straight line segment of the control polygon and calculating the normal of each vertex of the control polygon according to the normal of each straight line segment of the control polygon;
the control module is used for controlling each vertex to gradually move towards the inside of the original contour along the normal direction of each vertex of the control polygon so as to enable the control polygon to carry out retraction, detecting whether collision occurs between the vertexes of the control polygon and between the straight line segments in the process of carrying out retraction on the control polygon, and controlling the vertexes which collide and the straight line segments which collide to stop moving;
and the second generation module is used for respectively sampling each section of straight line and each secondary Bezier curve in the original contour and each section of straight line and each secondary Bezier curve in the retracted contour to generate a triangulated mesh, and generating an oblique angle according to the triangulated mesh.
8. The apparatus for generating oblique angles of 3D font according to claim 7, wherein said original outline is followed by an in-draw during an in-draw of said control polygons.
9. The apparatus for generating oblique angles of 3D font according to claim 7 or 8, characterized in that each straight line and each quadratic bezier curve in the original outline are sampled in the same way as each straight line and each quadratic bezier curve in the retracted outline, so that the sampling points on the original outline are the same and in one-to-one correspondence with the sampling points on the retracted outline.
10. The apparatus for generating oblique angles of 3D font according to claim 9, wherein the second generating module is further configured to construct two triangles from two adjacent sampling points on the original outline and two corresponding adjacent sampling points on the retracted outline to generate the triangulated mesh.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910376972.3A CN110111425B (en) | 2019-05-07 | 2019-05-07 | 3D font oblique angle generation method, medium, device and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910376972.3A CN110111425B (en) | 2019-05-07 | 2019-05-07 | 3D font oblique angle generation method, medium, device and apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110111425A CN110111425A (en) | 2019-08-09 |
CN110111425B true CN110111425B (en) | 2023-02-24 |
Family
ID=67488671
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910376972.3A Active CN110111425B (en) | 2019-05-07 | 2019-05-07 | 3D font oblique angle generation method, medium, device and apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110111425B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111444673B (en) * | 2020-03-09 | 2022-07-19 | 稿定(厦门)科技有限公司 | Character bending deformation method, medium, equipment and device |
CN111444675B (en) * | 2020-03-12 | 2022-08-16 | 稿定(厦门)科技有限公司 | Character round angle processing method, medium, equipment and device |
CN111651959B (en) * | 2020-04-17 | 2023-02-28 | 福建天泉教育科技有限公司 | Method and terminal for realizing 3D font |
CN113706709A (en) * | 2021-08-10 | 2021-11-26 | 深圳市慧鲤科技有限公司 | Text special effect generation method, related device, equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101764943A (en) * | 2008-11-04 | 2010-06-30 | 新奥特(北京)视频技术有限公司 | Method for dividing quadratic Bezier curve in subtitle object vector outline by intersection points |
CN107767439A (en) * | 2017-08-24 | 2018-03-06 | 宁波大学 | The generation method of three-dimensional metal advertisement word model |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7212205B2 (en) * | 2002-11-12 | 2007-05-01 | Matsushita Electric Industrial Co., Ltd. | Curved surface image processing apparatus and curved surface image processing method |
-
2019
- 2019-05-07 CN CN201910376972.3A patent/CN110111425B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101764943A (en) * | 2008-11-04 | 2010-06-30 | 新奥特(北京)视频技术有限公司 | Method for dividing quadratic Bezier curve in subtitle object vector outline by intersection points |
CN107767439A (en) * | 2017-08-24 | 2018-03-06 | 宁波大学 | The generation method of three-dimensional metal advertisement word model |
Non-Patent Citations (2)
Title |
---|
局部包络片控制误差简化三角网格模型;邹北骥等;《电子学报》;20050525(第05期);全文 * |
让你的字更COOL;软件世界;《软件世界》;19990601(第06期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110111425A (en) | 2019-08-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110111425B (en) | 3D font oblique angle generation method, medium, device and apparatus | |
CN101894176B (en) | Method for reconstructing a distance field of a swept volume at a sample point | |
OuYang et al. | On the normal vector estimation for point cloud data from smooth surfaces | |
US9342924B2 (en) | Conservative cell and portal graph generation | |
Xian et al. | Automatic cage generation by improved obbs for mesh deformation | |
CN111581776B (en) | Iso-geometric analysis method based on geometric reconstruction model | |
CN109615702B (en) | Grid hole filling method, image processing equipment and device with storage function | |
JP2007523402A (en) | Mesh model with internal individual elements | |
JP5916758B2 (en) | Direct rendering of CAD models on GPU | |
CN104851126A (en) | Three-dimensional model decomposition method and three-dimensional model decomposition device based on generalized cylinder | |
Holdstein et al. | Three-dimensional surface reconstruction using meshing growing neural gas (MGNG) | |
CN106875487B (en) | Geological hexahedral mesh smoothing method based on neighborhood acting force | |
CN114593699A (en) | Structure size measurement method based on reconstruction model spiral line | |
Yingjie et al. | Adaptive tool-path generation on point-sampled surfaces | |
Lee | Automatic metric 3D surface mesh generation using subdivision surface geometrical model. Part 1: Construction of underlying geometrical model | |
Campagna et al. | Parameterizing meshes with arbitrary topology | |
CN113902887A (en) | Three-dimensional visual edge generation method, system, computer and readable storage medium | |
DalleMole et al. | The self-organizing approach for surface reconstruction from unstructured point clouds | |
CN112632675A (en) | Building structure reverse axis modeling method | |
Aubry et al. | Singularities in parametric meshing | |
JP4949953B2 (en) | Method for calculating distance between curved surface shape and reference surface | |
CN107330977B (en) | Shepard interpolation-based root-number three-subdivision airship envelope curved surface reconstruction method | |
Marković et al. | Recognition of One Class of Surfaces From Structured Point Cloud. | |
Jinnouchi et al. | Efficient 3D crease point extraction from 2D crease pixels of sinogram | |
Dinas et al. | Bounding Volume Hierarchies for Rigid Bodies. |
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 | ||
CB02 | Change of applicant information |
Address after: 361000 G02, 3rd floor, No.10, Punan 1st Road, Dongpu Road, Siming District, Xiamen City, Fujian Province Applicant after: Xiamen draft Co.,Ltd. Address before: 361000 G02, 3rd floor, No.10, Punan 1st Road, Dongpu Road, Siming District, Xiamen City, Fujian Province Applicant before: XIAMEN HUANLEGUANG TECHNOLOGY Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |