Method and device for simulating laser irradiation
By monitoring touch events and generating Bezier curves, calculating its basic style parameters, the problem that electronic whiteboard large screen devices cannot simulate the movement effect of laser irradiation is solved, dynamic changes in laser rays are realized, and user experience is improved.
Patent Information
- Application Number
- CN202411149296.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-13
AI Technical Summary
Existing electronic whiteboard large screen devices cannot convert lines according to the characteristics of laser rays, and lack the function of simulating the movement effect of laser irradiation.
By monitoring touch events in real time, recording the touch point information of the moving touch events, and generating a Bezier curve based on any two adjacent touch points information, storing it in the touch link list, calculating the basic style parameters of the Bezier curve, and adjusting it Transparency and width, draw laser rays to simulate laser track effects.
The dynamic changes of laser rays are realized, the movement effect of laser irradiation is simulated, and the interactive experience of electronic whiteboards is enhanced.
Smart Images

Figure CN119127000A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic whiteboard large-screen equipment, and in particular to a method and device for simulating laser irradiation. Background Art
[0002] Electronic whiteboard large-screen devices are widely used in education, conferences and other occasions. Among the existing electronic whiteboard large-screen devices, the electronic whiteboard large-screen has functions such as handwriting input, and users can record text or images on the touch screen of the electronic device through a stylus. The canvas of the touch screen displays adjustment buttons for adjusting the thickness of the lines generated by the stylus operation on the touch screen.
[0003] The existing canvas simulation laser irradiation method can simulate laser rays through the lines provided by the software, but it is unable to transform the lines according to the characteristics of the laser rays and unable to simulate the moving effect of laser irradiation. Summary of the invention
[0004] The present invention provides a method and device for simulating laser irradiation, so as to solve the problem that the existing electronic whiteboard large screen cannot perform line transformation according to the characteristics of laser rays and lacks the function of simulating the moving effect of laser irradiation.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a method for simulating laser irradiation, comprising:
[0006] Monitor touch events in real time, and when a mobile touch event is monitored, record the touch point information of the mobile touch event;
[0007] Generate several Bezier curves according to the information of any two adjacent touch points and store them in the touch linked list;
[0008] All Bezier curves in the touch list are drawn on a canvas, basic style parameters of the Bezier curves are calculated according to the arrangement order of the Bezier curves, and laser rays are generated according to the basic style parameters.
[0009] The present invention monitors touch events and generates Bezier curves according to the touch points of the moving touch events and stores them in a touch linked list to calculate the basic style parameters of the Bezier curves, thereby adjusting the basic style of each section of the Bezier curve according to the basic style parameters of the Bezier curves, so that the drawn laser rays can change according to the movement of the touch points, simulating the effect of the laser trajectory.
[0010] Furthermore, the real-time monitoring of touch events, when a mobile touch event is monitored, records the touch point information of the mobile touch event, specifically:
[0011] Monitor the user's touch events in real time according to the touch screen interface, and confirm the event type of each touch event;
[0012] When the touch event is a moving touch event, the coordinates and timestamp of the touch point of the moving touch event are recorded.
[0013] Furthermore, the method generates several Bezier curves according to information of any two adjacent touch points and stores them in a touch linked list, specifically:
[0014] Acquire current touch point information, and if the current touch point information is the touch point of the first mobile touch event, store the current touch point information as a starting point in the touch linked list;
[0015] Otherwise, a Bezier curve is generated according to the current touch point information and the touch point information of the previous mobile touch event, and the Bezier curve is stored in the touch linked list.
[0016] Furthermore, drawing all Bezier curves in the touch list on the canvas, calculating basic style parameters of the Bezier curves according to the arrangement order of the Bezier curves, and generating laser rays according to the basic style parameters is specifically as follows:
[0017] Traversing the touch linked list in reverse order to calculate the basic style parameters of each Bezier curve;
[0018] The transparency and width of each segment of the Bezier curve are adjusted according to the basic style parameters, and the Bezier curve is drawn on the canvas according to the transparency and width to generate laser rays.
[0019] Furthermore, the basic style parameters of each Bezier curve are calculated as follows:
[0020] The position index of each Bezier curve segment is obtained, and the transparency and width of each Bezier curve segment are calculated according to the preset transparency and the preset width, the total length of the touch chain list, and the position index of the Bezier curve.
[0021] In a second aspect, the present invention provides a device for simulating laser irradiation, comprising: a monitoring module, a curve generating module and a drawing module;
[0022] The monitoring module is used to monitor touch events in real time, and when a moving touch event is monitored, the touch point information of the moving touch event is recorded;
[0023] The curve generation module is used to generate a plurality of Bezier curves according to information of any two adjacent touch points, and store the generated Bezier curves in a touch linked list;
[0024] The drawing module is used to draw all Bezier curves in the touch list on the canvas, calculate basic style parameters of the Bezier curves according to the arrangement order of the Bezier curves, and generate laser rays according to the basic style parameters.
[0025] Furthermore, the monitoring module is specifically used for:
[0026] Monitor the user's touch events in real time according to the touch screen interface, and confirm the event type of each touch event;
[0027] When the touch event is a moving touch event, the coordinates and timestamp of the touch point of the moving touch event are recorded.
[0028] Furthermore, the curve generating module is specifically used for:
[0029] Acquire current touch point information, and if the current touch point information is the touch point of the first mobile touch event, store the current touch point information as a starting point in the touch linked list;
[0030] Otherwise, a Bezier curve is generated according to the current touch point information and the touch point information of the previous mobile touch event, and the Bezier curve is stored in the touch chain table.
[0031] Furthermore, the drawing module is specifically used for:
[0032] Traversing the touch linked list in reverse order to calculate the basic style parameters of each Bezier curve;
[0033] The transparency and width of each segment of the Bezier curve are adjusted according to the basic style parameters, and the Bezier curve is drawn on the canvas according to the transparency and width to generate laser rays.
[0034] Furthermore, the drawing module is further used for:
[0035] The position index of each Bezier curve segment is obtained, and the transparency and width of each Bezier curve segment are calculated according to the preset transparency and the preset width, the total length of the touch chain list, and the position index of the Bezier curve. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A schematic flow chart of a method for simulating laser irradiation provided by an embodiment of the present invention;
[0037] Figure 2 A schematic structural diagram of a device for simulating laser irradiation provided by an embodiment of the present invention;
[0038] Figure 3Another schematic flow chart of a method for simulating laser irradiation provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] Embodiment 1
[0041] Please refer to Figure 1 , Figure 1 A schematic flow chart of a method for simulating laser irradiation provided by an embodiment of the present invention includes steps 101 to 103, which are specifically as follows:
[0042] Step 101: monitoring touch events in real time, and when a moving touch event is monitored, recording the touch point information of the moving touch event;
[0043] In this embodiment, the real-time monitoring of touch events, when a mobile touch event is monitored, records the touch point information of the mobile touch event, specifically:
[0044] Monitor the user's touch events in real time according to the touch screen interface, and confirm the event type of each touch event;
[0045] When the touch event is a moving touch event, the coordinates and timestamp of the touch point of the moving touch event are recorded.
[0046] In this embodiment, the user's touch events are continuously monitored through the touch screen interface. Each time a touch event is monitored, it is determined whether it is a moving touch event. If the touch point has not moved, the current touch event is not a moving touch event, and the touch event continues to be monitored. If the touch point has moved, the current touch event is a moving touch event, and the touch point information of the current touch point is recorded, and the touch point information includes the touch point coordinates (X, Y) and the timestamp.
[0047] In this embodiment, whether the touch point moves is determined, thereby determining whether the current touch event is a moving touch event.
[0048] In this embodiment, when the user touches the screen and the touch screen interface monitors the user's touch event, the touch event is judged. If the user starts to move along the screen after touching the screen, the touch event is judged to be a moving touch event and the user's touch point information is recorded.
[0049] In another optional embodiment, a pressure sensor is provided in the touch screen, and when the moving touch event is detected, the touch point information of the moving touch event is recorded, and the touch point information includes the touch force.
[0050] Step 102: Generate several Bezier curves according to information of any two adjacent touch points, and store them in a touch linked list;
[0051] In this embodiment, a plurality of Bezier curves are generated according to information of any two adjacent touch points and stored in a touch linked list, specifically:
[0052] Acquire current touch point information, and if the current touch point information is the touch point of the first mobile touch event, store the current touch point information as a starting point in the touch linked list;
[0053] Otherwise, a Bezier curve is generated according to the current touch point information and the touch point information of the previous mobile touch event, and the Bezier curve is stored in the touch linked list.
[0054] In this embodiment, when a user touches the screen and the touch screen interface monitors a touch event of the user, the touch event is judged. If the user starts to move along the screen after touching the screen, the touch event is judged to be a mobile touch event, and the touch point information of the user is recorded. If the current touch point information is the touch point of the first mobile touch event, the current touch point information is stored as a starting point in the touch linked list; otherwise, a short Bezier curve is generated according to the current touch point information and the touch point information of the previous mobile touch event, and the Bezier curve is stored in the touch linked list.
[0055] In this embodiment, after obtaining any two adjacent touch points, a Bezier curve is immediately generated according to the touch point information, and the generation timestamp of the Bezier curve is recorded, and the Bezier curve is sequentially stored in a touch linked list according to the generation timestamp.
[0056] In this embodiment, the touch linked list is traversed regularly to check the generation time of each Bezier curve. The Bezier curves whose generation time exceeds the preset first time threshold from the current time are removed. Specifically, the current time is obtained and compared with the generation time of each Bezier curve in the linked list. If the generation time exceeds the first time threshold, the Bezier curve is removed from the linked list. The first time threshold is set to 500ms.
[0057] In this embodiment, the linked list is traversed once at a preset time interval, and outdated Bezier curves are removed by comparing the current time with the generation time of the Bezier curve. The time interval is set to 50 ms.
[0058] Step 103: Draw all Bezier curves in the touch list on a canvas, calculate basic style parameters of the Bezier curves according to the arrangement order of the Bezier curves, and generate laser rays according to the basic style parameters.
[0059] In this embodiment, all Bezier curves in the touch list are drawn on the canvas, basic style parameters of the Bezier curves are calculated according to the arrangement order of the Bezier curves, and laser rays are generated according to the basic style parameters, specifically:
[0060] Traversing the touch linked list in reverse order to calculate the basic style parameters of each Bezier curve;
[0061] The transparency and width of each segment of the Bezier curve are adjusted according to the basic style parameters, and the Bezier curve is drawn on the canvas according to the transparency and width to generate laser rays.
[0062] In this embodiment, after obtaining any two adjacent touch points, a Bezier curve is immediately generated according to the touch point information, and the generation timestamp of the Bezier curve is recorded, and the Bezier curve is sequentially stored in a touch linked list according to the generation timestamp.
[0063] In this embodiment, the drawing context of the temporary layer canvas is obtained. The Bezier curves in the touch list are traversed in reverse order. If the touch list is not empty, the Bezier curves are drawn. The Bezier curves in the touch list are drawn on the temporary layer canvas, and the line transparency and width are gradually reduced according to the basic style of each Bezier curve.
[0064] In this embodiment, a Bezier curve is drawn on the temporary layer canvas, and the corresponding transparency and width are set. The further back the curve is, the higher the transparency and the greater the width.
[0065] In this embodiment, the touch linked list is traversed in reverse order, and for each Bezier curve in the touch linked list, the basic style parameters of each Bezier curve are calculated according to its position.
[0066] In this embodiment, the basic style parameters of each Bezier curve are calculated as follows:
[0067] The position index of each Bezier curve segment is obtained, and the transparency and width of each Bezier curve segment are calculated according to the preset initial transparency and the preset initial width, the total length of the touch chain list, and the position index of the Bezier curve.
[0068] In this embodiment, the position index of each Bezier curve segment is obtained, and the transparency of the partitioned Bezier curve is calculated according to the total length of the preset initial transparency touch list and the position index of the Bezier curve. Specifically:
[0069]
[0070] Among them, α m is the transparency of the mth Bezier curve; α0 is the initial transparency, m is the index position of the current Bezier curve, and n is the total length of the linked list.
[0071] In this embodiment, the position index of each Bezier curve segment is obtained, and the width of the partition Bezier curve is calculated according to the total length of the preset initial width touch list and the position index of the Bezier curve. Specifically:
[0072]
[0073] Among them, β m is the width of the mth Bezier curve; β0 is the initial width, m is the index position of the current Bezier curve, and n is the total length of the linked list.
[0074] In this embodiment, the preset initial transparency can be manually set according to demand, and the initial value is set to 1.0, which means completely opaque.
[0075] In this embodiment, the preset initial transparency can be set according to the touch point pressure acquired by the pressure sensor. When the touch point pressure is greater, the preset initial transparency is lower.
[0076] In this embodiment, the preset initial width can be manually set according to demand, and the initial width value is preset to 10 pixels.
[0077] In this embodiment, the preset initial width can be automatically set according to the canvas size and the resolution size.
[0078] In this embodiment, the preset initial width can be set according to the touch point pressure acquired by the pressure sensor. When the touch point pressure is greater, the preset initial width is longer.
[0079] In this embodiment, the moving touch speed is calculated according to the recorded touch point information, and the transparency and width of the Bezier curve are adjusted according to the moving touch speed.
[0080] In this embodiment, other styles of laser rays may also be preset, such as color style, dynamic light and shadow style, etc.
[0081] In this embodiment, the transparency and width are adjusted according to the touch time and the curve position, and can also be adjusted according to parameters such as touch speed and touch pressure to achieve different track effects.
[0082] In this embodiment, by monitoring touch events, generating and drawing Bezier curves, and drawing gradually transparent and thinning tracks, a realistic laser irradiation movement effect is achieved.
[0083] In this embodiment, a number of operation gestures may be preset, and the drawing mode and drawing style of the laser rays on the canvas may be switched according to the operation gestures.
[0084] In this embodiment, the user's hand-raising gesture is collected in advance, and a hand-raising event is set according to the hand-raising gesture. The hand-raising gesture is used to clear the drawing content in the canvas, clear all Bezier curves in the touch list, and stop ray drawing.
[0085] In this embodiment, when a hand-raising event of the user is detected, all Bezier curves in the linked list are cleared, and all drawing contents on the temporary layer canvas are cleared, in preparation for processing the next touch event.
[0086] In this embodiment, by monitoring touch events and generating a Bezier curve based on the touch point of the moving touch event and storing it in a touch linked list, the basic style parameters of the Bezier curve are calculated, and the basic style of each Bezier curve is adjusted according to the basic style parameters of the Bezier curve, so that the drawn laser ray can change according to the movement of the touch point, simulating the effect of the laser trajectory.
[0087] Please refer to Figure 2 , Figure 2 A schematic diagram of the structure of a device for simulating laser irradiation provided by an embodiment of the present invention, comprising a monitoring module 201, a curve generating module 202 and a drawing module 203;
[0088] The monitoring module 201 is used to monitor touch events in real time, and when a moving touch event is monitored, the touch point information of the moving touch event is recorded;
[0089] The curve generating module 202 is used to generate a plurality of Bezier curves according to information of any two adjacent touch points, and store the generated Bezier curves in a touch linked list;
[0090] The drawing module 203 is used to draw all Bezier curves in the touch list on the canvas, calculate basic style parameters of the Bezier curves according to the arrangement order of the Bezier curves, and generate laser rays according to the basic style parameters.
[0091] In this embodiment, the monitoring module is specifically used to:
[0092] Monitor the user's touch events in real time according to the touch screen interface, and confirm the event type of each touch event;
[0093] When the touch event is a moving touch event, the coordinates and timestamp of the touch point of the moving touch event are recorded.
[0094] In this embodiment, the curve generating module is specifically used for:
[0095] Acquire current touch point information, and if the current touch point information is the touch point of the first mobile touch event, store the current touch point information as a starting point in the touch linked list;
[0096] Otherwise, a Bezier curve is generated according to the current touch point information and the touch point information of the previous mobile touch event, and the Bezier curve is stored in the touch chain table.
[0097] In this embodiment, the drawing module is specifically used for:
[0098] Traversing the touch linked list in reverse order to calculate the basic style parameters of each Bezier curve;
[0099] The transparency and width of each segment of the Bezier curve are adjusted according to the basic style parameters, and the Bezier curve is drawn on the canvas according to the transparency and width to generate laser rays.
[0100] In this embodiment, the drawing module is further used for:
[0101] The position index of each Bezier curve segment is obtained, and the transparency and width of each Bezier curve segment are calculated according to the preset transparency and the preset width, the total length of the touch chain list, and the position index of the Bezier curve.
[0102] In this embodiment, by monitoring touch events and generating a Bezier curve based on the touch point of the moving touch event and storing it in a touch linked list, the basic style parameters of the Bezier curve are calculated, and the basic style of each Bezier curve is adjusted according to the basic style parameters of the Bezier curve, so that the drawn laser ray can change according to the movement of the touch point, simulating the effect of the laser trajectory.
[0103] Please refer to Figure 3 , Figure 3 Another schematic flow chart of a method for simulating laser irradiation provided by an embodiment of the present invention.
[0104] In this embodiment, the user's touch events are continuously monitored through the touch screen interface, and each time a touch event is monitored, it is determined whether it is a moving touch event. If the touch point has not moved, the touch event is continuously monitored. If the touch point has moved, the coordinates (X, Y) and timestamp of the current touch point are recorded. A linked list is initialized, and the linked list is used to store Bezier curves. If it is the first touch event, the current touch point is stored in the linked list as the starting point; if it is not the first touch event, a short Bezier curve is generated according to the previous touch point and the current touch point, and stored in the linked list.
[0105] In this embodiment, the linked list is traversed regularly to check the generation time of each Bezier curve, and the Bezier curves generated more than 500ms ago are removed. Specifically: the current time is obtained and compared with the generation time of each Bezier curve in the linked list. If the generation time exceeds 500ms, the Bezier curve is removed from the linked list, and the linked list is traversed once every preset time interval (for example, 50ms).
[0106] In this embodiment, the drawing context of the temporary layer canvas is obtained. The Bezier curves in the linked list are traversed in reverse order, and the Bezier curves in the linked list are drawn on the temporary layer canvas, and the transparency and width of the lines are gradually reduced. Specifically: determine whether the linked list is empty. If the linked list is not empty, start drawing the Bezier curve. Traverse the linked list in reverse order, and calculate the transparency and width of each Bezier curve. The curves at the back have higher transparency and greater width.
[0107] In this embodiment, the Bezier curve is drawn in real time when the user touches and moves. The system continuously monitors touch events and updates the Bezier curve on the temporary layer canvas in real time to achieve a continuous and smooth laser track effect. By regularly removing outdated Bezier curves and adjusting transparency and width in real time, a smoother and more realistic laser track effect is provided.
[0108] In this embodiment, by monitoring touch events and generating a Bezier curve based on the touch point of the moving touch event and storing it in a touch linked list, the basic style parameters of the Bezier curve are calculated, and the basic style of each Bezier curve is adjusted according to the basic style parameters of the Bezier curve, so that the drawn laser ray can change according to the movement of the touch point, simulating the effect of the laser trajectory.
[0109] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for simulating laser irradiation, characterized in that: include: Monitor touch events in real time, and when a mobile touch event is monitored, record the touch point information of the mobile touch event; Generate several Bezier curves according to the information of any two adjacent touch points and store them in the touch linked list; All Bezier curves in the touch list are drawn on a canvas, basic style parameters of the Bezier curves are calculated according to the arrangement order of the Bezier curves, and laser rays are generated according to the basic style parameters.
2. A method for simulating laser irradiation according to claim 1, characterized in that: The real-time monitoring of touch events, when a mobile touch event is monitored, records the touch point information of the mobile touch event, specifically: Monitor the user's touch events in real time according to the touch screen interface, and confirm the event type of each touch event; When the touch event is a moving touch event, the coordinates and timestamp of the touch point of the moving touch event are recorded.
3. A method for simulating laser irradiation according to claim 1, characterized in that: The method generates several Bezier curves according to information of any two adjacent touch points and stores them in the touch linked list, specifically: Acquire current touch point information, and if the current touch point information is the touch point of the first mobile touch event, store the current touch point information as a starting point in the touch linked list; Otherwise, a Bezier curve is generated according to the current touch point information and the touch point information of the previous mobile touch event, and the Bezier curve is stored in the touch linked list.
4. A method for simulating laser irradiation as claimed in claim 1, characterized in that: The step of drawing all Bezier curves in the touch list on a canvas, calculating basic style parameters of the Bezier curves according to the arrangement order of the Bezier curves, and generating laser rays according to the basic style parameters is specifically as follows: Traversing the touch linked list in reverse order to calculate the basic style parameters of each Bezier curve; The transparency and width of each segment of the Bezier curve are adjusted according to the basic style parameters, and the Bezier curve is drawn on the canvas according to the transparency and width to generate laser rays.
5. A method for simulating laser irradiation as claimed in claim 4, characterized in that: The basic style parameters of each Bezier curve are calculated as follows: The position index of each Bezier curve segment is obtained, and the transparency and width of each Bezier curve segment are calculated according to the preset initial transparency and the preset initial width, the total length of the touch chain list, and the position index of the Bezier curve.
6. A device for simulating laser irradiation, characterized in that: include: Monitoring module, curve generation module and drawing module; The monitoring module is used to monitor touch events in real time, and when a moving touch event is monitored, the touch point information of the moving touch event is recorded; The curve generation module is used to generate a plurality of Bezier curves according to information of any two adjacent touch points, and store the generated Bezier curves in a touch linked list; The drawing module is used to draw all Bezier curves in the touch list on the canvas, calculate basic style parameters of the Bezier curves according to the arrangement order of the Bezier curves, and generate laser rays according to the basic style parameters.
7. A device for simulating laser irradiation as claimed in claim 6, characterized in that: The monitoring module is specifically used for: Monitor the user's touch events in real time according to the touch screen interface, and confirm the event type of each touch event; When the touch event is a moving touch event, the coordinates and timestamp of the touch point of the moving touch event are recorded.
8. The device for simulating laser irradiation according to claim 6, characterized in that: The curve generating module is specifically used for: Acquire current touch point information, and if the current touch point information is the touch point of the first mobile touch event, store the current touch point information as a starting point in the touch linked list; Otherwise, a Bezier curve is generated according to the current touch point information and the touch point information of the previous mobile touch event, and the Bezier curve is stored in the touch linked list.
9. The device for simulating laser irradiation according to claim 6, characterized in that: The drawing module is specifically used for: Traversing the touch linked list in reverse order to calculate the basic style parameters of each Bezier curve; The transparency and width of each segment of the Bezier curve are adjusted according to the basic style parameters, and the Bezier curve is drawn on the canvas according to the transparency and width to generate laser rays.
10. The device for simulating laser irradiation according to claim 9, characterized in that: The drawing module is further specifically used for: The position index of each Bezier curve segment is obtained, and the transparency and width of each Bezier curve segment are calculated according to the preset transparency and the preset width, the total length of the touch chain list, and the position index of the Bezier curve.
