Stroke erasing method, terminal and computer readable storage medium
By using the midpoint recursive method to calculate the approximate intersection points between the strokes and the erase area in the electronic whiteboard, the problem of lag caused by the large amount of stroke erase is solved, and more efficient and accurate stroke erase is achieved, improving the user experience.
Patent Information
- Application Number
- CN201910678118.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-25
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2039-07-25
AI Technical Summary
In electronic whiteboard software, the calculation amount of stroke erasing is large, resulting in lag and unresponsive problems, affecting the user experience.
By determining the intersecting strokes in the electronic whiteboard that intersects the erased area, traversing its acquisition points, determining whether the connection line intersects the erased area, and using the midpoint recursive method to calculate the approximate intersection points, thereby splitting the strokes and drawing unerased paragraphs.
Improves the calculation efficiency and accuracy of stroke erasing, reduces the calculation amount, avoids lag and unresponsiveness, and improves the user experience.
Smart Images

Figure CN112286424B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to but are not limited to electronic whiteboard software technology, and specifically, relate to but are not limited to a stroke erasing method, a terminal and a computer-readable storage medium. Background Art
[0002] In electronic whiteboard software, writing and erasing are basic functions. To erase written content, that is, to erase strokes, it is necessary to calculate the remaining part of each stroke after it is erased and redraw it. The basic method is to calculate the intersection points of each stroke with the erased area, split the original strokes by the intersection points, and redraw the unerased parts after the split. In this process, the traditional method is to traverse all the points in each stroke to find the intersection points with the erased area. This method has very accurate calculation results, but the amount of calculation is large. Especially when erasing many strokes at the same time, it is easy to cause freezes and unresponsiveness, affecting the user experience. Summary of the invention
[0003] The stroke erasing method, terminal and computer-readable storage medium provided by the embodiments of the present invention mainly solve the technical problem that the stroke erasing in the related art has a large amount of calculation and is prone to freezes and unresponsiveness.
[0004] In order to solve the above technical problems, an embodiment of the present invention provides a stroke erasing method, comprising:
[0005] Determine the intersecting strokes in the electronic whiteboard that intersect with the erased area;
[0006] Traversing each collection point of the intersecting strokes, and determining whether a line connecting two adjacent collection points intersects with the erasure area;
[0007] When the connecting line intersects with the erasure area, inserting the approximate intersection point of the connecting line and the erasure area into the collection point of the intersecting strokes;
[0008] The intersecting strokes are divided into paragraphs according to the approximate intersection points, and the paragraphs that are not erased by the erasing area are drawn.
[0009] An embodiment of the present invention further provides a terminal, the terminal comprising a processor, a memory and a communication bus;
[0010] The communication bus is used to realize the connection and communication between the processor and the memory;
[0011] The processor is used to execute one or more programs stored in the memory to implement the steps of the stroke erasing method as described above.
[0012] An embodiment of the present invention further provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps of the stroke erasing method as described above.
[0013] The beneficial effects of the present invention are:
[0014] According to the stroke erasing method, terminal and computer-readable storage medium provided by the embodiments of the present invention, intersecting strokes in the electronic whiteboard that intersect with the erasing area are determined; each collection point of the intersecting strokes is traversed to determine whether the line where each two adjacent collection points are located intersects with the erasing area; when the line intersects with the erasing area, the approximate intersection point of the line and the erasing area is determined by midpoint recursion; the intersecting strokes are split into paragraphs according to the approximate intersection point, and the paragraphs that are not erased by the erasing area are drawn; in the embodiments of the present invention, the intersecting strokes are directly determined by the strokes in the electronic whiteboard and the erasing area, the result is accurate, and the adjacent collection points are quickly judged for intersection, and the approximate intersection point is calculated by the midpoint recursive method, which has higher calculation efficiency and accuracy.
[0015] Other features and corresponding beneficial effects of the present invention are described in the latter part of the specification, and it should be understood that at least part of the beneficial effects become obvious from the description in the specification of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 Flow chart of a stroke erasing method according to Embodiment 1 of the present invention;
[0017] Figure 2 A schematic diagram of a boundary rectangle where a stroke is located according to a first embodiment of the present invention;
[0018] Figure 3 is a schematic diagram of the intersection of a stroke and an erase area according to the first embodiment of the present invention;
[0019] Figure 4 is a schematic diagram of the intersection of a line connecting two adjacent collection points and an erased area in the first embodiment of the present invention;
[0020] Figure 5 Schematic diagram of the intersection of a line segment connecting two adjacent acquisition points and an erased area in the first embodiment of the present invention Figure 1 ;
[0021] Figure 6 Schematic diagram of the intersection of a line segment connecting two adjacent acquisition points and an erased area in the first embodiment of the present invention Figure 2 ;
[0022] Figure 7 It is a schematic diagram of splitting a stroke point set into segments according to the first embodiment of the present invention;
[0023] Figure 8 is a flow chart of a stroke erasing method according to a second embodiment of the present invention;
[0024] Fig. 9 This is a schematic diagram of the structure of a terminal according to Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the following is a further detailed description of the embodiments of the present invention through specific implementation methods combined with the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0026] Embodiment 1:
[0027] In the related art, the stroke erasing method is to traverse all the points in each stroke to find the intersection points with the erased area. This method calculates the result very accurately, but the amount of calculation is large. Especially when erasing many strokes at the same time, it is easy to cause freezing and unresponsiveness, which affects the user experience. In some improved algorithms, the method of inserting points in equal parts of the eraser width is used to quickly calculate the intersection points. This method calculates quickly, but when the eraser width is large, there is a problem of inaccurate erased edges. In order to solve the above problem, the embodiment of the present invention provides a stroke erasing method, which further optimizes the traversal process and the process of calculating the intersection points, and reduces the amount of calculation while ensuring the accuracy of the calculation results. Please refer to Figure 1 As shown, Figure 1 A stroke erasing method provided by an embodiment of the present invention comprises:
[0028] S101, determining intersecting strokes in the electronic whiteboard that intersect with an erased area.
[0029] In an embodiment of the invention, there are strokes on the electronic whiteboard. When an eraser is used to erase, the eraser's erasing area intersects with the strokes, and then the intersecting strokes are determined by the intersection operation of the strokes and the erased area, and non-intersecting strokes are quickly filtered out.
[0030] Determining the intersecting strokes specifically includes traversing each stroke segment in the electronic whiteboard, performing intersection calculation based on the bounding rectangle where the stroke is located and the erased area, and determining the intersecting strokes, the strokes include Bezier curves, and the erased area includes a polygonal area. In the embodiment of the present invention, each stroke segment refers to a Bezier curve, and the bounding rectangle of the stroke is the smallest rectangle containing the curve, such as Figure 2 As shown, the boundary rectangle of the stroke 201 is 202; the minimum rectangle and the erasing area of the polygonal area are directly calculated to determine whether there is an overlapping area between the minimum rectangle and the polygonal area. When there is an overlapping area, the stroke corresponding to the minimum rectangle is determined to be an intersecting stroke, such as Figure 3 As shown, assuming that there is a stroke 301 and a quadrilateral erasing area 302, and that a boundary rectangle 303 corresponding to the stroke 301 and the quadrilateral erasing area 302 have an overlapping area, then the stroke 301 is confirmed to be an intersecting stroke.
[0031] S102, traversing each collection point of the intersecting strokes, and determining whether the line connecting each two adjacent collection points intersects with the erasure area.
[0032] It can be understood that in the electronic whiteboard, each stroke is drawn by a Bezier curve using points collected by the system, and then the intersecting strokes include the collection points. All the collection points are traversed, and for each two adjacent collection points, the line connecting the two collection points approximately represents the curve segment where the two points are located. Therefore, the two-point connection line of the intersecting strokes is further filtered to determine whether the line connecting each two adjacent collection points intersects with the erased area, specifically including:
[0033] When at least one of the two collection points is within the erasing area, that is, when any one of the collection points is within the erasing area or both of the collection points are within the erasing area, the line connecting the two collection points intersects the erasing area.
[0034] When both acquisition points are not in the erased area, and it is determined that the length of the connecting line is less than the width w of the erased area; calculate the midpoint of the two acquisition points to determine whether the midpoint is in the erased area; when the midpoint is in the erased area, the connecting line intersects with the erased area; the width of the erased area is the length of the intersection of the horizontal line where the center point of the polygonal area is located and the polygonal area. For example, when the erased area is a rectangle, the width of the rectangle is the width of the erased area. Figure 4 As shown, the two adjacent collection points 401 and 402 of the intersecting strokes are not in the erasing area 403, and the distance between the collection points 401 and 402 is less than the width of the erasing area 403. Figure 4 If the midpoint 404 of the collection point 401 and the collection point 402 is within the erasing area 403, it is considered that the line connecting the two points intersects with the erasing area 403; of course, if the midpoint 404 is not within the erasing area 403, it is considered that the line connecting the two points does not intersect with the erasing area 403, and the line connecting the two points is filtered.
[0035] In the embodiment of the present invention, when both acquisition points are not in the erasing area, and when the length of the connecting line is greater than or equal to the width of the erasing area, the connecting line is split into two first line segments according to the middle of the connecting line; when it is determined that the length of the first line segment is less than the width of the erasing area, it is determined whether the midpoint of the first line segment is in the erasing area; when the midpoint of the first line segment is in the erasing area, the first line segment intersects with the erasing area. That is, when the length of the connecting line of the two acquisition points is greater than or equal to the eraser width w, the midpoints of the two acquisition points are calculated, and the original two acquisition points are split by the midpoint to obtain two first line segments of equal length, namely, the line segment from the first acquisition point to the midpoint and the line segment from the midpoint to the second acquisition point, and it is determined whether each first line segment intersects with the erasing area; if Figure 5 As shown, the length of the line 501 connecting the two collection points is greater than the width of the erased area 502. The line 501 is split into first line segments 503 and 504 according to the midpoint. Assuming that the length of the first line segments 503 and 504 is less than the width of the erased area 502, and the midpoint 505 of the first line segment 503 is in the erased area 502, it is considered that the first line segment 503 intersects with the erased area, and the midpoint 506 of the first line segment 504 is not in the erased area 502, then the first line segment 504 of the two collection points can be filtered.
[0036] It is worth noting that when the length of the first line segment is greater than or equal to the width of the erased area, the midpoint recursive method is continued to be used to calculate the intersection. Specifically, when the length of the first line segment is greater than or equal to the width of the erased area, the midpoint of the first line segment is split until the length of the second line segment after the split is less than the width of the erased area; when the midpoint of the second line segment is within the erased area, the second line segment intersects with the erased area. That is, when the length of the first line segment is greater than or equal to the eraser width w, the midpoint splitting continues until the length is less than the eraser width w, and the midpoint is also used to determine whether the line connecting the two points intersects with the erased area. For example, Figure 6 As shown, the line connecting the two acquisition points includes two first line segments 601, and the length is greater than the width of the erased area 602. The two first line segments 601 are further split at the midpoints of the two points to obtain four second line segments 603-606, and the lengths of the second line segments 603-606 are less than the erased area 602. It is determined whether the midpoints 6031-6061 of the second line segments 603-606 are within the erased area 602. Figure 6 In the example, if the midpoints 6041 and 6051 are within the erased area 602, the second line segments 604 and 605 intersect with the erased area, and if the midpoints 6031 and 6061 are not within the erased area 602, the second line segments 603 and 606 can be filtered out.
[0037] S103: When the connecting line intersects the erased area, determine the approximate intersection point of the connecting line and the erased area by midpoint recursion.
[0038] It can be understood that determining the intersection of the connecting line and the erasure area includes, when the connecting line where two adjacent collection points are located includes multiple line segments, determining that the line segment intersects the erasure area, the line segment includes the above-mentioned first line segment or second line segment, and inserting the approximate intersection point of the connecting line or the line segment of the connecting line and the erasure area into the collection points of the intersecting strokes. Therefore, it is necessary to determine the approximate intersection point of the connecting line or the line segment of the connecting line and the erasure area. Specifically, one of the two points corresponding to the connecting line or the line segment of the connecting line is within the erasure area, and the other point is outside the erasure area; determine that the length of the connecting line or the line segment of the connecting line is less than or equal to m, and take the midpoint of the connecting line or the line segment of the connecting line as the approximate intersection point, m<erasure area width. That is, when one of the two adjacent collection points corresponding to the connecting line is within the erasing area and the other is outside the erasing area; or when the collection point and the midpoint corresponding to the above-mentioned first line segment are respectively inside and outside the erasing area; or the two midpoints corresponding to the above-mentioned second line segment are respectively inside and outside the erasing area, and the length of the connecting line or the first line segment or the second line segment is less than or equal to m, the middle of the connecting line, or the midpoint of the first line segment, or the midpoint of the second line segment is taken as the approximate intersection point; after determining the approximate intersection point, insert the approximate intersection point into the collection points of the intersecting strokes; wherein the value of m can be adjusted according to the stroke line width. Preferably, m=5, the approximate intersection point is more accurate, and the calculation speed is faster. Figure 7 As shown, assuming that the length of the line 701 connecting the two acquisition points is less than m, the midpoint 702 of the line 701 is obtained, the midpoint 702 is used as an approximate intersection point, and the approximate intersection point 702 is inserted between the two acquisition points.
[0039] S104, splitting the intersecting strokes into paragraphs according to the approximate intersection points, and drawing the paragraphs that are not erased by the erased area.
[0040] The stroke point set of the intersecting strokes is split into multiple segments at the approximate intersection points, and the point set of each segment is saved separately. At the same time, it is marked whether each segment is erased, and the segments that are not erased are drawn. Figure 7 As shown, the segment is divided into Segment 1, Segment 2, and Segment 3 according to the approximate intersection 701, and Segment 1 and Segment 3 are redrawn.
[0041] The stroke erasing method provided by the embodiment of the present invention determines the intersecting strokes in the electronic whiteboard that intersect with the erasing area; traverses each collection point of the intersecting strokes, and determines whether the line where each two adjacent collection points are located intersects with the erasing area by means of midpoint recursion; when the line intersects with the erasing area, determines the approximate intersection point of the line and the erasing area by means of midpoint recursion, splits the intersecting strokes into paragraphs according to the approximate intersection point, and draws the paragraphs that are not erased by the erased area. Compared with the erasing method in the related art, the result is more accurate by directly calculating the rectangle formed by the line segments and the erasing area, and the adjacent points are quickly judged for intersection, so the calculation efficiency is higher and more accurate. The intersection point is calculated by using the midpoint recursive method, so the calculation efficiency is higher and more accurate.
[0042] Embodiment 2:
[0043] For ease of understanding, this embodiment uses a more specific example to illustrate the stroke erasing method. Figure 8 As shown, the stroke erasing method includes:
[0044] S801: Determine the intersecting strokes in the electronic whiteboard that intersect with the erased area.
[0045] In an embodiment of the present invention, each existing stroke on the whiteboard is traversed, the boundary rectangle where the stroke is located is calculated, the intersection calculation is performed between the rectangle and the eraser erasure area, the non-intersecting strokes are quickly filtered out, and the intersecting strokes are determined; wherein each stroke generally refers to a Bezier curve, and the erased area is a rectangular area.
[0046] S802: traverse each collection point of the intersecting strokes, and when at least one of the two collection points is within the erasing area, the connecting line intersects with the erasing area.
[0047] Each stroke is drawn by a Bezier curve using points collected by the system, and the intersecting strokes include multiple collection points. For each two adjacent collection points, the line connecting the two collection points is approximately used to represent the curve segment where the two points are located. If any point of the two collection points is in the erasing area, it is considered that the line connecting the two collection points intersects with the erasing area.
[0048] S803: When both acquisition points are not in the erased area, determine whether the length of the connection line is less than the width of the erased area. If yes, go to S804; if not, go to S805.
[0049] S804, calculating the midpoint of the two collected points, and when the midpoint is within the erasing area, ensuring that the connecting line intersects the erasing area.
[0050] When the distance between two acquisition points is less than the eraser area width w, the midpoint of the two acquisition points is calculated: if the midpoint is within the erase area, it is considered that the line connecting the two acquisition points intersects with the erase area, otherwise it does not intersect.
[0051] S805 , recursively split the line at its midpoint, and when the length of the split line segment is less than the width of the erased area, determine whether the split line segment intersects with the erased area based on the midpoint of the split line segment.
[0052] When the distance between two points is greater than or equal to the eraser erasure area width w, calculate the midpoint of the two points, split the original two points by the midpoint, and respectively determine whether the first line segment 1 (from the first point to the midpoint) and the first line segment 2 (from the midpoint to the second point) intersect with the erased area. The distance of the first line segment 1 is equal to the distance of the first line segment 2. When the distance of the first line segment 1 is greater than or equal to the eraser erasure area width w, continue to split by the midpoint of the two points, and recursively calculate until the distance of each segment is less than the eraser erasure area width w. Calculate whether the midpoint of the two points is within the erased area to determine whether the first line segment intersects with the erased area; of course, when the distance of the first line segment 1 is less than the eraser erasure area width w, respectively determine whether the midpoints of the first line segment 1 and the first line segment 2 are within the erased area. If so, it means that the first line segment 1 or the first line segment 2 intersects with the erased area. When the midpoint is not within the erased area, filter out the first line segment whose midpoint is not within the erased area.
[0053] S806: Determine the approximate intersection point between the connected line or the split line segment and the erased area by midpoint recursion.
[0054] In an embodiment of the present invention, an approximate intersection point between a line connecting two adjacent acquisition points that meets a preset condition or a line segment after the line is split and the erasure area is determined. The preset condition includes that one of the two points of the line or the first line segment after the split is within the erasure area and one point is outside the erasure area, and the distance between the line or the line segment is less than or equal to a preset value. The preset value can be adjusted according to the stroke width. For example, the preset value is 5. It should be noted that the width of the erasure area in this embodiment is greater than 5.
[0055] When the distance between the connecting line or splitting line segment is less than or equal to 5, the midpoint of the connecting line or line segment is used as the approximate intersection point; when the distance between the connecting line or line segment is greater than 5, the midpoint of the two points is calculated and the two points are split into two segments by the midpoint. If one point in the first segment (from the first point to the midpoint) is within the erasing area and the other point is outside the erasing area, the two points in the first segment are split by the midpoint of the two points, and the calculation is recursive until the distance between the two points is less than or equal to 5, and the midpoint of the two points is returned as the approximate intersection point. If one point in the second segment (from the midpoint to the second point) is within the erasing area and the other point is outside the erasing area, the approximate intersection point is calculated in the same way.
[0056] S807: Split the intersecting strokes into paragraphs according to the approximate intersection points, and draw the paragraphs that are not erased by the erased area.
[0057] The intersection points calculated above are added to the original point set of the strokes. The stroke point set is split at the intersection points and saved in segments. Each segment is a Segment. At the same time, it is marked whether each Segment is erased, and the unerased Segments are drawn.
[0058] The embodiment of the present invention provides a stroke erasing method, which performs intersection calculation on each stroke segment and the erasing area, traverses all the collection points of the stroke, and for each two adjacent collection points, calculates whether the segment intersects with the erasing area. For the two points intersecting with the erasing area, calculates the approximate intersection point of the segment and the erasing area, and inserts the intersection point into the original point set, splits the stroke point set at the intersection point, and saves it in segments, and marks whether each segment is erased, draws the unerased segments, and quickly filters the strokes and the point sets constituting the strokes for multiple times, which greatly reduces the calculation amount of stroke erasing. At the same time, the calculation accuracy can be adjusted according to the stroke line width, the erasing result is more accurate, the operation efficiency of stroke erasing is improved, and the overall user experience of stroke erasing in the electronic whiteboard is improved.
[0059] Embodiment 3
[0060] An embodiment of the present invention provides a terminal, such as Fig. 9 As shown, it includes a processor 901, a memory 902 and a communication bus 903;
[0061] The communication bus 903 is used to realize the connection and communication between the processor 901 and the memory 902;
[0062] The processor 901 is used to execute one or more programs stored in the memory 902 to implement the following steps:
[0063] Determine the intersecting strokes in the electronic whiteboard that intersect with the erased area;
[0064] Traversing each collection point of the intersecting strokes, and determining whether a line connecting two adjacent collection points intersects with the erasure area;
[0065] When the connecting line intersects the erasing area, determining an approximate intersection point of the connecting line and the erasing area by midpoint recursion;
[0066] The intersecting strokes are divided into paragraphs according to the approximate intersection points, and the paragraphs that are not erased by the erasing area are drawn.
[0067] In an embodiment of the invention, the processor 901 implements the step of determining the intersecting strokes in the electronic whiteboard that intersect with the erased area, specifically including: traversing each stroke in the electronic whiteboard, performing intersection calculation with the erased area based on the boundary rectangle where the stroke is located, and determining the intersecting strokes, wherein the stroke includes a Bezier curve, and the erased area includes a polygonal area.
[0068] It should be noted that the processor 901 determines whether the line between each two adjacent acquisition points intersects with the erasing area, specifically including: when at least one of the two acquisition points is within the erasing area, the line intersects with the erasing area. When both acquisition points are not within the erasing area, and it is determined that the length of the line is less than the width of the erasing area; the midpoint of the two acquisition points is calculated to determine whether the midpoint is within the erasing area; when the midpoint is within the erasing area, the line intersects with the erasing area; on this basis, when the length of the line is greater than or equal to the width of the erasing area, the line is split into two first line segments according to the middle of the line; when it is determined that the length of the first line segment is less than the width of the erasing area, it is determined whether the midpoint of the first line segment is within the erasing area; when the midpoint of the first line segment is within the erasing area, the first line segment intersects with the erasing area. When it is confirmed that the length of the first line segment is greater than or equal to the width of the erasing area, the midpoint of the first line segment is split until the length of the second line segment after the split is less than the width of the erasing area; when the midpoint of the second line segment is within the erasing area, the second line segment intersects with the erasing area.
[0069] For the line segment or line that intersects with the erasure area, one of the two points corresponding to the line or the line segment of the line is within the erasure area, and the other is outside the erasure area; the processor 901 also needs to determine that the length of the line or the line segment of the line is less than or equal to m, and use the midpoint of the line or the line segment of the line as the approximate intersection point, where m<the width of the erasure area; determine that the length of the line or the line segment of the line is greater than m, and split the line or the line segment of the line according to the midpoint of the line until the distance of the sub-segments after the split is less than or equal to m, and use the midpoint of the sub-segments as the approximate intersection point.
[0070] An embodiment of the present invention further provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps of the stroke erasing method of the above embodiment.
[0071] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0072] It can be seen that those skilled in the art should understand that all or some of the steps, systems, and functional modules / units in the above disclosed methods can be implemented as software (which can be implemented with computer program code executable by a computing device), firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component can have multiple functions, or a function or step can be performed by several physical components in cooperation. Some or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit.
[0073] In addition, it is well known to those skilled in the art that communication media generally contain computer readable instructions, data structures, computer program modules or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery media. Therefore, the present invention is not limited to any specific hardware and software combination.
[0074] The above contents are further detailed descriptions of the embodiments of the present invention in combination with specific implementation methods, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A stroke erasing method, characterized in that: include: Determine the intersecting strokes in the electronic whiteboard that intersect with the erased area; Traversing each collection point of the intersecting strokes, and determining whether a line connecting two adjacent collection points intersects with the erasure area; When the connecting line intersects the erasing area, determining an approximate intersection point of the connecting line and the erasing area by midpoint recursion; splitting the intersecting strokes into paragraphs according to the approximate intersection points, and drawing the paragraphs that are not erased by the erasing area; The determining whether the line connecting each two adjacent acquisition points intersects with the erasure area further includes: When both of the two acquisition points are not in the erasing area, and it is determined that the length of the connection line is less than the width of the erasing area; Calculate the midpoint of the two acquisition points, and determine whether the midpoint is within the erasure area; When the midpoint is within the erasure area, the connecting line intersects the erasure area; The step of determining the approximate intersection point between the connecting line and the erasure area by midpoint recursion includes: One of the two points corresponding to the connecting line or the line segment of the connecting line is within the erasing area, and the other is outside the erasing area; Determine that the length of the connecting line or the connecting line segment is less than or equal to m, and use the midpoint of the connecting line or the connecting line segment as the approximate intersection point, where m<erasing area width; The determining that the length of the connecting line or the connecting line segment is greater than m, splitting the connecting line or the connecting line segment according to the midpoint until the distance of the split sub-segments is less than or equal to m, and taking the midpoint of the sub-segment as the approximate intersection point.
2. The stroke erasing method according to claim 1, characterized in that: The step of determining the intersecting strokes in the electronic whiteboard that intersect with the erased area includes: Each stroke in the electronic whiteboard is traversed, and intersection calculation is performed based on the boundary rectangle where the stroke is located and the erasure area to determine the intersecting stroke, wherein the stroke includes a Bezier curve, and the erasure area includes a polygonal area.
3. The stroke erasing method according to claim 2, characterized in that: The determining whether the line connecting each two adjacent acquisition points intersects with the erasure area further includes: When at least one of the two acquisition points is within the erasing area, the connecting line intersects with the erasing area.
4. The stroke erasing method according to claim 1, characterized in that: The determining whether the line connecting each two adjacent acquisition points intersects with the erasure area further includes: When the length of the line is greater than or equal to the width of the erasing area, splitting the line into two first line segments according to the middle of the line; When it is determined that the length of the first line segment is less than the width of the erasure area, determining whether the midpoint of the first line segment is within the erasure area; When the midpoint of the first line segment is within the erasure area, the first line segment intersects the erasure area.
5. The stroke erasing method according to claim 4, characterized in that: The determining whether the line connecting each two adjacent acquisition points intersects with the erasure area further includes: When it is confirmed that the length of the first line segment is greater than or equal to the width of the erasing area, split the midpoint of the first line segment until the length of the second line segment after the split is less than the width of the erasing area; When the midpoint of the second line segment is within the erasing area, the second line segment intersects the erasing area.
6. A terminal, characterized in that: The terminal includes a processor, a memory and a communication bus; The communication bus is used to realize the connection and communication between the processor and the memory; The processor is used to execute one or more programs stored in the memory to implement the steps of the stroke erasing method according to any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the stroke erasing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Line segment erasing method and line segment erasing device
CN106502607A