A template-based cartoon shot script fast generation method
By constructing a virtual boundary data table and a system total energy function, the vertex coordinates of the storyboard polygons are optimized, solving the problems of boundary overlap and abrupt scene transitions when adjusting storyboard polygons in existing technologies, and achieving standardized primitive layout and smooth scene transitions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JINAN YIZHU GUANGNIAN ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
- Filing Date
- 2026-04-23
- Publication Date
- 2026-07-14
AI Technical Summary
Existing comic drawing software lacks spatial correlation and global constraints when adjusting polygons in storyboards, resulting in problems such as overlapping boundaries, polygon geometric distortion, and abrupt scene transitions.
A virtual boundary data table and a system total energy function are constructed. By calculating Euclidean distance, local stiffness coefficient, and global line-of-sight vector field data, the vertex coordinates of the storyboard polygon are optimized to achieve constraints on primitive spacing, reading line-of-sight guidance, and interior angles.
It avoids the geometric boundary overlap and internal angle self-intersection deformation of the storyboard polygons, outputs primitive coordinates that conform to the typesetting specifications, improves the continuity and adaptability of the typesetting, and reduces abrupt changes in screen transitions.
Smart Images

Figure CN122391408A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, specifically to a template-based method for rapid generation of comic storyboards. Background Technology
[0002] Comic panels are the graphic frameworks that guide the reading order in digital comics. Existing comic drawing software usually has built-in preset panel templates for operators to use. During the layout process, operators need to move and resize the polygons in the panel templates according to the content of the picture.
[0003] Current adjustment methods primarily rely on geometric scaling or coordinate translation of individual primitives. These methods treat each storyboard polygon as an independent graphic object, failing to establish spatial relationships between primitives. When an operator drags or modifies a storyboard polygon, adjacent polygons cannot adjust their shapes to follow spatial changes on the interface, easily leading to overlapping of adjacent boundary lines or gaps between primitives that do not conform to layout specifications. To correct these problems, operators need to manually intervene and verify the vertex coordinates of adjacent polygons, increasing the layout process.
[0004] Meanwhile, existing graphic layout mechanisms lack constraints on polygon geometry and the flow of the reader's gaze. When layout space is limited or primitives are densely distributed, adjustments to storyboard polygons can easily result in polygonal line segment intersections and reversals, or deformations with excessively large or small interior angles. Furthermore, the generated interface layout can easily deviate from the normal visual guidance direction, causing confusion in the reading flow. In addition, conventional software typically refreshes interface primitives to their final calculated positions when updating layout coordinates, without providing a transition between layout coordinates before and after interaction, resulting in abrupt visual feedback when switching layout states. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a template-based method for rapid generation of comic storyboards, which solves the technical problems of boundary overlap, polygonal geometric distortion, and abrupt scene transitions caused by the lack of spatial relationships and global constraints between graphic elements when adjusting the layout of comic storyboards.
[0006] To achieve the above objectives, the present invention provides the following technical solution: This invention provides a template-based method for rapid generation of comic storyboards, comprising the following steps: Parse the predefined storyboard template to obtain the set of anchor point coordinates and the set of vertex coordinates of the storyboard polygon; Based on the vertex coordinate set, the boundary line segments of the storyboard polygon are extracted and a half-side data structure is constructed. Adjacent half-side pairs whose absolute spatial distance meets the preset distance threshold are selected and a virtual boundary data table is constructed. The preset distance threshold is set according to the layout baseline spacing. Calculate the Euclidean distance from the center point of half of the data structure to the set of coordinates of the anchor points of interest, and calculate the corresponding local stiffness coefficient. Obtain global view vector field data, and construct the system total energy function based on virtual boundary data table, local stiffness coefficient, global view vector field data, and interior angle values of the segmentation polygon calculated based on vertex coordinate set; Calculate the partial derivative of the total energy function of the system with respect to the set of vertex coordinates, update the set of vertex coordinates, and obtain the set of vertex coordinates that satisfy the convergence condition for the minimum value. The graph data is generated based on the set of minimum vertex coordinates, and the resulting storyboard graphics are output on the screen through the graphics display unit.
[0007] In one optional implementation, parsing a predefined storyboard template to obtain a set of anchor point coordinates and a set of vertex coordinates for the storyboard polygon includes: receiving a drag command signal, calling the predefined storyboard template, loading the data structure of the predefined storyboard template into the global coordinate system of the 2D canvas, and parsing the metadata file of the predefined storyboard template; traversing the hierarchy tree of the metadata set of the predefined storyboard template and detecting whether it contains anchor point data nodes; when anchor point data nodes are included, reading the character content of the attribute fields in the anchor point data nodes and instantiating them into anchor point objects of interest, and combining all anchor point objects of interest to form the initial anchor point. Anchor point coordinate set; when no anchor point data nodes are included, calculate the geometric center coordinates of the storyboard polygon plane, use the geometric center coordinates as the default anchor point coordinates, and incorporate the geometric center coordinates into the initial anchor point coordinate set; extract the local vertex coordinate sequence of the predefined storyboard template, construct a two-dimensional affine transformation matrix based on the canvas screen coordinates corresponding to the drag command signal release position and the current view scaling ratio of the system, use the two-dimensional affine transformation matrix to map the initial anchor point coordinate set and the local vertex coordinate sequence to the two-dimensional canvas global coordinate system, and output the anchor point coordinate set and vertex coordinate set.
[0008] In one optional implementation, the boundary segments of the storyboard polygons are extracted based on the vertex coordinate set, and a half-edge data structure is constructed. Adjacent half-edge pairs whose absolute spatial distance meets a preset distance threshold are filtered, and a virtual boundary data table is constructed. This includes: converting the boundary segments into a half-edge data structure, configuring the underlying pointers in the half-edge data structure, and establishing topological associations between vertices, unidirectional half-edges, and polygon faces; extracting any two half-edges belonging to different storyboard polygon face objects from the half-edge data structure, and calculating the dot product of the unit outward normal vectors corresponding to the two half-edges; eliminating half-edge pairs with the same or mutually perpendicular directions based on the dot product value; determining that the two half-edges face each other when the dot product value is less than a set angle judgment threshold; calculating the absolute spatial distance between the center points of the two half-edges facing each other; determining that they constitute an adjacent boundary relationship when the absolute spatial distance is less than a preset distance threshold; establishing a bidirectional pointer link across the polygon for the two half-edges that constitute an adjacent boundary relationship, and appending the pointer references of the adjacent half-edge pairs and the calculated absolute spatial distance value as an independent data record item to the virtual boundary data table.
[0009] In one optional implementation, the Euclidean distance from the center point of the current half of the data structure to the set of anchor points of interest is calculated, and the corresponding local stiffness coefficient is calculated. This includes: calculating the Euclidean distance from the center point of the current half to each anchor point of interest in the set of anchor points of interest, and extracting the Euclidean distance with the smallest value as the final distance parameter of the current half; using a Gaussian decay model, the local stiffness coefficient of the current half is calculated based on the basic stiffness constant, the influence weight coefficient, the base of the natural logarithm, the final distance parameter, and the decay control parameter, so that the value of the local stiffness coefficient is negatively correlated with the final distance parameter. Establishing a negative correlation calculation mechanism between local stiffness and anchor point distance ensures that the boundaries of the storyboard near the visual focus have strong anti-deformation constraints, prioritizing the preservation of the display area of core content during layout compression.
[0010] In one optional implementation, the system's total energy function is constructed based on a virtual boundary data table, local stiffness coefficients, global view vector field data, and interior angle values of the storyboard polygons calculated based on vertex coordinate sets. This includes: reading the local stiffness coefficients corresponding to each pair of adjacent half-sides in the virtual boundary data table; using the arithmetic mean of the local stiffness coefficients of each pair of adjacent half-sides as the equivalent elastic coefficient of the virtual boundary; using the difference between the absolute spatial distance between adjacent half-sides and the set target layout spacing as the deformation variable; and accumulating the deformation potential energy of all virtual boundaries to form a spacing energy term that measures the global layout gap deviation; and calculating the geometric center coordinates of the previous storyboard polygon, extracted from the vertex coordinate set and arranged according to the set reading order, pointing towards the next storyboard polygon. The cosine similarity between the actual reading flow vector formed by the center coordinates and the reference line-of-sight vector in the global line-of-sight vector field data is used to accumulate the flow deviation of all adjacent segmentation polygon pairs to construct the flow energy term. Based on the half-side data structure, adjacent directed half-side pairs sharing the same vertex are extracted. The coordinate data of adjacent directed half-side pairs are read to calculate the interior angle values of the segmentation polygons. The difference between the interior angle values of the segmentation polygons and the set limit angles is logarithmically calculated and a negative sign is added to construct the anti-self-intersection interior angle logarithmic barrier energy term. The spacing energy term, flow energy term, and anti-self-intersection interior angle logarithmic barrier energy term are multiplied by the corresponding set spacing energy weight coefficient, set flow energy weight coefficient, and set anti-self-intersection energy weight coefficient, respectively, and then linearly summed to construct the system total energy function. In this process, the spacing energy term is used to maintain the gaps between polygons, the flow energy term applies an energy penalty to layouts that violate the reading order, and the anti-self-intersection interior angle logarithmic barrier energy term utilizes the mathematical property that the function value of the logarithmic function tends to infinity when the independent variable approaches the limit position to build an energy barrier when the interior angles of the polygon approach the self-intersection state, preventing the vertices from undergoing topological flips.
[0011] In one optional implementation, the partial derivative of the system's total energy function with respect to the vertex coordinate set is calculated, and the vertex coordinate set is updated. This includes: extracting the x and y coordinates of all vertices in the vertex coordinate set in memory read order and concatenating them into a one-dimensional global state vector; calculating the Jacobian partial derivative matrix of the system's total energy function with respect to all vertex coordinate components in the global state vector, obtaining the gradient descent direction vector guiding vertex movement, using the conjugate gradient method to perform tentative position updates along the gradient descent direction vector, calculating the tentative coordinate set, and calculating the tentative probability of all polygonal face objects under the tentative coordinate set. For each tentative interior angle, compare it with the defined legal interior angle opening interval. If the radian value of any tentative interior angle exceeds the defined legal interior angle opening interval, apply a defined attenuation coefficient to the search step size parameter of the current iteration to proportionally reduce the set of tentative coordinates and recalculate. When all tentative interior angles are within the defined legal interior angle opening interval and the total energy function of the system satisfies the sufficient descent condition, determine the search step size parameter of the current iteration as the optimal movement step size for the current iteration step. Update the global state vector based on the optimal movement step size, and then update the vertex coordinate set. A line search mechanism using interior angle truncation and step size attenuation is adopted to verify geometric legality in real time during iteration, ensuring that vertex coordinate updates do not lead to polygon self-intersection and overlap. Combined with the sufficient descent condition, this ensures stable convergence of the energy function.
[0012] In one optional implementation, obtaining the set of coordinates of the minimum vertex that satisfies the convergence condition includes determining whether to terminate the iterative calculation using multiple convergence criteria: when the Euclidean norm of the partial derivative gradient vector of the system's total energy function is less than or equal to a set gradient convergence tolerance threshold, the energy minimization process is determined to have converged and the set of coordinates of the minimum vertex is obtained, where the set gradient convergence tolerance threshold is the limiting norm for determining the convergence of the partial derivative gradient vector; or when the absolute change in the value of the system's total energy function before and after this iteration is less than a set energy change tolerance threshold, the energy minimization process is determined to have converged and the set of coordinates of the minimum vertex is obtained, where the set energy change tolerance threshold is the benchmark difference for determining the convergence of energy change; or when the cumulative number of iterations reaches a set maximum number of iterations, a forced termination determination is triggered and the set of coordinates of the minimum vertex is obtained.
[0013] In one optional implementation, before calculating the partial derivative of the total system energy function with respect to the vertex coordinate set, a stiffness degradation strategy under congestion conditions is further included. This includes: calculating and summing the geometric areas of all storyboard polygons as the total global primitive area; dividing the total global primitive area by the total physically available area of the canvas to generate a global congestion index; comparing the global congestion index with a set congestion judgment threshold; and calculating a stiffness degradation coefficient when the global congestion index is greater than or equal to the set congestion judgment threshold, where the set congestion judgment threshold is the baseline congestion ratio that triggers the stiffness degradation strategy; multiplying the stiffness degradation coefficient by the spacing energy weight coefficient corresponding to the spacing energy term to generate an updated spacing energy weight coefficient, which is then substituted into the total system energy function for recalculation, thus relaxing the strictness of the spacing constraints. When global congestion is caused by insufficient available canvas space, the influence weight of the spacing energy term is dynamically reduced to avoid the iterative algorithm falling into an oscillating state due to space constraints and to maintain the stability of the solution process.
[0014] In one optional implementation, generating graph data based on the set of minimum vertex coordinates includes: overwriting the set of minimum vertex coordinates back into the half-side data structure; generating graph data required for the image rendering pipeline based on the new vertex coordinate relationships; obtaining the vertex coordinate set before the update as the global state vector of the initial layout state, and storing the set of minimum vertex coordinates as the global state vector of the target layout state; calculating normalized time parameters based on the current physical time and the set animation transition duration parameters, and processing the normalized time parameters using a nonlinear smoothing function to generate smooth interpolation weight coefficients.
[0015] In one optional implementation, the layout-generated storyboard graphics are output on the screen via a graphics display unit, including: using a smooth interpolation weighting coefficient to weight and fuse the global state vector of the initial layout state and the global state vector of the target layout state to calculate and generate the global state vector of the current rendering frame; reading the vertex coordinate data of each polygon contained in the global state vector of the current rendering frame, driving the rendering engine to redraw and output the storyboard polygons in the two-dimensional canvas until the normalized time parameter reaches a set value, thus completing the smooth switching of the layout state.
[0016] This invention provides a template-based method for rapid generation of comic storyboards. It offers the following advantages: 1. This invention constructs a system total energy function comprising a spacing energy term, a flow direction energy term, and a logarithmic barrier energy term for preventing self-intersection of interior angles, and solves it by minimizing the vertex coordinate set as a variable. In this way, when updating the vertex coordinates of polygons, constraints such as primitive spacing, reading gaze direction, and polygon interior angles can be processed simultaneously, preventing geometric boundary overlap or interior angle self-intersection deformation in the generated comic panel layout, and outputting primitive coordinates that conform to layout specifications. 2. This invention constructs a virtual boundary data table by extracting the boundary segments of adjacent polygons and introduces a stiffness degradation strategy under congestion conditions during the minimization process. When the calculated global congestion index reaches the congestion judgment threshold, the system adjusts the spacing energy weight coefficient through the stiffness degradation coefficient, relaxes the spacing constraints when primitives are densely arranged, avoids the morphological deformation of primitives due to space constraints, and improves the method's adaptability to different space occupancy rates. 3. When outputting the layout screen, this invention acquires the global state vectors before and after the layout state update, and calculates the normalized time parameter and smooth interpolation weight coefficient based on the set transition duration. The rendering engine performs weighted fusion calculation on the vectors of the initial and target states using the smooth interpolation weight coefficient, and generates the coordinate data of the current rendering frame according to the time parameter. This ensures that the storyboard polygons produce a smooth screen transition when updating their coordinate positions, avoiding abrupt screen changes during the layout state switching process. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the method flow of the present invention; Figure 2 This is a schematic diagram of the hardware architecture of the electronic device of the present invention; Figure 3 The following is a comparison chart of the typesetting evaluation indicators of the present invention, wherein (a) is a comparison chart of typesetting evaluation indicators; and (b) is a comparison chart of line-of-sight flow field fit. Figure 4 This is a comparison diagram of the line-of-sight flow field fit of the present invention. Detailed Implementation
[0018] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] Please see the appendix Figure 2 This invention provides a template-based comic storyboard rapid generation system, comprising: The instantiation module is used to parse predefined storyboard templates and obtain the set of coordinates of the anchor points of interest and the set of vertex coordinates of the storyboard polygons; The topology transformation module is used to extract the boundary line segments of the storyboard polygons based on the vertex coordinate set and construct a half-side data structure. It filters adjacent half-side pairs whose absolute spatial distance meets the preset distance threshold and constructs a virtual boundary data table. The preset distance threshold is set according to the layout baseline spacing. The stiffness mapping module is used to calculate the Euclidean distance from the center point of half of the data structure to the set of coordinates of the anchor points of interest, and to calculate the corresponding local stiffness coefficient. The energy construction module is used to acquire global line-of-sight vector field data and construct the system's total energy function based on the virtual boundary data table, local stiffness coefficients, global line-of-sight vector field data, and interior angle values of the storyboard polygon calculated based on vertex coordinate sets. The minimization solution module is used to calculate the partial derivative of the total energy function of the system with respect to the vertex coordinate set, update the vertex coordinate set, and obtain the minimum vertex coordinate set that satisfies the convergence condition. The rendering output module is used to generate graph data based on the set of minimum vertex coordinates, and output the generated storyboard graphics on the screen through the graphics display unit.
[0020] Please see the appendix Figure 1 This invention provides a template-based method for rapid generation of comic storyboards, comprising the following steps: S1, the instantiation module receives the drag command signal sent by the input device, calls the predefined storyboard template from the memory, loads the data structure of the predefined storyboard template into the two-dimensional canvas coordinate system, parses the metadata file of the predefined storyboard template, extracts the set of attention anchor point coordinates recorded in the file, and sends the vertex coordinate set and attention anchor point coordinate set of the predefined storyboard template to the topology transformation module and the stiffness mapping module. S2, the topology transformation module receives the vertex coordinate set output by the instantiation module, converts the boundary line segments of the storyboard polygon into half-edge data structures, configures the underlying pointers in the half-edge data structures, establishes the topological association between vertices, unidirectional half-edges and their respective polygon faces, traverses the storyboard polygons in the current two-dimensional canvas coordinate system, calculates the absolute spatial distance between different polygon half-edges, extracts adjacent half-edge pairs with distance values lower than a preset distance threshold, constructs a virtual boundary data table, and stores the virtual boundary data table in memory; S3, the stiffness mapping module obtains the set of coordinates of the anchor points of interest output by the instantiation module, reads the half-side data structure generated by the topology transformation module, calculates the Euclidean distance from the center point of each half-side to the anchor points of interest, calculates the corresponding local stiffness coefficient according to the distance decay algorithm, and writes the local stiffness coefficient as a physical property parameter into the data structure of the corresponding half-side. S4, the energy construction module reads the pre-stored global line-of-sight vector field data, obtains the virtual boundary data table output by the topology transformation module and the local stiffness coefficients calculated by the stiffness mapping module, uses the vertex coordinates in the half-side data structure as independent variables, establishes the spacing energy term representing the virtual boundary distance constraint based on the local stiffness coefficients, calculates the dot product of the unit outward normal vector of each half-side and the corresponding position line-of-sight vector field vector, establishes the flow direction energy term representing the layout tilt constraint, extracts the interior angle values of the included angle between adjacent half-sides inside the polygon, establishes the logarithmic barrier energy term representing the anti-self-intersection constraint, and adds the spacing energy term, flow direction energy term and logarithmic barrier energy term according to the weight coefficients to construct the total energy function of the system; S5, the minimization solution module reads the total system energy function established by the energy construction module, calculates the Jacobian partial derivative matrix of the total system energy function with respect to all vertex coordinate components, calculates the gradient descent search direction, uses the conjugate gradient method to carry out iterative calculation, detects the interior angle values of the polygon formed by the candidate coordinates during the iteration process, performs truncation line search calculation to update the step size, obtains the set of minimum vertex coordinates that makes the total system energy function satisfy the convergence condition, and overwrites the set of minimum vertex coordinates back to the half-side data structure; S6, the rendering output module reads the updated half-side data structure from the minimization solution module, generates the image data required by the image rendering pipeline based on the new vertex coordinate relationship, and outputs the layout-generated storyboard graphics on the screen through the graphics display unit.
[0021] In the above method for dynamically generating comic storyboards, the data loading and parsing process performed by the instantiation module includes the following steps.
[0022] The instantiation module receives drag-and-drop command signals generated by the input device and obtains the storage identifier of the predefined storyboard template specified by the drag-and-drop operation. The storage identifier includes the physical path address of the template in the local file system or the Uniform Resource Locator in a remote database.
[0023] The instantiation module reads the corresponding template file from the computing device's memory based on the storage identifier, and parses the template file to extract the basic data structure of the predefined storyboard template. The basic data structure of the predefined storyboard template includes the local vertex coordinate sequence of the storyboard primitive outline and the metadata set of that primitive outline. The template file is stored in a text markup language format, a lightweight data exchange format, or a custom binary sequence format. The text markup language format includes Extensible Markup Language (XML) format, and the lightweight data exchange format includes JavaScript object notation format.
[0024] For data parsing operations in Extensible Markup Language (Extreme Markup Language) format or JavaScript object spectral format, those skilled in the art can call standard text parsing libraries to traverse the data object model tree and read node fields. The specific execution mechanism is a well-known technology in the field and will not be elaborated here.
[0025] The instantiation module iterates through the metadata set in the basic data structure of the predefined storyboard template, extracting the set of attention anchor point coordinates recorded within the metadata set. The metadata set stores physical constraint attribute information unrelated to polygon geometry rendering. The attention anchor point coordinate data represents the geometric center position of the core composition area within the storyboard template. This set of attention anchor point coordinates is generated by the template creator through manual selection of coordinates via an interactive interface before the predefined storyboard template is added to the database, or by calculating the center point coordinates of high-frequency pixel areas within the predefined storyboard template frame using an image feature extraction algorithm, and is pre-written into the template file's data object as an independent field.
[0026] The instantiation module extracts the canvas screen coordinates corresponding to the drag command signal release position and constructs a two-dimensional affine transformation matrix based on the canvas screen coordinates and the current view scaling ratio of the system. Since the predefined storyboard templates are created using an internal local coordinate system independent of the system's runtime environment for size definition, and the current system's two-dimensional canvas has corresponding screen scaling states and drag landing point offsets, the system needs to uniformly transform the internal coordinates of the predefined storyboard templates to the current canvas's global coordinate system to complete the positioning and matching process of the primitive outline entities in the canvas display space.
[0027] The instantiation module uses a two-dimensional affine transformation matrix to perform matrix multiplication on the local vertex coordinate sequence and the set of anchor point coordinates, mapping all local coordinates to the system's two-dimensional canvas global coordinate system. The core formula for mapping local coordinates to the global coordinate system is expressed as follows: ; In the formula, Represents the x-coordinate of the target after setting the global coordinate system of the two-dimensional canvas; Represents the target's ordinate in the global coordinate system of the two-dimensional canvas; Represents the local x-coordinate recorded in the predefined storyboard template data structure; Represents the local ordinate recorded in the predefined storyboard template data structure; The horizontal scaling factor of the canvas coordinate system, which is a real number with a value greater than 0; Represents the vertical scaling factor of the canvas coordinate system, and takes the value of a real number greater than 0; This represents the horizontal translation offset in the global coordinate system. This represents the vertical translation offset in the global coordinate system.
[0028] After the instantiation module completes the above matrix operations, it outputs the set of vertex coordinates and the set of anchor point coordinates that have completed the global mapping, thus completing the preparation of instantiation data.
[0029] During the data processing of the predefined storyboard template instantiation, the instantiation module defines and extracts the anchor points of interest.
[0030] Anchor points are spatial coordinate points defined in a two-dimensional coordinate system, used to characterize the internal core composition area of a predefined storyboard template. These internal core composition areas correspond to densely packed image features in the comic strip that should not be cropped during layout. In the system's underlying numerical calculation process, anchor points serve as distance references, determining the physical deformation resistance of adjacent polygon boundaries. The system evaluates the deformation redundancy of different boundaries by calculating the spatial distance between each boundary and the anchor point. Boundaries closer to the anchor point have stronger deformation resistance, thus maintaining the stability of the graphic structure near that area during layout adjustments.
[0031] The metadata collection of the predefined storyboard template contains anchor data nodes. These anchor data nodes are configured with attribute fields, including local x-coordinate values, local y-coordinate values, and influence weight coefficients. The influence weight coefficient represents the weight percentage of the corresponding anchor point in the subsequent local stiffness coefficient calculation; its value is set to a real number > 0 and ≤ 1. The instantiation module traverses the hierarchy of the metadata collection in memory, locates the corresponding anchor data node, and reads the character content of the attribute fields. The instantiation module converts the read string-formatted values into floating-point values and instantiates focus anchor objects in memory based on the converted values. All focus anchor objects are combined to form the initial focus anchor coordinate set.
[0032] For the type conversion process from string format to floating-point data format, those skilled in the art can call the standard type conversion function component in the programming environment to perform the conversion of memory data structure. The underlying conversion mechanism is a well-known technology in the field and will not be described in detail here.
[0033] The instantiation module performs data integrity checks when parsing the metadata collection. It checks whether the predefined storyboard template contains anchor data nodes with compliant formats. If it determines that the metadata collection does not record anchor data nodes, the instantiation module triggers the default anchor generation logic.
[0034] In the default anchor point generation logic, the instantiation module reads the local vertex coordinate sequence from the basic data structure of the predefined storyboard template. The instantiation module extracts the coordinate values of each vertex and calculates the geometric center coordinates of the polygonal plane of the storyboard. The instantiation module uses the calculated geometric center coordinates as the default anchor point coordinates and adds them to the initial anchor point coordinate set. For predefined storyboard templates without specified anchor points, the system assumes that the visual balance center of its composition is located at the geometric center of the polygon. This geometric center position is obtained by performing an arithmetic average of the coordinates of all vertices to ensure that subsequent stiffness calculations have valid input data for reference. The formula for calculating the geometric center of the default anchor point coordinates is as follows: ; ; In the formula, This represents the x-coordinate of the default focus anchor point; This represents the ordinate of the default focus anchor point; Represents the total number of vertices in the predefined storyboard template, and its value is a positive integer ≥ 3; The index number representing the vertex sequence, with values ranging from 1 to... Integers; Representing the Local x-coordinates of each vertex; Representing the The local ordinates of each vertex.
[0035] After constructing the initial set of anchor point coordinates, the instantiation module extracts the current scaling factor and offset of the system view space to generate a two-dimensional affine transformation matrix. The instantiation module then uses this matrix to perform matrix multiplication on the local coordinate coefficients within the initial set of anchor point coordinates. Finally, the instantiation module maps all anchor points to the two-dimensional canvas global coordinate system and outputs the globally mapped set of anchor point coordinates. This set of anchor point coordinates serves as a reference for defined spatial locations and is written into the system's global memory for subsequent use by the semantic stiffness mapping module.
[0036] During the instantiation of the predefined storyboard template, the instantiation module completes the mapping operation from the local coordinate system to the global coordinate system by handling interactive events.
[0037] The instantiation module listens for interactive events generated by the input device and obtains drag-and-drop command signals for predefined storyboard templates. Interactive events include mouse press, move, and release events, or touch screen press, swipe, and release events. For the capture and distribution process of the underlying event state machine, those skilled in the art can call the built-in event listening interface of the operating system or graphical user interface framework to execute it. The event listening and state feedback based on the callback mechanism are well-known technologies in the field and will not be elaborated upon here.
[0038] The instantiation module extracts the absolute screen coordinates at the moment the release action occurs from the drag command signal. Absolute screen coordinates are coordinate values based on the physical pixel grid of the computing device's display. The system's 2D canvas coordinate system is affected by user scrolling and view zooming, and its origin and spatial scale are not aligned with the display device's absolute screen coordinate system. The computing device's display screen serves as a fixed viewport, while the 2D canvas is a virtual logical plane that supports continuous zooming and translation. The instantiation module needs to inversely convert the physical pixel positions on the display screen into coordinate positions on the virtual logical plane.
[0039] The predefined storyboard template uses a local coordinate origin as its alignment reference in its data structure. The instantiation module uses the calculated coordinates of the drag-and-release point in the 2D canvas global coordinate system as the positioning point of this local coordinate origin in global space. The instantiation module uses the acquired absolute screen coordinates, the horizontal scaling factor of the canvas coordinate system, the vertical scaling factor of the canvas coordinate system, and the screen offset of the canvas origin to obtain the horizontal translation offset and the vertical translation offset in the global coordinate system. The formula for calculating the translation offset is as follows: ; ; In the formula, This represents the horizontal translation offset in the global coordinate system. This represents the vertical translation offset in the global coordinate system. Represents the horizontal coordinate of the drag-and-release point on the display screen; Represents the vertical coordinate of the drag-and-release point on the display screen; This represents the horizontal offset of the origin of the global coordinate system of the 2D canvas on the display screen. This offset is usually generated by the view translation or scrolling operation of the 2D canvas. This represents the vertical offset of the origin of the global coordinate system of the 2D canvas on the display screen. This offset is usually generated by the view translation or scrolling operation of the 2D canvas. The horizontal scaling factor of the canvas coordinate system, which is a real number with a value greater than 0; This represents the vertical scaling factor of the canvas coordinate system, and its value is a real number greater than 0.
[0040] The instantiation module substitutes the calculated horizontal and vertical translation offsets in the global coordinate system into a preset two-dimensional affine transformation matrix. Using this two-dimensional affine transformation matrix with translation offsets and scaling factors, the instantiation module performs matrix multiplication on the local vertex coordinate sequence and the set of anchor points of interest in the predefined storyboard template, completing the coordinate numerical mapping.
[0041] After coordinate mapping, the instantiation module positions the geometric contour data of the predefined storyboard template and the set of anchor points of interest to the user-specified canvas space location. The instantiation module stores the set of vertex coordinates and the set of anchor points of interest coordinates after global mapping in the memory of the computing device, for the topology transformation module and stiffness mapping module to read and call, providing a numerical benchmark for subsequent topology reconstruction and energy field solution.
[0042] In the above method for dynamically generating comic storyboards, the topology transformation module performs the following graphic topology reconstruction operation.
[0043] The topology transformation module receives the set of vertex coordinates that have completed global mapping, output by the instantiation module. Traditional computer graphics systems often store polygon primitives as independent vertex arrays. This data format cannot support adjacent boundary energy calculation and topology flip detection. Since the subsequent energy function construction requires frequent operations such as "finding the adjacent edges of an edge" and "calculating the angle between two intersecting boundaries," performing these operations in an independent vertex array would require a full array traversal, resulting in excessively high time complexity. The system needs to convert isolated vertex coordinate sequences into a half-edge data structure containing connectivity information, reducing the time complexity of geometric topology lookups to constant levels through memory pointer addressing.
[0044] The topology transformation module iterates through every storyboard polygon in the current 2D canvas's global coordinate system. For any storyboard polygon, the topology transformation module instantiates a polygon face object in memory and reads the vertex coordinate sequence of that storyboard polygon in a counter-clockwise direction.
[0045] For any two adjacent vertices in the vertex coordinate sequence, the topology transformation module constructs a directed half-edge object in memory. The module configures the underlying pointer of this directed half-edge object, assigning the memory address of the starting vertex to the origin pointer, assigning the memory address of the next generated directed half-edge to the successor half-edge pointer, and assigning the memory address of the current polygon face object to its corresponding face pointer. Simultaneously, since there are physical gaps between the polygons in each panel of the comic canvas and they do not share physical boundaries, the topology transformation module initializes the opposing half-edge pointer of this directed half-edge object to a null value. This null state reserves a judgment identifier and mounting interface for subsequent construction of a virtual boundary data table across polygons. By configuring the underlying pointers, the system establishes a memory access link between vertices, directed half-edges, and polygon faces.
[0046] The allocation and addressing logic of memory pointer space can be implemented by those skilled in the art by calling the underlying memory management interface in the programming environment. The memory object creation mechanism is a well-known technology in this field and will not be described in detail here.
[0047] Based on maintaining the topological pointer relationships, the topology transformation module needs to prepare the basic geometric parameters for subsequent energy function construction. The topology transformation module calculates the coordinates of the center point and the unit outward normal vector of the directed half-edge based on the coordinates of the starting and ending vertices. The formulas for calculating the center point coordinates and the unit outward normal vector are as follows: ; ; ; In the formula, The x-coordinate represents the center point of the half-side; The ordinate represents the center point of the half-side; The x-coordinate of the starting vertex of the half; The ordinate represents the starting vertex of the half-side; The x-coordinate of the vertex representing the endpoint of the half-side; The ordinate represents the vertex of the endpoint of the half-side; The unit outward normal vector represents half of the side.
[0048] The above formula obtains a unit vector perpendicular to the current polygon boundary and pointing outwards from the polygon by rotating the direction vector from the starting vertex to the ending vertex 90 degrees clockwise and dividing it by the line segment length. The denominator of the formula represents the line segment length of the directed half-side. To ensure the validity of the numerical calculation, the coordinates of the starting and ending vertices of the directed half-side do not coincide in the global coordinate system, preventing an abnormal error of zero denominator that would interrupt the system process.
[0049] The topology transformation module writes the calculated center point coordinates and unit outward normal vector into the memory field of the corresponding directed half-edge object. After completing the traversal and pointer binding of all storyboard polygons in the current 2D canvas global coordinate system, the topology transformation module stores the generated complete half-edge data structure in the memory of the computing device, providing topological data support for establishing virtual boundary constraints between polygons.
[0050] In the dynamic generation method of comic panel storyboards, after the topology transformation module completes the construction of the inner half of the polygon, it performs a dynamic detection and construction process of the virtual boundary.
[0051] After the topology transformation module completes the construction of half-edges within isolated polygons, topological connections between the polygons are not yet established. Since the polygons in comic book layouts rely on physical gaps for visual separation, the system needs to establish logical relationships between adjacent half-edges of different polygons to constrain the relative positions of the panels and prevent primitive overlap or excessive gaps. In traditional computer graphics, half-edge data structures are often used to describe continuous closed meshes shared by top and bottom edges. The system integrates independent layout primitives into a unified energy field calculation system by pairing and binding the originally physically separated polygon boundaries to establish a connection structure for applying distance constraints.
[0052] The topology transformation module executes a double loop to traverse the half-edge data structure in memory. For any two half-edges belonging to different polygon face objects, the topology transformation module reads their unit outward normal vectors and center point coordinates.
[0053] For the spatial indexing and collision detection acceleration algorithm in the double loop traversal process, those skilled in the art can use the quadtree bounding box hierarchy structure to filter non-overlapping regions. Its spatial partitioning and query optimization are well-known technologies in this field and will not be elaborated here.
[0054] The topology transformation module calculates the dot product of the unit outward normal vectors of two half-edges. The system discards pairs of half-edges with the same or perpendicular directions based on the dot product value. When the polygon boundaries corresponding to two half-edges face each other within the 2D canvas, their outward normal vectors point in opposite or approximately opposite directions. According to the mathematical properties of vector dot products, the dot product of vectors with an angle greater than 90° is negative. When the dot product value is less than a preset angle threshold, the topology transformation module determines that the two half-edges are facing each other, allowing them to proceed to the distance calculation stage. This angle threshold is set to a real number between <0 and ≥-1, used to filter primitive boundaries that are roughly facing each other.
[0055] After entering the distance calculation stage, the topology transformation module uses the center point coordinates to calculate the absolute spatial distance between the two opposing halves. The formula for calculating the absolute spatial distance is as follows: ; In the formula, Represents absolute spatial distance; The x-coordinate represents the center point of the first half-side; The ordinate represents the center point of the first half-side; The x-coordinate of the center point of the second half; The ordinate represents the center point of the second half.
[0056] The topology conversion module compares the calculated absolute spatial distance with a preset distance threshold. The preset distance threshold is set based on the global canvas's layout baseline spacing, and its value is a real number greater than 0. To cover the layout gaps between adjacent scenes, the preset distance threshold is set to 2-3 times the layout baseline spacing. If the absolute spatial distance is lower than the preset distance threshold, the topology conversion module determines that these two halves constitute an adjacent boundary relationship. By limiting the spatial distance, the system filters out irrelevant boundaries that are too far apart and have no layout interaction.
[0057] After extracting adjacent half-edge pairs that satisfy the conditions of unit external normal dot product and absolute spatial distance, the topology transformation module constructs a virtual boundary data structure in memory. The topology transformation module writes the memory addresses of these two half-edges into the empty pointer fields of the other half-edge, establishing a bidirectional pointer link across the polygon.
[0058] While establishing the bidirectional pointer link, the topology transformation module appends the pointer references of the adjacent half-edge pair and the calculated absolute spatial distance value as an independent data record to the virtual boundary data table. The virtual boundary data table resides in memory and records the spatial adjacency topology relationships between the polygons in the current 2D canvas, which are then used by the system to calculate spacing energy constraints and adjust the layout.
[0059] In the dynamic generation method of comic storyboards, the stiffness mapping module performs local stiffness coefficient calculation based on spatial attenuation.
[0060] The stiffness mapping module obtains the set of anchor point coordinates output by the instantiation module and reads the half-edge data structure generated by the topology transformation module. During the topology adjustment of the storyboard polygons, due to differences in image content, the resistance of each polygon boundary to deformation needs to be differentiated. The system introduces a stiffness mapping mechanism to establish a numerical binding relationship between discrete geometric boundaries and the semantic importance of image content. The local stiffness coefficient is used to quantify the ability of each half-edge to resist displacement or deformation in the layout energy field. The larger the local stiffness coefficient value, the stronger the ability of the half-edge to maintain its original position and shape during layout deformation.
[0061] The stiffness mapping module iterates through each half-object in the half-object data structure. For any half-object, the stiffness mapping module extracts the coordinates of its center point recorded in its memory field. Simultaneously, the stiffness mapping module reads the set of coordinates of the anchor points of interest corresponding to the polygon face object to which that half-object belongs.
[0062] The stiffness mapping module calculates the Euclidean distance from the center point of the current half to the anchor point of interest. Euclidean distance measures the physical span of the primitive boundary from the core area of the drawing. When multiple anchor points exist in the set of anchor point coordinates, the system calculates the Euclidean distance from the center point of the half to each anchor point and extracts the smallest Euclidean distance as the final distance parameter for that half, ensuring that the boundary is rigidly protected by the nearest core drawing area. The formula for calculating the Euclidean distance is as follows: ; In the formula, This represents the Euclidean distance from the center point of the half-side to the anchor point of interest. The x-coordinate represents the center point of the half-side; The ordinate represents the center point of the half-side; Represents the x-coordinate of the anchor point of interest in the global coordinate system; This represents the ordinate of the anchor point of interest in the global coordinate system.
[0063] After obtaining the Euclidean distance from the center point of one half to the anchor point of interest, the stiffness mapping module calculates the local stiffness coefficient of that half using a spatial attenuation algorithm. The system sets a negative correlation between the stiffness of the boundary and its distance from the anchor point of interest; boundaries closer to the anchor point are subject to stronger stiffness constraints to protect the integrity of the core image; boundaries farther from the anchor point have lower stiffness constraints, allowing for greater cropping or translation. The spatial attenuation algorithm uses a Gaussian attenuation model, which provides a smooth and continuously differentiable stiffness gradient, avoiding computational divergence caused by abrupt stiffness changes in subsequent energy function differentiation iterations. The formula for calculating the local stiffness coefficient is as follows: ; In the formula, Represents the local stiffness coefficient; Represents the basic stiffness constant, which is the initial anti-deformation benchmark value set by the system, and takes the value of a real number > 0; This represents the influence weight coefficient, and its value range is set to a real number > 0 and ≤ 1; The base of the natural logarithm; This represents the Euclidean distance from the center point of the half-side to the anchor point of interest. This represents the attenuation control parameter, used to adjust the rate at which the local stiffness coefficient decays with Euclidean distance. Its value is set to a real number greater than 0. The value of the attenuation control parameter is assigned by the system based on the diagonal length of the current polygon bounding box multiplied by a preset scaling factor. This preset scaling factor is a real number between 0.1 and 0.5 to adapt to the stiffness attenuation range of different sized storyboard primitives.
[0064] The execution mechanism of floating-point exponentiation and square root operations at the underlying level of computing devices can be accomplished by calling hardware mathematical coprocessors or standard mathematical function libraries. The underlying calculation calling mechanism is a well-known technology in this field and will not be described in detail here.
[0065] After calculating the local stiffness coefficient of the half-side, the stiffness mapping module converts the value into floating-point data and writes it as a physical property parameter into the memory data structure of the corresponding half-side object. After completing the traversal calculation of all half-sides within the current 2D canvas, the stiffness mapping module outputs a half-side data structure with its local stiffness coefficients. This half-side data structure resides in system memory for subsequent use by the energy construction module when establishing the system's total energy function.
[0066] In the above-mentioned dynamic generation method of comic panel storyboard, the energy construction module receives the half-side data structure with local stiffness coefficients generated by the stiffness mapping module, reads the virtual boundary data table generated by the topology transformation module, and executes the construction process of the spacing energy term.
[0067] During polygon layout adjustment, reasonable physical gaps need to be maintained between the polygons in each scene. The system equates adjacent opposing boundaries to spatial distance constraint structures with elastic potential energy characteristics. The bidirectional pointer links recorded in the virtual boundary data table are abstracted as physical penalty terms connecting two halves, whose target relative positions correspond to the ideal layout reference spacing, and whose equivalent elastic coefficients against tension or compression are jointly determined by the local stiffness coefficients of the two connected halves. The degree to which the boundary spacing deviates from the ideal state is converted into energy values, so that the subsequent layout process can be transformed into a mathematical optimization problem of finding the minimum energy point of the system, thereby achieving adaptive primitive layout under the condition of satisfying the layout gap constraints.
[0068] The energy construction module iterates through each data record in the virtual boundary data table. For any virtual boundary record, the energy construction module extracts its associated first and second halves. The energy construction module then reads the local stiffness coefficients corresponding to the first and second halves from the memory data structure of the corresponding half-edge objects. Simultaneously, the energy construction module reads the absolute spatial distance between these adjacent half-edge pairs from the virtual boundary data table.
[0069] The energy construction module calculates the equivalent elastic coefficient of the virtual boundary. To comprehensively reflect the deformation resistance of two adjacent boundaries, the system uses the arithmetic mean of their local stiffness coefficients as the equivalent elastic coefficient of the virtual boundary. This averaging process ensures that when one boundary has higher stiffness due to its proximity to the anchor point of interest, the entire spacing constraint can still maintain high deformation resistance, preventing the weaker stiffness boundary from excessively collapsing unilaterally towards the higher stiffness boundary. The formula for calculating the equivalent elastic coefficient is as follows: ; In the formula, Represents the equivalent elasticity coefficient; Represents the local stiffness coefficient of the first half; This represents the local stiffness coefficient of the second half.
[0070] After obtaining the equivalent elasticity coefficient, the energy construction module constructs a spacing energy term based on the physical equivalent model of elastic potential energy. The system uses the difference between the actual calculated absolute spatial distance and the set target layout spacing as the deformation of the spatial distance constraint structure. The energy construction module accumulates the deformation potential energy of all virtual boundaries to form a spacing energy term that measures the global layout gap deviation. The core formula of the spacing energy term is expressed as follows: ; In the formula, Represents the spacing energy term; The set of adjacent half-edge pairs recorded in the virtual boundary data table; This represents a pair of adjacent half-sides in the set of adjacent half-side pairs; Represents the equivalent elasticity coefficient; Represents absolute spatial distance; This represents the target layout spacing, and its value is a real number greater than 0. The value of the target layout spacing is calculated and assigned according to the width of the two-dimensional canvas according to a preset gap ratio. The preset gap ratio is set to a real number between 0.5% and 5% to provide a layout cutting gap that meets printing visual standards as a target benchmark.
[0071] The calculated spacing energy term resides in memory as a floating-point number. This value reflects the overall deviation between the current layout state of all storyboard elements within the 2D canvas and the ideal spacing state. When the absolute spatial distance equals the target layout spacing, the corresponding individual deformation potential energy is zero; when the polygon spacing is compressed or stretched, the deformation potential energy exhibits a quadratic growth pattern. Utilizing the constructed spacing energy term, the system drives the boundaries of each storyboard polygon to converge towards the target layout spacing during subsequent energy minimization, thereby maintaining the physical uniformity of the cutting gaps in the global layout.
[0072] In the dynamic generation method of comic panel storyboards, the energy construction module executes the definition of the gaze vector field and the construction process of the flow energy term.
[0073] Comic layout follows a fixed reading order. The system establishes a gaze vector field in the global coordinate system of the 2D canvas to guide the spatial arrangement of the panel polygons. The gaze vector field is a set of 2D vectors defined in the canvas space, representing the recommended reading direction at each spatial coordinate point. By transforming the discrete panel arrangement into a continuous vector field constraint, the system transforms the verification process of reading logic into the evaluation process of an energy function. In the layout, the geometric position of the panels needs to conform to the physical habits of the target audience's eye movement. The system constructs a gaze vector field based on preset reading habits. For example, for a right-to-left, top-to-bottom reading mode, the system establishes a set of reference vectors with negative horizontal and vertical coordinate components in the global coordinate system of the 2D canvas as a global gaze guidance benchmark.
[0074] The energy construction module obtains a sequence of storyboard polygons arranged in reading order based on the story timeline recorded in the predefined storyboard template. For two adjacent storyboard polygons in the sequence, the energy construction module extracts the geometric center coordinates of the preceding and following storyboard polygons. By subtracting the geometric center coordinates of the preceding storyboard polygon from the geometric center coordinates of the following storyboard polygon, the system calculates and generates the actual reading flow vector.
[0075] For the extraction of the geometric center of a polygon, those skilled in the art can use the arithmetic mean of the coordinates of all vertices of the polygon for calculation. The method for solving the geometric centroid is a well-known technique in the field and will not be elaborated here.
[0076] The energy construction module reads preset gaze vector field data and obtains a reference gaze vector located at the geometric center of the polygon in the previous storyboard. The system compares the actual reading flow vector with the reference gaze vector. By calculating the cosine similarity between the actual reading flow vector and the reference gaze vector, the system can quantify the degree of angular deviation between the actual layout flow and the ideal reading guidance direction.
[0077] The energy construction module accumulates the flow direction deviations of all adjacent polygon pairs in the storyboard to construct the flow direction energy term. The core formula for the flow direction energy term is expressed as follows: ; In the formula, Represents the energy flow term; Represents the total number of storyboard polygons in the storyboard polygon sequence, and takes the value of a positive integer greater than 1; This represents the index number of the storyboard sequence, with values ranging from... ~ Integers; The value represents the flow direction weighting coefficient, which is used to balance the proportion of flow direction penalty and spacing penalty in the total energy function. The value range is set to a real number between 0.1 and 1. Representative by the first The polygon in the segmentation points to the first... The actual reading flow vector of each segmentation polygon; The line-of-sight vector field represents the first... The reference line-of-sight vector at the location of each polygon in the storyboard; Represents the vector dot product operator; The magnitude of the actual reading flow vector; This represents the magnitude of the reference line-of-sight vector.
[0078] In the formula above, the part within parentheses uses the law of cosines to calculate the cosine of the angle between the actual reading flow vector and the reference line-of-sight vector. When the actual reading flow vector and the reference line-of-sight vector are in the same direction, the result of the dot product divided by the product of the magnitudes is 1, and the result within the parentheses is 0, indicating that no energy penalty is incurred. As the angle between the two vectors increases, the result within the parentheses increases, and the energy penalty imposed by the system increases accordingly.
[0079] The flow direction weighting coefficient is used to adjust the influence of the flow direction energy term on the overall layout constraints of the system. The value of the flow direction weighting coefficient is assigned by the system by reading the metadata file of the predefined storyboard template. For different language reading habits, differentiated flow direction weighting coefficients are configured in the metadata file to determine the priority of reading flow when layout conflicts occur.
[0080] The calculation results of the energy flow term reside in the memory of the computing device. During the energy minimization process, the system reduces the value of the energy flow term, driving each panel polygon to translate along a preset line-of-sight vector field within the global coordinate system of the two-dimensional canvas, ensuring that the generated layout conforms to the preset reading flow logic.
[0081] In the dynamic generation method of comic panel storyboards, the energy construction module executes the construction process of the anti-self-intersection interior angle logarithmic barrier energy term.
[0082] During the layout adjustment of polygons in the storyboard, primitive boundaries are displaced by spacing constraints and flow guidance. If polygon vertices penetrate and intersect, a simple convex polygon can degenerate into a self-intersecting or concave polygon, violating the geometric validity of the underlying rendering. In the process of polygon deformation in a two-dimensional plane, the geometric prerequisite for topological flipping or self-intersection is that the internal angle between two adjacent edges approaches 0° or 180°. The system introduces a logarithmic potential barrier function to impose mathematical constraints on the geometric interior angles of polygons, forming an energy barrier before the polygon's interior angles degenerate to the aforementioned critical angles, thus intercepting the self-intersection and concave polygon degradation phenomena at the computational level.
[0083] The energy building module traverses the half-edge data structure built in memory, reading each polygon face object in turn. For any polygon face object, the energy building module extracts adjacent directed half-edge pairs sharing the same vertex in counter-clockwise order, based on the successor half-edge pointer in the half-edge's underlying pointer.
[0084] The energy construction module reads the coordinate data of the adjacent directed half-side pair and calculates the interior angle values of the polygon formed by the vertex. For the calculation logic of the polygon interior angles, those skilled in the art can call the inverse trigonometric function interface in the underlying mathematical function library to perform the angle calculation operation of vector dot product and cross product. The basic geometric calculation mechanism is a well-known technology in this field and will not be elaborated here.
[0085] After calculating the interior angle values of the polygon, the energy construction module uses the asymptote property of the logarithmic function to construct anti-self-intersection constraints. The logarithmic function has the mathematical characteristic that its value approaches negative infinity as the independent variable approaches zero. The system constructs an energy function whose value approaches positive infinity when the interior angle degenerates by taking the logarithm of the difference between the interior angle and the limiting angle and adding a negative sign. The core formula for the logarithmic barrier energy term of the anti-self-intersection interior angle is expressed as follows: ; In the formula, The term representing the energy of the self-intercalating interior angle logarithmic barrier; It represents the set of all interior angles of polygons within the global coordinate system of a two-dimensional canvas; Represents an interior angle from the set of interior angles of a polygon; The value of the barrier weight coefficient is set to a real number greater than 0 and less than 0.1. It is used to control the influence of the barrier function in the total energy function. The value of the barrier weight coefficient is preset by the system according to the required strictness of maintaining the convex hull of the graph. Represents the logarithmic function with the base of the natural logarithm; The first polygon The legal range of the radian values of the interior angles is restricted to a range greater than 0 and less than the constant pi. It represents the constant pi.
[0086] The calculation result of the logarithmic barrier energy term for the anti-self-intersecting interior angles resides in the memory of the computing device. When the polygon is deformed by force, causing the radian value of an interior angle to approach zero or the constant value of pi, the logarithmic calculation result within the parentheses shifts towards negative infinity. Multiplying this by the outer negative sign generates a positive energy value. In subsequent energy minimization iterations, the system avoids these high-energy states by finding the energy descent gradient through differentiation.
[0087] Due to the local properties of the logarithmic barrier function, when the interior angles of the polygon are within their normal opening range, the output value of this energy term is small and the gradient change is gentle, so it will not interfere with the global layout adjustment. This soft constraint mechanism based on mathematical barrier replaces hard collision detection that blocks the calculation process, ensuring the continuous differentiability of the polygon layout optimization calculation process.
[0088] In the dynamic generation method of comic storyboards, after the energy construction module has calculated each independent energy, it performs a weighted coupling operation on the system's total energy equation.
[0089] In the task of adjusting the layout of a two-dimensional canvas, spacing constraints, reading flow guidance, and anti-self-intersection protection of graphics are simultaneous and potentially competing physical conditions. Optimizing any one condition alone can lead to the violation of other layout rules. The system constructs a total energy function to map constraints with different dimensions and mathematical properties to the same numerical space. By multiplying the independent energy calculation results by their corresponding weighting coefficients, the system offsets the order-of-magnitude differences caused by different geometric dimensions in each formula, enabling linear accumulation within a unified numerical system, thus transforming it into a standard unconstrained optimization problem.
[0090] The energy construction module reads the values of the spacing energy, flow energy, and anti-self-intersection interior angle logarithmic barrier energy, which reside in the memory of the computing device. The system assigns a control parameter to each energy to balance the intervention intensity of each energy in the overall layout adjustment.
[0091] The energy construction module linearly sums these three energy components according to the set control parameters to construct the total system energy function used to drive the displacement of primitive vertices. The formula for calculating the total system energy equation is as follows: ; In the formula, Represents the total energy function of the system; This represents the spacing energy weighting coefficient, and its value range is set to a real number > 0; The energy weighting coefficient representing the flow direction is set to a real number greater than 0. This represents the energy weighting coefficient for preventing self-crossing, and its value range is set to a real number > 0; Represents the spacing energy term; Represents the energy flow term; This represents the energy term of the logarithmic potential barrier against self-intersection.
[0092] The specific values of the aforementioned weighting coefficients are pre-configured by the system based on the needs and preferences of the application scenario. To ensure the stability of the basic layout structure, the spacing energy weighting coefficient is usually set to the system baseline value of 1. The flow energy weighting coefficient is set between 0.1 and 0.5 as an auxiliary guiding condition. Anti-self-crossing energy, as a rigid baseline for maintaining geometric topology compliance, has its corresponding anti-self-crossing energy weighting coefficient set between 10 and 100 to ensure an overwhelming repulsive force when vertex penetration tends to occur. In scenarios that tend to ensure the uniformity of image segmentation, the spacing energy weighting coefficient is assigned a relatively high value; in scenarios that prevent damage to primitive geometry, the anti-self-crossing energy weighting coefficient is increased to reinforce the energy barrier of the topological critical state.
[0093] The calculated total system energy function reflects the physical stress accumulation state of the current layout. The lower the value of the total system energy function, the closer the current layout is to the equilibrium point that satisfies all constraints. The energy construction module outputs the total system energy function to memory, which serves as the objective function for the subsequent mathematical optimization minimization solution module. By iteratively reducing the value of this objective function, the final translation and deformation coordinates of each vertex of the storyboard polygon are calculated.
[0094] In the dynamic generation method of comic storyboards, the minimization solution module receives the total system energy function output by the energy construction module and performs the Jacobian partial derivative calculation and gradient descent direction determination process.
[0095] After the energy construction module outputs the system's total energy function, the primitive layout adjustment task is transformed into a mathematical optimization problem of finding the minimum value of this function. The system's total energy function uses the vertex coordinates of all storyboard polygons within the 2D canvas as independent variables. To find the vertex coordinate configuration state with the lowest energy value, the minimization solution module needs to use calculus to calculate the energy change gradient under the current coordinate state, thereby guiding the direction of vertex movement. In the physical layout model, the derivative of energy with respect to spatial coordinates is equivalent to the force acting on the object. By calculating the partial derivatives of the system's total energy function with respect to each vertex coordinate component, the system transforms layout constraints such as spacing and flow direction into virtual forces driving spatial displacement of vertices. The resultant force direction of these virtual forces guides the primitive layout towards an energy equilibrium state.
[0096] The minimization module traverses the half-data structure established in memory, reading the vertex coordinates of all polygons within the 2D canvas. It extracts the x and y coordinates of all vertices in the order they were read from memory and concatenates them into a one-dimensional global state vector. This global state vector has a dimension equal to twice the total number of vertices of all polygons within the 2D canvas. This global state vector fully describes the spatial geometric distribution characteristics of the current layout.
[0097] The minimization module calculates the partial derivative of the system's total energy function with respect to each coordinate component in the global state vector. The geometric meaning of the partial derivative represents the rate of change of the system's total energy caused by a small displacement of a single vertex along the horizontal or vertical axis, assuming that the coordinates of other vertices remain unchanged.
[0098] For the underlying computational execution mechanism of partial derivatives of complex energy functions, those skilled in the art can use automatic differential algorithms to calculate accurate analytical solutions, or use the finite difference method to perform numerical approximate differentiation. The underlying mathematical differential differentiation mechanism is a well-known technology in this field and will not be elaborated here.
[0099] The minimization module arranges all the calculated partial derivatives in the element-wise order of the global state vector to form the Jacobian partial derivative matrix of the system's total energy function. In the multivariable unconstrained optimization scenario of this embodiment, this Jacobian partial derivative matrix is represented as a multivariable gradient vector.
[0100] According to the mathematical principle of gradient descent, the gradient vector of a function at a point points in the direction of the fastest increase in function value, while the opposite direction is the direction of the fastest decrease in function value. The minimization module takes the negative value of the gradient vector obtained by differentiation to generate the gradient descent direction vector that guides the movement of the vertex. The core formula for calculating the gradient descent direction vector is expressed as follows: ; In the formula, Represents the gradient descent direction vector; Represents the total energy function of the system; to Represents the x-coordinate of each polygon vertex; to Represents the ordinate of each vertex of the polygon; Represents the total number of global vertices. Its value is assigned by the minimization solution module when traversing the half-side data structure by accumulating the number of independent vertex objects, and the value is a positive integer >3. This represents the partial derivative operator.
[0101] The gradient descent direction vector calculated by the minimization module resides in the memory of the computing device. This vector has the same dimension as the global state vector, and each component corresponds to the theoretical direction and relative magnitude of the movement of each vertex coordinate component in the current iteration step. Based on this gradient descent direction vector, the minimization module, in subsequent computations and in conjunction with a step-size control mechanism, drives the spatial position updates of each polygon vertex, thereby guiding the total energy function of the system to converge downwards.
[0102] In the dynamic generation method of comic panel storyboards, after obtaining the gradient descent direction vector, the minimization solution module executes a backtracking search process with interior angle truncation to determine the step size of a single iteration.
[0103] In the optimization calculation of gradient descent, the gradient descent direction vector indicates the local geometric trend of the decrease in the total energy function of the system, but does not limit the specific distance moved along that direction. If the step size of a single coordinate update is too large, the crossing of vertex coordinates will cause the objective function to cross the logarithmic barrier, triggering polygon topological breakage and resulting in primitive self-intersection or boundary flipping. Conventional line search algorithms only use the decrease in energy value as the judgment criterion, which is difficult to prevent such geometric abrupt changes that penetrate the barrier. The system introduces a backtracking line search algorithm with a topological truncation mechanism, adding a geometric anti-self-intersection verification step before energy decrease judgment. The principle of this search mechanism is that each coordinate displacement based on mathematical partial derivatives is regarded as a physical trial. If the trial result leads to the destruction of the polygon geometry or fails to bring the expected energy decay, the system discounts the displacement distance and re-trials until a safe step size that does not destroy the structure and reduces the system energy is found.
[0104] The minimization module sets the initial search step size parameter and reads the global state vector resident in memory and the gradient descent direction vector calculated in the previous step. Using the current search step size parameter, the system drives the global state vector to perform tentative position updates along the gradient descent direction vector, calculating a set of tentative coordinates. The formula for coordinate update is as follows: ; In the formula, Represents a tentative set of coordinates; A global state vector representing the current layout state; This represents the search step size parameter, which is a real number with a value greater than 0. In the initial stage, it is configured by the system as a baseline constant according to the size ratio of the two-dimensional canvas. This baseline constant is usually set to 1. This represents the gradient descent direction vector.
[0105] After obtaining the tentative coordinate set, the minimization solution module uses this coordinate set to re-establish the virtual geometric topology and calculates the tentative geometric interior angles of all polygonal faces at the tentative positions. The system iterates through these tentative geometric interior angles, comparing the value of each tentative geometric interior angle with the valid interior angle opening interval. The valid interior angle opening interval is set within the range of radians > 0 and less than the constant pi.
[0106] When the system detects that the radian value of any tentative geometric interior angle exceeds the legal interior angle opening interval, it indicates that the currently set search step size parameter is too large, causing physical penetration of polygon vertices. At this point, the minimization solution module triggers a topology truncation mechanism, applying a decay coefficient to the search step size parameter to reduce it proportionally. The system substitutes the reduced search step size parameter into the aforementioned coordinate update formula to recalculate the tentative coordinate set and iteratively executes the interior angle verification logic until all tentative geometric interior angles fall back to the legal interior angle opening interval.
[0107] For the specific calculation and logical judgment of the aforementioned tentative geometric interior angles of polygons, those skilled in the art can call the underlying mathematical function library to perform vector calculation operations. The basic angle inverse solution algorithm is a well-known technology in this field and will not be elaborated here.
[0108] After ensuring the topological validity of the trial coordinate set, the minimization module performs a descent check based on the energy criterion. The system calculates the total system energy function value corresponding to the trial coordinate set and checks whether this value satisfies the sufficient descent condition. The sufficient descent condition requires that the total energy at the trial position be lower than the total energy of the current layout state, and that the descent amount reach the expected reference index based on the current gradient and step size. The system uses the Amiho criterion to construct the inequality for determining the sufficient descent condition. The core determination formula is expressed as follows: ; In the formula, Represents the total energy function of the system; This represents the function value of the total energy function of the system under the tentative coordinate set; This represents the value of the system's total energy function under the global state vector; The parameter representing the expected rate of decrease is set to a real number greater than 0 and less than 1, and is usually a constant value on the order of one ten-thousandth. It is used to control the minimum acceptable energy decrease of the system. This represents the search step size parameter, which is a real number with a value greater than 0. In the initial stage, it is configured by the system as a baseline constant according to the size ratio of the two-dimensional canvas. This baseline constant is usually set to 1. This represents the gradient vector of the partial derivatives of the system's total energy function under the current layout state; Represents the gradient descent direction vector; This represents the vector dot product operator.
[0109] If the calculated function value does not satisfy the inequalities of the Amiho criterion, the minimization module continues to reduce the search step size parameter by a preset decay coefficient and returns to the stage of calculating the tentative coordinate set to restart the loop. The decay coefficient is set to a real number > 0 and < 1, and is often assigned a value of 0.5. To prevent the loop from failing to terminate due to numerical calculation accuracy issues, a minimum step size threshold is set. When the reduced search step size parameter is less than this minimum step size threshold, the minimization module forcibly exits the loop to prevent the optimization algorithm from stalling. The minimum step size threshold is set to 10. -6 ~10 -8 Floating-point numbers between [a certain range].
[0110] When the tentative coordinate set passes both the topological validity check and the sufficient descent condition check, or when the search step size parameter is reduced to the minimum step size threshold, the minimization solution module terminates the backtracking search loop. The system determines the search step size parameter at this point as the optimal movement step size for the current iteration step and formally writes the corresponding tentative coordinate set into memory, overwriting the original global state vector. This step size optimization mechanism, which combines geometric truncation and energy assessment, ensures that the deformation and displacement of the storyboard primitives in the two-dimensional canvas satisfy both the convergence requirements of numerical optimization and prevent physical damage to the layout structure.
[0111] In the dynamic generation method of comic panel storyboards, after completing a single coordinate update, the minimization solution module performs convergence criterion judgment and coordinate system redrawing output process.
[0112] After each iteration, the system needs to evaluate whether the current optimization state has achieved the expected layout balance. The minimization solution module evaluates the current optimization progress using multiple convergence criteria to determine whether the energy minimization iteration loop needs to be terminated. The convergence criteria set by the system include gradient-based convergence judgment, energy change-based convergence judgment, and forced termination judgment based on the number of iterations. During numerical calculation, due to the precision limitations of computer floating-point numbers and the smooth characteristics of the energy surface near local minima, a single convergence judgment condition can easily lead to premature algorithm termination or getting stuck in an endless loop. The system constructs a multi-dimensional judgment logic by combining three indicators: gradient state, energy change rate, and computation cycle, ensuring that the optimization process balances computational cost and layout quality while having an exit mechanism to prevent program freeze.
[0113] The minimization module calculates the norm of the gradient vector of the partial derivatives of the system's total energy function under the current layout state. The gradient norm reflects the steepest descent slope of the system's total energy function at the current multidimensional coordinate point. When the gradient norm approaches zero, it indicates that the system has reached or is close to a local minimum point on the energy surface, and the layout constraints have reached equilibrium under the current coordinate distribution. The core formula for convergence based on the gradient is expressed as follows: ; In the formula, This represents the gradient vector of the partial derivatives of the system's total energy function under the current layout state; The Euclidean norm, representing the partial derivative gradient vector, is used to quantify the overall gradient magnitude in the current multidimensional state. This represents the gradient convergence tolerance threshold, with a value range set to 10. -4 ~10 -6 A floating-point number between these values is used to define the mathematical standard for achieving balance in a typesetting system.
[0114] The minimization module calculates the absolute change in the total energy function value of the system before and after the current iteration. This absolute change is obtained by extracting the total energy value calculated in the previous iteration, subtracting it from the total energy value calculated in the current iteration, and taking the absolute value of the difference. When this absolute change is less than a preset energy change tolerance threshold, it indicates that subsequent coordinate adjustments leading to layout changes are stagnating, and the system will trigger a convergence determination based on the energy change. The energy change tolerance threshold is set to 10. -5 Floating-point numbers of the order of magnitude.
[0115] To prevent the system from oscillating in complex layout conflict areas and causing the loop to fail, the minimization solution module incorporates an iteration counter. After each coordinate update operation, the system increments the iteration counter. When the accumulated number of iterations reaches the preset maximum iteration limit, the system triggers a forced termination condition. The maximum iteration limit is set to a positive integer between 100 and 1000. This maximum iteration limit is positively correlated with the total number of storyboard polygons contained in the 2D canvas. The more polygons, the higher the spatial degrees of freedom of the system, and the longer the path required to reach convergence. In this case, the system will assign a larger maximum iteration limit.
[0116] When any one of the three convergence criteria is met, the minimization solution module determines that the energy minimization process has converged and exits the iteration loop. If none of the criteria are triggered, the system will return to the step of calculating the partial derivative gradient, using the currently updated coordinates as the new starting point, and continue the next round of optimization calculation.
[0117] After the iteration loop terminates, the minimization module restores the one-dimensional global state vector residing in memory to two-dimensional geometric coordinates. The one-dimensional global state vector is a data structure built to satisfy mathematical differentiation calculations. However, during the graphics rendering stage, the rendering engine needs to read the coordinates of discrete primitives constructed based on a two-dimensional plane. Therefore, the system traverses the underlying half-side data structure, extracting paired consecutive values from the global state vector and assigning them back to the x-coordinate and y-coordinate attributes of the corresponding polygon vertices. Through this operation, the mathematical optimization result is remapped back to the physical layout topology.
[0118] After the coordinates are written back, the system drives the upper-level rendering engine to perform a coordinate system redraw output operation. Based on the vertex coordinates, edge relationships, and facet association information recorded in the updated half-side data structure, the rendering engine redraws the polygon outlines on the 2D canvas. The system then performs cropping and texture mapping on the pre-bound comic image content based on the spatial outlines of the polygon faces, generating and outputting the polygon layout result.
[0119] For the underlying graphics drawing mechanism and texture mapping of the rendering engine, those skilled in the art can call the drawing function of the graphics application programming interface to perform image rendering operations. Its rasterization and pixel filling processing are well-known technologies in the field and will not be described in detail here.
[0120] In the dynamic generation method of comic storyboards, the system implements a stiffness degradation strategy under crowded conditions when the layout space is limited.
[0121] When the number of storyboards imported by the user is too large or the 2D canvas size is too small, overlapping and compression will occur between the polygons in the storyboards. In a crowded layout environment, primitives will generate high repulsive energy to meet the preset spacing constraints. The high-energy state will cause vertices to produce large spatial displacements, which will lead to polygon topological flipping and prevent the optimization process from converging. In mathematical optimization calculations with multiple constraint conflicts, when multiple layout rules cannot be satisfied simultaneously in a limited space, a priority degradation mechanism for constraints needs to be established. The system introduces a crowding monitoring and stiffness dynamic degradation mechanism. When the layout space is identified as limited, the strictness of the spacing constraints is actively relaxed. This approach transforms the spacing constraints into relaxed conditions that allow for errors, allowing primitives to move closer to each other to a certain extent, thus ensuring the mathematical stability of the layout system during the solution process.
[0122] The system iterates through all the polygons within the 2D canvas, extracts the geometric vertex coordinates of each polygon, and calculates its current geometric area. The system then sums the geometric areas of all polygons to obtain the total area occupied by global primitives. Next, the system reads the boundary dimensions of the 2D canvas and calculates the total physically usable area of the canvas. By dividing the total area occupied by global primitives by the total physically usable area of the canvas, the system generates a global congestion index.
[0123] For the calculation mechanism of polygon area, those skilled in the art can use the shoelace formula to perform the cross product summation of the coordinates of the polygon vertices. The basic geometric area calculation method is a well-known technology in this field and will not be elaborated here.
[0124] The system compares the calculated global congestion index with a preset congestion threshold. The congestion threshold is initialized by the system based on the canvas aspect ratio, and its value is set to a real number between 0.7 and 0.9. When the global congestion index is greater than or equal to the congestion threshold, the system determines that the current layout is in a congested state and triggers the stiffness degradation logic.
[0125] The system calculates a stiffness degradation coefficient based on the degree to which the global congestion index exceeds the congestion judgment threshold. This coefficient is used to numerically weaken the repulsive constraint strength of the spacing energy term based on a natural exponential law. The core formula for calculating the stiffness degradation coefficient is as follows: ; In the formula, This represents the stiffness degradation factor; The base of the natural logarithm; This represents the crowding attenuation control parameter, which takes the value of a real number > 0. In engineering implementation, its value is usually set between 5 and 10, and it is used to control the rate at which the repulsive force weakens as the crowding level increases. Represents the overall congestion level; This represents the threshold for determining congestion.
[0126] After calculating the stiffness degradation factor, the system multiplies this factor by the original spacing energy weighting factor to generate the updated spacing energy weighting factor. The spacing energy weighting factor has been initialized to a real number > 0 before degradation occurs.
[0127] The system recalculates the total energy function by substituting the updated spacing energy weighting coefficients. By reducing the numerical proportion of the spacing energy term in the total energy function, the system weakens the mutual repulsion between primitive boundaries. Under crowded conditions, this stiffness degradation operation allows the system to prioritize the dominance of the anti-self-intersection energy term, maintaining the topological integrity of the primitives, thereby ensuring that the minimization solution module can continue to calculate mathematically convergent layout coordinates within the confined space.
[0128] In the dynamic generation method of comic storyboards, the system performs interpolation and smooth transition processes when handling real-time user interaction.
[0129] During interaction on the 2D canvas, users drag or scale the storyboard polygons using external input devices. These operations alter local layout constraints. Upon receiving updated constraints, the minimization module calculates a new layout equilibrium state. If the system renders the updated layout coordinates to the screen, it causes a visual jump in the image. This is because the underlying mathematical optimization calculations are performed in a discrete numerical space, and the difference in coordinates before and after optimization appears as an instantaneous positional break on the physical screen. The system addresses this by inserting transition frames between the old and new layout equilibrium states, using mathematical interpolation algorithms to calculate the continuous positions of vertices over time, thus converting the spatial coordinate jumps into continuous displacements in the frame sequence.
[0130] The system monitors interactive events generated by input devices. When an interactive event triggers a recalculation of the underlying layout and outputs the final coordinates, the system stores the coordinate data before the interaction as the global state vector of the initial layout state, and stores the new coordinate data output by the minimization solution module as the global state vector of the target layout state. The system sets an expected animation transition duration parameter. The specific value of this parameter is dynamically calculated proportionally to the maximum coordinate displacement between the initial and target states, or it can be set as a fixed constant. The value range of this animation transition duration parameter is set to a floating-point number between 0.1s and 0.5s.
[0131] In subsequent screen refresh cycles, the system records the physical time elapsed since the underlying layout recalculation was completed. This physical time is dynamically obtained by reading the system clock of the computing device's operating system. The system divides this physical time by the animation transition duration parameter to calculate the normalized time parameter. The value of the normalized time parameter is restricted to a closed interval between zero and one. The system uses a non-linear smoothing function to process this normalized time parameter, generating smooth interpolation weight coefficients.
[0132] For the computational logic of nonlinear smoothing functions, those skilled in the art can use the cubic Bessel easing formula or the sine decay function for numerical mapping. The basic animation easing algorithm is a well-known technology in this field and will not be elaborated here.
[0133] After obtaining the smooth interpolation weight coefficients, the system performs a weighted fusion of the global state vector of the initial layout state and the global state vector of the target layout state. The formula for calculating the global state vector of the current rendering frame is as follows: ; In the formula, A global state vector representing the current rendered frame; A global state vector representing the initial layout state; This represents the smooth interpolation weight coefficient, and its value range is set to a real number ≥0 and ≤1; A global state vector representing the target layout state.
[0134] The system writes the calculated global state vector of the current rendering frame into memory. It then reads the vertex coordinates of each polygon contained in this vector and drives the rendering engine to redraw the polygons within the 2D canvas. As time progresses, the system updates the physical time and repeats the interpolation calculation whenever the screen refreshes. When the normalized time parameter reaches 1, the smooth interpolation weight coefficient simultaneously reaches 1, at which point the global state vector of the current rendering frame is completely identical to the global state vector of the target layout state. The system then terminates the interpolation calculation process, completing a smooth transition between layout states. By introducing a coordinate fusion mechanism in the time domain, the system masks the geometric discontinuities generated by the underlying discrete optimization process, ensuring visual continuity for the user during interactive operations.
[0135] Specific application examples: Please see the appendix Figure 3 ~Attached Figure 4 The experiment selected 100 sets of initial comic panel polygons with different aspect ratios and crowding levels as the test set. The method provided by this invention is compared with two existing mainstream typesetting algorithms:
[0136] Comparison Method A (Traditional Rule Template Method): Based on a preset grid, it performs rigid cropping and scaling, and does not have adaptive adjustment capabilities.
[0137] Comparison Method B (Standard Force-Directed Diagram Method): Iterates based on the traditional spring charge model, without introducing the anti-self-intersecting interior angle logarithmic barrier energy term based on logarithmic function and the stiffness degradation strategy based on global congestion index of this invention.
[0138] Evaluation indicators: The following three core indicators are used for quantitative evaluation:
[0139] Self-intersection and overlap rate: After optimization, the proportion of the area where the polygons in the storyboard intersect or overlap with each other to the total area.
[0140] Line-of-sight flow field fit: The mean cosine similarity between the actual reading flow vector of adjacent storyboard polygons and the reference line-of-sight vector in the final layout result, with a value range of [-1, 1]. For ease of comparison, it is converted to a percentage scale for data display.
[0141] System total energy convergence performance: Record the energy decrease curve during the iteration process.
[0142] Experimental Results and Analysis: Statistical analysis of experimental data shows that the method of this invention achieves good performance in all indicators:
[0143] Regarding prevention of self-fertilization and overlap: combining the appendix Figure 3 Experimental data in (a) show that comparative method A, due to its use of hard mesh clipping, still exhibits a 5.3% overlap rate even with complex layouts. Comparative method B, when handling high-density storyboards, suffers from a 14.2% overlap rate due to fixed step size and lack of polygon interior angle verification, leading to node out-of-bounds errors. In contrast, the method of this invention introduces an anti-self-intersecting interior angle logarithmic barrier energy term. This term utilizes the mathematical characteristic that the logarithmic function's value tends towards negative infinity when the independent variable approaches zero or pi is constant, forming an energy barrier. Combined with the backtracking search mechanism with interior angle truncation in the minimization solution module, a decay coefficient is applied to the search step size parameter, achieving a 0% overlap rate in all 100 test sets, thus avoiding the problem of self-intersecting and overlapping of storyboard polygon boundaries.
[0144] In terms of visual guidance: combined with appendix Figure 3 Experimental data in (b) show that the flow field fit of comparative method A is 65.0%, while that of comparative method B is 78.0%. The method of this invention, by constructing a flow direction energy term, calculates the cosine of the angle between the actual reading flow direction vector and the reference line-of-sight vector to determine the energy penalty, and guides the layout direction according to the flow direction weight coefficient, resulting in a final layout fit of 92.0%, thus improving the reading smoothness of the comic.
[0145] System overall energy convergence stability: as shown in the appendix Figure 4 As shown, the energy change during 100 iterations is recorded with the number of iterations on the x-axis and the total system energy on the y-axis. It can be seen that the method of this invention (… Figure 4 The total system energy (constructed by linearly summing the spacing energy term, flow direction energy term, and anti-self-intersection interior angle logarithmic barrier energy term according to the weight coefficients of each term) decreases in the early stage of iteration and converges smoothly to a minimum value after about 40 iterations without oscillation. In contrast, method B (… Figure 4 The dashed line (in the middle) shows energy oscillation and divergence in the later stages of iteration (approximately after 45 iterations), indicating that the present invention's method of calculating stiffness degradation coefficients to weaken spacing energy weight coefficients when typesetting space is limited, and the minimization solution method based on the Amiho criterion for sufficient descent condition verification, has good stability. Comparison method A is not an iterative optimization algorithm and was not included in the system energy convergence comparison.
Claims
1. A template-based method for rapid generation of comic storyboards, characterized in that, Includes the following steps: Parse the predefined storyboard template to obtain the set of anchor point coordinates and the set of vertex coordinates of the storyboard polygon; Based on the vertex coordinate set, the boundary line segments of the storyboard polygon are extracted and a half-side data structure is constructed. Adjacent half-side pairs whose absolute spatial distance meets a preset distance threshold are selected and a virtual boundary data table is constructed. The preset distance threshold is set according to the layout baseline spacing. Calculate the Euclidean distance from the center point of the half-side in the half-side data structure to the set of coordinates of the anchor points of interest, and calculate the corresponding local stiffness coefficient; Obtain global view vector field data, and construct the system total energy function based on the virtual boundary data table, the local stiffness coefficient, the global view vector field data, and the interior angle values of the storyboard polygon calculated based on the vertex coordinate set; Calculate the partial derivative of the total energy function of the system with respect to the set of vertex coordinates, update the set of vertex coordinates, and obtain the set of vertex coordinates that satisfy the convergence condition for the minimum value. Based on the set of minimum vertex coordinates, graph data is generated, and the resulting storyboard graphics are output on the screen through the graphics display unit.
2. The template-based rapid comic storyboard generation method according to claim 1, characterized in that, The process of parsing the predefined storyboard template to obtain the set of anchor point coordinates and the set of vertex coordinates of the storyboard polygon includes: Receive drag command signal, call the predefined storyboard template, load the data structure of the predefined storyboard template into the global coordinate system of the two-dimensional canvas, and parse the metadata file of the predefined storyboard template; Traverse the hierarchy tree of the metadata set of the predefined storyboard template and check whether it contains anchor data nodes; When the anchor data node is included, the character content of the attribute field in the anchor data node is read and instantiated into a focus anchor object. All focus anchor objects are combined to form an initial focus anchor coordinate set. When the anchor point data node is not included, calculate the geometric center coordinates of the storyboard polygon plane, use the geometric center coordinates as the default anchor point coordinates, and include the geometric center coordinates in the initial anchor point coordinate set. Extract the local vertex coordinate sequence of the predefined storyboard template, construct a two-dimensional affine transformation matrix based on the canvas screen coordinates corresponding to the release position of the drag command signal and the current view scaling ratio of the system, and use the two-dimensional affine transformation matrix to map the initial set of attention anchor point coordinates and the local vertex coordinate sequence to the two-dimensional canvas global coordinate system, and output the set of attention anchor point coordinates and the set of vertex coordinates.
3. The template-based rapid comic storyboard generation method according to claim 1, characterized in that, Based on the vertex coordinate set, the boundary line segments of the storyboard polygon are extracted and a half-side data structure is constructed. Adjacent half-side pairs whose absolute spatial distance meets a preset distance threshold are selected, and a virtual boundary data table is constructed, including: The boundary line segment is converted into a half-edge data structure, the underlying pointer in the half-edge data structure is configured, and the topological association between the vertex, the unidirectional half-edge and the polygon face is established. Take out any two halves belonging to different split-scene polygon face objects from the half-side data structure, and calculate the dot product of the unit outward normal vectors corresponding to the two halves respectively; Based on the dot product value, pairs of half-sides with the same or perpendicular direction are removed. When the dot product value is less than the set angle determination threshold, it is determined that the two half-sides are facing each other. The set angle determination threshold is used to filter the boundaries of primitives that are facing each other. Calculate the absolute spatial distance between the center points of the two halves facing each other. When the absolute spatial distance is lower than the preset distance threshold, it is determined that they constitute an adjacent boundary relationship. Establish a bidirectional pointer link across the polygon for the two half-sides that constitute the adjacent boundary relationship, and add the pointer references of the adjacent half-side pairs and the calculated absolute spatial distance values as an independent data record item to the virtual boundary data table.
4. The template-based rapid comic storyboard generation method according to claim 1, characterized in that, Calculate the Euclidean distance from the center point of the half-side in the data structure to the set of coordinates of the anchor points of interest, and calculate the corresponding local stiffness coefficient, including: Calculate the Euclidean distance from the center point of the current half to each anchor point in the set of anchor points of interest, and extract the Euclidean distance with the smallest value as the final distance parameter of the current half. A Gaussian attenuation model is used to calculate the local stiffness coefficient of the current half based on the basic stiffness constant, the influence weight coefficient, the base of the natural logarithm, the final distance parameter, and the attenuation control parameter, so that the value of the local stiffness coefficient is negatively correlated with the final distance parameter.
5. The template-based rapid comic storyboard generation method according to claim 1, characterized in that, The system's total energy function is constructed based on the virtual boundary data table, the local stiffness coefficients, the global view vector field data, and the interior angle values of the segmentation polygon calculated based on the vertex coordinate set. This includes: Read the local stiffness coefficients corresponding to each of the adjacent half-side pairs in the virtual boundary data table, use the arithmetic mean of the local stiffness coefficients of each of the adjacent half-side pairs as the equivalent elastic coefficient of the virtual boundary, use the difference between the absolute spatial distance between the adjacent half-side pairs and the set target layout spacing as the deformation, and accumulate the deformation potential energy of all virtual boundaries to form a spacing energy term that measures the global layout gap deviation. Calculate the cosine similarity between the actual reading flow vector, which is formed by the geometric center coordinates of the previous segment polygon extracted from the vertex coordinate set and arranged in a set reading order, pointing to the geometric center coordinates of the next segment polygon, and the reference line-of-sight vector in the global line-of-sight vector field data. Accumulate the flow deviations of all adjacent segment polygon pairs to construct the flow energy term. Based on the half-side data structure, adjacent directed half-side pairs sharing the same vertex are extracted. The coordinate data of the adjacent directed half-side pairs are read to calculate the interior angle values of the segmentation polygon. The difference between the interior angle values of the segmentation polygon and the set limit angle is logarithmically calculated and a negative sign is added to construct the anti-self-intersection interior angle logarithmic barrier energy term. The system's total energy function is constructed by linearly summing the distance energy term, the flow direction energy term, and the anti-self-crossing interior angle logarithmic barrier energy term by the corresponding set distance energy weight coefficient, the set flow direction energy weight coefficient, and the set anti-self-crossing energy weight coefficient.
6. The template-based rapid comic storyboard generation method according to claim 1, characterized in that, Calculating the partial derivative of the total energy function of the system with respect to the set of vertex coordinates, and updating the set of vertex coordinates, includes: Extract the x and y coordinates of all vertices in the vertex coordinate set in the order they are read from memory, and concatenate them into a one-dimensional global state vector. Calculate the Jacobian partial derivative matrix of the total energy function of the system with respect to all vertex coordinate components in the global state vector, obtain the gradient descent direction vector guiding vertex movement, use the conjugate gradient method to perform tentative position updates along the gradient descent direction vector, calculate the tentative coordinate set, and calculate the tentative geometric interior angles of all polygonal face objects under the tentative coordinate set. Each of the trial geometric interior angles is compared with the set legal interior angle opening interval. If the radian value of any trial geometric interior angle exceeds the set legal interior angle opening interval, the trial coordinate set is recalculated after the search step size parameter of the current iteration is reduced proportionally by applying a set attenuation coefficient. When all the tentative geometric interior angles are within the set legal interior angle opening interval and the total energy function value of the system satisfies the sufficient descent condition check, the search step size parameter of the current iteration is determined as the optimal movement step size of the current iteration step. The global state vector is updated based on the optimal movement step size, and then the vertex coordinate set is updated.
7. The template-based rapid comic storyboard generation method according to claim 1, characterized in that, The step of obtaining the set of minimum vertex coordinates that satisfy the convergence condition includes determining whether to terminate the iterative calculation through multiple convergence criteria: When the Euclidean norm of the partial derivative gradient vector of the total energy function of the system is less than or equal to the set gradient convergence tolerance threshold, the energy minimization process is determined to have converged and the set of coordinates of the minimum vertex is obtained. The set gradient convergence tolerance threshold is the limiting norm for determining the convergence of the partial derivative gradient vector. Alternatively, when the absolute change in the total energy function of the system before and after this iteration is less than the set energy change tolerance threshold, the energy minimization process is determined to have converged and the set of coordinates of the minimum vertex is obtained. The set energy change tolerance threshold is the benchmark difference value for determining the convergence of energy change. Alternatively, when the cumulative number of iterations reaches the set maximum number of iterations, a forced termination decision is triggered and the set of coordinates of the minimum vertex is obtained.
8. The template-based rapid comic storyboard generation method according to claim 5, characterized in that, Before performing the step of calculating the partial derivative of the total energy function of the system with respect to the set of vertex coordinates, the method further includes executing a stiffness degradation strategy under congested conditions, including: The geometric areas of all the storyboard polygons are calculated and summed to obtain the total area occupied by global primitives. The total area occupied by global primitives is divided by the total physical available area of the canvas to generate a global congestion index. The global congestion index is compared with the set congestion judgment threshold. When the global congestion index is greater than or equal to the set congestion judgment threshold, the stiffness degradation coefficient is calculated. The set congestion judgment threshold is the baseline congestion ratio that triggers the stiffness degradation strategy. The stiffness degradation factor is multiplied by the spacing energy weight factor corresponding to the spacing energy term to generate an updated spacing energy weight factor, which is then substituted into the total energy function of the system for recalculation, thereby relaxing the strictness of the spacing constraint.
9. The template-based rapid comic storyboard generation method according to claim 1, characterized in that, Graph metadata is generated based on the set of minimum vertex coordinates, including: The set of minimum vertex coordinates is overwritten back into the half-side data structure, and the graph data required by the image rendering pipeline is generated based on the new vertex coordinate relationship. Obtain the set of vertex coordinates before the update as the global state vector of the initial layout state, and store the set of vertex coordinates of the minimum value as the global state vector of the target layout state; The normalized time parameter is calculated based on the current physical time and the set animation transition duration parameter. The normalized time parameter is then processed using a nonlinear smoothing function to generate smooth interpolation weight coefficients.
10. The template-based rapid comic storyboard generation method according to claim 9, characterized in that, The step of outputting the layout-generated storyboard graphics on the screen via the graphics display unit includes: The global state vector of the initial layout state and the global state vector of the target layout state are weighted and fused using the smooth interpolation weight coefficients to calculate and generate the global state vector of the current rendering frame. The system reads the coordinate data of each polygon vertex contained in the global state vector of the current rendering frame, drives the rendering engine to redraw and output the storyboard polygons in the two-dimensional canvas, until the normalized time parameter reaches the set value, and completes the smooth switching of the layout state.