WO2020199616A1 - 线段吸附方法、装置、设备及存储介质 - Google Patents

线段吸附方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2020199616A1
WO2020199616A1 PCT/CN2019/120855 CN2019120855W WO2020199616A1 WO 2020199616 A1 WO2020199616 A1 WO 2020199616A1 CN 2019120855 W CN2019120855 W CN 2019120855W WO 2020199616 A1 WO2020199616 A1 WO 2020199616A1
Authority
WO
WIPO (PCT)
Prior art keywords
point
adsorption
projection
line segment
line
Prior art date
Application number
PCT/CN2019/120855
Other languages
English (en)
French (fr)
Inventor
林德熙
Original Assignee
广州视源电子科技股份有限公司
广州视睿电子科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州视源电子科技股份有限公司, 广州视睿电子科技有限公司 filed Critical 广州视源电子科技股份有限公司
Publication of WO2020199616A1 publication Critical patent/WO2020199616A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/20Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2219/00Indexing scheme for manipulating 3D models or images for computer graphics
    • G06T2219/20Indexing scheme for editing of 3D models
    • G06T2219/2008Assembling, disassembling

Definitions

  • This application relates to the technical field of interactive smart tablets, for example, to a line segment adsorption method, device, equipment, and storage medium.
  • Interactive smart tablets are one of the more important applications in interactive smart devices, which are widely used in various application scenarios, greatly improving people's work and learning efficiency.
  • teachers can draw plane or three-dimensional geometric diagrams, structural diagrams and other elements on the interactive smart tablet, so that the teacher can explain the teaching content in conjunction with the legend.
  • the teacher can use the ruler tool of the interactive smart tablet to draw a line segment on the canvas, and then drag the line segment onto the three-dimensional element to fit the line point of the line segment to the target part on the three-dimensional element.
  • the embodiments of the present application provide a line segment adsorption method, device, equipment, and storage medium to solve the problem of adjusting the line segment to adsorb the three-dimensional element after adjusting the three-dimensional element adsorbing the line segment in the interactive whiteboard.
  • the embodiment of the present application provides a line segment adsorption method, including:
  • the determining the target three-dimensional element to be adsorbed on the selected line segment according to the line point information, the movement vector, and the line point projection information of each of the three-dimensional elements includes:
  • the candidate adsorption line set is not empty, determine the target adsorption line of the selected line segment from the candidate adsorption line set, and use the three-dimensional element containing the target adsorption line as the target three-dimensional element; otherwise,
  • the target adsorption point of the selected line segment is determined from the set of candidate adsorption points, and the three-dimensional element containing the target adsorption point is used as the target three-dimensional element.
  • the determining a set of candidate adsorption points corresponding to the selected line segment according to the movement vector, the point coordinate information, and the projection information of each visible line point includes:
  • the endpoint coordinates of the endpoint, and the projection point information set For each endpoint of the selected line segment, according to the movement vector, the endpoint coordinates of the endpoint, and the projection point information set, determine the first candidate projection point to be adsorbed by the endpoint, and use the endpoint as The to-be-adsorbed point and each of the first candidate projection points are respectively used as candidate adsorption points, and are associated and added to the candidate adsorption point set;
  • the second candidate projection point corresponding to the selected point on the projection edge to be adsorbed is determined, and the selected point is regarded as the point to be adsorbed
  • the points and each of the second candidate projection points are respectively used as candidate adsorption points, and are associated and added to the candidate adsorption point set.
  • determining the first candidate projection point to be adsorbed by the endpoint according to the movement vector, the endpoint coordinates of the endpoint, and the projection point information set includes:
  • the projection point is determined as the first candidate projection point to be adsorbed by the endpoint.
  • the determining the first candidate projection point to be adsorbed by the endpoint according to the movement vector, the endpoint coordinates of the endpoint, and the projection point information set includes:
  • each effective projection point in the set of effective projection points determine the effective coordinate vector from the endpoint to the effective projection point based on the endpoint coordinates and the point projection coordinates of the effective projection point;
  • the effective projection point is determined as the first candidate projection point to be absorbed by the end point.
  • the determining the effective area in the canvas based on the movement vector and the endpoint coordinates of the endpoint includes:
  • the intersecting area of the first area and the second area is determined as an effective area; or, the first area is determined as an effective area; or, the second area is determined as an effective area.
  • the determining the second candidate projection point corresponding to the selected point on the projection edge to be adsorbed according to the movement vector, the coordinate of the selected point, and the first projection edge information set includes:
  • the determining the target adsorption point of the selected line segment from the set of candidate adsorption points includes:
  • the determining the set of candidate adsorption lines corresponding to the selected line segment according to the movement vector, the line marking information, and the line projection markings in each of the visible line point projection information includes:
  • the constructing a parallelogram area for adsorption screening according to the movement vector and the line marking information includes:
  • the filtering candidate adsorption lines of the selected line segment from the second projection edge information set according to the parallelogram area includes:
  • For each second projection edge in the second projection edge information set determine whether the second projection edge corresponds to the selected line segment according to the line projection label of the second projection edge and the line label information parallel;
  • the second projection edge is determined as a candidate adsorption line of the selected line segment.
  • the adsorption screening conditions include at least one of the following:
  • intersection point between the extension line of the second projection edge and the second threshold distance side as the second edge, and the third intersection point is located on the second projection edge;
  • the extension line of the second projection edge and the first threshold distance side and the second threshold distance side as the second side respectively have a fourth intersection point and a fifth intersection point, and the second projection edge is connected to the fourth intersection point and the fifth intersection point. on-line.
  • the determining the target adsorption line of the selected line segment from the candidate adsorption line set includes:
  • the line adsorption distance of each candidate target line is compared, and the candidate target line corresponding to the minimum adsorption distance is determined as the target adsorption line.
  • the controlling the selected line segment to be adsorbed to the target three-dimensional element includes:
  • the selected line segment is controlled to shift the adsorption distance of the target point along the target adsorption vector, so that the point to be adsorbed on the selected line segment is adsorbed with the target adsorption point on the target three-dimensional element.
  • the controlling the selected line segment to be adsorbed to the target three-dimensional element includes:
  • the selected line segment is controlled to shift the adsorption distance of the target line along the adsorption movement direction, so that the selected line segment is adsorbed to the target adsorption line on the target three-dimensional element.
  • the display of the combined three-dimensional element formed after adsorption includes:
  • the first combined stereoscopic element is projected and displayed on the canvas.
  • the display of the combined three-dimensional element formed after adsorption includes:
  • the second combined stereoscopic element is projected and displayed on the canvas.
  • the method further includes:
  • Control and adjust the combined three-dimensional element and display the combined three-dimensional element after state adjustment.
  • the method further includes:
  • Controlling and adjusting the selected line segment respectively displaying the current state of the selected line segment in the combined three-dimensional element and the target three-dimensional element.
  • the embodiment of the present application further provides a line segment adsorption device, including:
  • the first determining module is configured to determine the line point projection information of each three-dimensional element displayed on the canvas;
  • the first response module is configured to obtain line point information of the selected line segment in response to receiving a selection operation acting on any line segment element in the canvas;
  • the second response module is configured to determine a movement vector corresponding to the line segment to be adsorbed in response to receiving a movement operation acting on the selected line segment;
  • the second determining module is configured to determine the target three-dimensional element to be adsorbed on the selected line segment according to the line point information, the movement vector, and the line point projection information of each of the three-dimensional elements;
  • An adsorption control module configured to control the adsorption of the selected line segment to the target three-dimensional element
  • the combined display module is configured to display combined three-dimensional elements formed after adsorption.
  • the second determining module includes:
  • An information acquisition unit configured to extract point coordinate information and line label information in the line point information, and obtain the visible line point projection information of each three-dimensional element based on the line point projection information of each three-dimensional element;
  • a candidate point determination unit configured to determine a set of candidate adsorption points corresponding to the selected line segment according to the movement vector, the point coordinate information, and the projection information of each visible line point;
  • a candidate line determining unit configured to determine a set of candidate adsorption lines corresponding to the selected line segment according to the movement vector, the line marking information, and the line projection markings in each of the visible line point projection information;
  • the adsorption target determination unit is configured to determine the target adsorption line of the selected line segment from the candidate adsorption line set when the candidate adsorption line set is not empty, and use the three-dimensional element containing the target adsorption line as the target Three-dimensional element; otherwise,
  • the target adsorption point of the selected line segment is determined from the set of candidate adsorption points, and the three-dimensional element containing the target adsorption point is used as the target three-dimensional element.
  • the candidate point determination unit includes:
  • the first obtaining subunit is configured to obtain the endpoint coordinates of the two ends of the selected line segment and the selected point coordinates of any selected point on the line segment in the point coordinate information;
  • the second acquisition subunit is configured to extract the point projection coordinates and line projection labels in each of the visible line point projection information, and obtain the projection point information set and the first projection edge information set respectively;
  • the first point determination subunit is set to determine the first candidate for the end point to be adsorbed according to the movement vector, the end point coordinates of the end point and the projection point information set for each end point of the selected line segment Projecting points, and using the endpoint as a point to be adsorbed and each of the first candidate projection points as candidate adsorption points respectively, and adding them to the candidate adsorption point set in association;
  • the second point determination subunit is configured to determine a second candidate projection point corresponding to the selected point on the projection edge to be adsorbed according to the movement vector, the coordinates of the selected point, and the first projection edge information set, and The selected point is used as a point to be adsorbed and each of the second candidate projection points is respectively used as a candidate adsorption point, and the association is added to the candidate adsorption point set.
  • the first point determination subunit is set to:
  • the endpoint is used as a point to be adsorbed and each of the first candidate projection points is respectively used as a candidate adsorption point, and the association is added to the candidate adsorption point set.
  • the first point determination subunit is set to:
  • each effective projection point in the set of effective projection points determine the effective coordinate vector from the endpoint to the effective projection point based on the endpoint coordinates and the point projection coordinates of the effective projection point;
  • the endpoint is used as a point to be adsorbed and each of the first candidate projection points is respectively used as a candidate adsorption point, and the association is added to the candidate adsorption point set.
  • the determining the effective area in the canvas based on the movement vector and the endpoint coordinates of the endpoint includes:
  • the intersecting area of the first area and the second area is determined as an effective area; or, the first area is determined as an effective area; or, the second area is determined as an effective area.
  • the second point determination subunit is set to:
  • the selected point is used as a point to be adsorbed and each of the second candidate projection points is respectively used as a candidate adsorption point, and the association is added to the candidate adsorption point set.
  • the determining the target adsorption point of the selected line segment from the set of candidate adsorption points includes:
  • the candidate line determination unit includes:
  • An area determination subunit configured to construct a parallelogram area for adsorption screening according to the movement vector and the line marking information
  • the information screening subunit is set to form a second projection side information set according to the line projection indication in the projection information of each visible line point;
  • a line determination subunit configured to filter candidate adsorption lines of the selected line segment from the second projection edge information set according to the parallelogram area;
  • the set determining subunit is configured to obtain a candidate adsorption line set including each of the candidate adsorption lines of the selected line segment.
  • the area determining subunit is set to:
  • the set adsorption distance threshold value is the second side length
  • the side included angle is the included angle value or the complementary angle of the included angle value.
  • the line determination subunit is set to:
  • For each second projection edge in the second projection edge information set determine whether the second projection edge corresponds to the selected line segment according to the line projection label of the second projection edge and the line label information parallel;
  • the second projection edge is determined as a candidate adsorption line of the selected line segment.
  • the adsorption screening conditions include at least one of the following:
  • intersection point between the extension line of the second projection edge and the second threshold distance side as the second edge, and the third intersection point is located on the second projection edge;
  • the extension line of the second projection edge and the first threshold distance side and the second threshold distance side as the second side respectively have a fourth intersection point and a fifth intersection point, and the second projection edge is connected to the fourth intersection point and the fifth intersection point. on-line.
  • the determining the target adsorption line of the selected line segment from the candidate adsorption line set includes:
  • the line adsorption distance of each candidate target line is compared, and the candidate target line corresponding to the minimum adsorption distance is determined as the target adsorption line.
  • the adsorption control module when the target three-dimensional element is obtained by determining a target adsorption point, the adsorption control module is set to:
  • the selected line segment is controlled to shift the adsorption distance of the target point along the target adsorption vector, so that the point to be adsorbed on the selected line segment is adsorbed with the target adsorption point on the target three-dimensional element.
  • the adsorption control module when the target three-dimensional element is obtained by determining a target adsorption line, the adsorption control module is set to:
  • the selected line segment is controlled to shift the adsorption distance of the target line along the adsorption movement direction, so that the selected line segment is adsorbed to the target adsorption line on the target three-dimensional element.
  • the combined display module is set to:
  • the first combined stereoscopic element is projected and displayed on the canvas.
  • the combined display module is set to:
  • the second combined stereoscopic element is projected and displayed on the canvas.
  • it further includes: a first receiving module configured to receive a first state adjustment operation after displaying the combined three-dimensional element formed after adsorption, the first state adjustment operation acting on the target of the combined three-dimensional element Three-dimensional element
  • the first display module is configured to control and adjust the combined three-dimensional element, and display the combined three-dimensional element after state adjustment.
  • it further includes:
  • the second receiving module is configured to receive a second state adjustment operation after displaying the combined three-dimensional element formed after adsorption, and the second state adjustment operation acts on the selected line segment of the combined three-dimensional element;
  • the second display module is configured to control and adjust the selected line segment, and respectively display the current state of the selected line segment in the combined three-dimensional element and the target three-dimensional element.
  • the embodiment of the present application also provides a line segment adsorption device, including:
  • Memory and one or more processors
  • the memory is configured to store one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the methods provided in the embodiments of the present application.
  • the embodiment of the present application further provides a storage medium containing computer-executable instructions, which are used to execute the method described in the embodiment of the present application when the computer-executable instructions are executed by a computer processor.
  • the line segment adsorption method, device, device and storage medium provided above can obtain the line point projection information of each three-dimensional element displayed on the canvas, and determine the selected line segment according to the user's selection operation on the line segment in the canvas
  • the line point information also determines the movement vector of the selected line segment according to the movement operation of the user on the selected line segment, which can be based on the line point information of the selected line segment, the movement vector and the line point projection information of each three-dimensional element.
  • Determine the target three-dimensional element that can be adsorbed by the line segment control the adsorption of the selected line segment to the target three-dimensional element during the moving process, and display the combined three-dimensional element formed after the selected line segment is adsorbed.
  • the above-mentioned technical solution of this embodiment can determine the target three-dimensional element that can be adsorbed from each three-dimensional element and adsorb it based on the line point information and the movement vector of the selected line segment, and the line point projection information of each three-dimensional element in the canvas.
  • the intelligent adsorption of line segments to three-dimensional elements is realized, forming a combined three-dimensional element with the selected line segment and the target three-dimensional element as a whole, so that the state of the adsorbed line segment can be adjusted when the state of the target three-dimensional element in the combined three-dimensional element is adjusted.
  • the tedious operation of manually re-adjusting the state of the line segment is avoided, and the teaching experience is improved.
  • FIG. 1 is a flowchart of a line segment adsorption method provided by Embodiment 1 of the application;
  • Figure 3 shows an example of the projection of the three-dimensional element behind the canvas
  • Figure 4 shows a schematic diagram of the three-layer representation of the data information of the selected line segment
  • Figure 5 shows an example display of combined three-dimensional elements
  • Figure 6 shows another display example diagram of combined three-dimensional elements
  • Figure 7 shows another display example of combined three-dimensional elements
  • FIG. 8 is a flowchart of the implementation of determining a set of candidate adsorption points provided in the second embodiment of the application.
  • FIG. 9 is a diagram of an implementation example of screening projection points in the projection point information set.
  • FIG. 10 is a diagram of another implementation example of screening projection points in the projection point information set.
  • FIG. 11 is a flowchart of the implementation of determining a set of candidate adsorption lines provided in the second embodiment of the application.
  • Figure 12 is an example diagram of a parallelogram constructed for adsorption screening
  • Figures 13-15 respectively show an effect display diagram of the set adsorption screening conditions
  • FIG. 16 is a structural block diagram of a line segment adsorption device provided in Embodiment 3 of the application.
  • FIG. 17 is a schematic structural diagram of a line segment adsorption device provided by Embodiment 4 of the application.
  • FIG. 1 is a flowchart of a line segment adsorption method provided in Embodiment 1 of this application.
  • This embodiment is suitable for the case where the selected line segment in the canvas is adsorbed to the three-dimensional element.
  • the method provided in this embodiment can be executed by a line segment adsorption device, which can be implemented by software and/or hardware.
  • the line segment adsorption device can be composed of two or more physical entities, or can be composed of one physical entity.
  • the line segment adsorption device may be a computer, a mobile phone, a tablet, or an interactive smart tablet.
  • an interactive smart tablet is used as a line segment adsorption device for exemplary description.
  • the interactive smart tablet can be an integrated device that controls the content displayed on the display tablet through touch technology and realizes human-computer interaction. It integrates a projector, an electronic whiteboard, a screen, a sound, a TV, and a video conference. One or more functions such as a terminal.
  • the display screen of the interactive smart tablet may be a capacitive screen, a resistive screen, an infrared screen, an electromagnetic screen, or the like. The user can perform touch operations on the interactive smart tablet with a finger or a stylus.
  • the interactive smart tablet is installed with application software that comes with the operating system, and at the same time, is also installed with application software downloaded from a third-party device or server.
  • the type and content of the application software can be set according to actual conditions.
  • the application software has functions such as writing, drawing, annotation, courseware production, and display and playback.
  • the application software has the functions of drawing, courseware production, and display and playback.
  • the courseware production refers to the input or insertion of elements on the canvas of the courseware editing page through a user on a computer device such as an interactive smart tablet.
  • the element can be a three-dimensional element or a two-dimensional element, etc.
  • the three-dimensional element or two-dimensional element can be drawn directly on the canvas, or first drawn based on the drawing function and inserted into the canvas through an insert operation, and the three-dimensional element can be a three-dimensional geometric element such as Tetrahedrons, cuboids, cylinders, cones, etc., two-dimensional elements can be points, lines, and plane geometric elements such as quadrilaterals, polygons, etc.
  • display playback can refer to the courseware demonstration in which the content in the courseware editing page is used as the demonstration playback page in the teaching mode, and the display playback can be triggered by the demo playback button.
  • this embodiment can display and play the element content edited by the user on the editing canvas, and in the display play mode, the state of the display element can also be adjusted, such as selecting and moving the displayed line segment Or rotating operation and so on.
  • the line segment adsorption method provided in this embodiment includes:
  • the canvas can be understood as a two-dimensional plane carrier for element drawing or element display.
  • the three-dimensional element displayed on the canvas is equivalent to the element after the drawn three-dimensional element is projected on a two-dimensional plane.
  • the rendering of the three-dimensional element is realized in a set three-dimensional scene, and the three-dimensional element is drawn by the principle of three-dimensional matrix projection.
  • the three-dimensional element projection is displayed on the canvas.
  • the line point projection information can be understood as the marking information on the canvas after the lines and points of the three-dimensional elements drawn in the three-dimensional scene are projected.
  • the points of the three-dimensional elements in the three-dimensional scene are in the form of spatial coordinates.
  • the side of the solid element can be represented by the spatial coordinates of two points on the side of the solid element.
  • the projection coordinates of the vertices of the three-dimensional elements can be obtained after the three-dimensional elements are projected on the canvas.
  • the projection coordinates of the vertices can also represent the three-dimensional Line projection marks of each side of the element on the canvas.
  • the projection coordinates of each vertex of the solid element and the line projection indication of each side are collectively referred to as line point projection information.
  • this embodiment can pre-determine the line point projection information of the three-dimensional element, and store the three-dimensional element's offline point space information in the three-dimensional space and the line point projection information in the canvas in association with each other. This step can trigger the line segment adsorption operation At the time, the line point projection information of each three-dimensional element currently displayed in the canvas is obtained from the line point space and projection information stored in the association.
  • planar geometric elements such as points, lines, or surfaces can also be displayed.
  • This embodiment realizes the adsorption of line segments to three-dimensional elements.
  • the selection operation can be understood as the user clicking or touching the elements in the canvas through the mouse or the touch screen
  • the selected operation this step can respond to the user's selected operation on any line segment element in the canvas.
  • the line point information may include the selected line segment The point coordinates of the endpoint and any selected point on the line in the plane coordinate system, and the line label information of the line to which the selected line segment belongs based on the coordinate information of the two ends of the selected line segment.
  • this step can monitor the selected operation triggered by the user, and determine the target object of the selected operation, from which the pre-recorded related label information of the target object can be obtained.
  • the target object is a piece of A line segment
  • the line segment can be recorded as a selected line segment
  • the pre-recorded related marking information of the selected line segment is the end point of the selected line segment and the line point information of the corresponding line.
  • the movement operation can be understood as an operation in which the user drags the selected line segment through the mouse or touches the touch screen to drag the selected line segment. This step can respond to the user's action on the selected line segment Mobile operation.
  • its response to the operation may be embodied in monitoring the dragging process of the selected line segment to obtain the drag operation of the selected line segment. After the drag point coordinates of the at least two drag points, and based on the obtained at least two drag point coordinates, the movement vector of the selected line segment in the drag can be determined.
  • S104 According to the line point information, the movement vector, and the line point projection information of each of the three-dimensional elements, determine the target three-dimensional element to be adsorbed on the selected line segment.
  • the line point information may be the endpoint on the selected line segment, the selected point, and the point coordinate information and line label information of the line to which the line belongs, and the movement vector may be the selected line segment. Movement direction information when moving (dragging).
  • the line point projection information of each three-dimensional element can be all three-dimensional elements based on points and lines displayed on the canvas (such as cuboid, tetragonal, cone, and cylinder, etc.). Since the sphere is not formed based on line points, it is not used as the original Point projection information provided by each of the suction targets of the embodiment). This embodiment realizes the adsorption of the line segment to the three-dimensional element.
  • the adsorbed three-dimensional element may be referred to as a target three-dimensional element, and the target three-dimensional element may be any three-dimensional element composed of points and lines displayed on the canvas.
  • the method for determining the target three-dimensional element to be adsorbed by the selected line segment can be considered in a variety of situations. For example, one can consider the adsorption of the end point in the selected line segment to the vertex of the three-dimensional element, and the other One can consider the adsorption of any point in the selected line segment to the edge of the three-dimensional element, and another case can consider the adsorption of the line to which the selected line segment belongs to the edge of the three-dimensional element.
  • this step can be used to determine the target three-dimensional element in the above several cases, and the candidate adsorption line set or the candidate adsorption point set of the selected line segment relative to the three-dimensional element can be determined according to the situation.
  • this step can determine the end point of the selected line segment according to the point coordinate information in the line point information of the selected line segment, the movement vector, and the point projection coordinates of the projection point in the solid element.
  • the candidate adsorption point for adsorption, and the association between the candidate adsorption point and the corresponding to-be-adsorbed point on the selected line segment is added to the candidate adsorption point set.
  • the to-be-adsorbed point can be understood as the endpoint or the selected point on the selected line segment to be adsorbed. Fixed point.
  • this step can be based on the point coordinate information in the line point information of the selected line segment ,
  • the movement vector and the line projection mark of the projection edge of the three-dimensional element (it can be marked by the point projection coordinates of the projection point) to determine the candidate adsorption point that can be adsorbed from the point on the selected line segment to the edge of the three-dimensional element.
  • the candidate adsorption point and the corresponding to-be-adsorbed point on the selected line segment are associated and added to the candidate adsorption point set.
  • this step can be based on the line marking information in the line point information of the selected line segment (which can be marked by the point coordinate information), the movement vector and the projection edge of the solid element
  • the line projection mark of is used to determine the candidate adsorption line that can be adsorbed from the selected line segment to the three-dimensional element, and the candidate adsorption line can be associated with the selected line segment and added to the candidate adsorption line set.
  • the candidate adsorption line set (the set may be empty) and the candidate adsorption point set for determining the target three-dimensional element can be determined.
  • this step uses the screening rule to select the candidate adsorption line set or The corresponding target adsorption line or target adsorption point is determined in the set of candidate adsorption points.
  • the target adsorption point or the three-dimensional element to which the target adsorption line belongs can be determined, and the three-dimensional element is used as the target three-dimensional element.
  • only one target adsorption point or one target adsorption line can be determined through the set screening rules. Therefore, only one target three-dimensional element is determined in this step.
  • S105 Control the selected line segment to be adsorbed to the target three-dimensional element.
  • the adsorption of the selected line segment to the target three-dimensional element can be controlled by means of displacement adsorption.
  • the displacement adsorption includes the adsorption distance and the adsorption vector of the target to be adsorbed on the target three-dimensional element in the selected line segment, In this way, the target to be sucked in the selected line segment can be controlled to offset the determined absorption distance along the determined absorption vector, so as to realize the absorption of the selected line segment to the target three-dimensional element.
  • the target to be sucked can be an end point in a selected line segment or any point on the line segment, or a selected line segment, and the adsorbable target can be an adsorbable point in a target three-dimensional element or an adsorbable point.
  • Adsorption line In one embodiment, the target to be sucked and the suckable target may be determined based on the target adsorption point or target adsorption line on which the target three-dimensional element is determined in S104.
  • the adsorbable target when the target three-dimensional element is determined by the target adsorption point, the adsorbable target is directly the target adsorption point, and the target to be adsorbed is the target adsorption point associated with the target adsorption point (the selected point on the endpoint or line segment) );
  • the target three-dimensional element is determined by the target adsorption line
  • the adsorbable target is directly the target adsorption line
  • the target to be adsorbed is the selected line segment itself.
  • the method for determining the sucking distance and the sucking vector is also different.
  • the combined three-dimensional element can be understood as a three-dimensional element formed by combining the selected line segment to the target three-dimensional element.
  • the display in this step can refer to the display of the combined three-dimensional element on the canvas.
  • the combined three-dimensional element is displayed on the canvas according to the line point projection information of the combined three-dimensional element.
  • the line segment adsorption method can determine the target three-dimensional element that can be adsorbed from each three-dimensional element according to the line point information and movement vector of the selected line segment, and combined with the line point projection information of each three-dimensional element in the canvas.
  • Adsorption which realizes the intelligent adsorption of the line segment to the three-dimensional element, forming a combined three-dimensional element with the selected line segment and the target three-dimensional element as a whole, so that the adsorption can be adjusted when the state of the target three-dimensional element in the combined three-dimensional element is adjusted.
  • the state of the line segment avoids the tedious operation of manually re-adjusting the state of the line segment and improves the teaching experience.
  • the line point projection information of the selected line segment to determine the target three-dimensional element to be adsorbed may include: extracting point coordinate information and line label information in the line point information, and based on the line point projection information of each of the three-dimensional elements , Obtain the visible line point projection information of each of the three-dimensional elements; determine the candidate adsorption point set corresponding to the selected line segment according to the movement vector, the point coordinate information, and each of the visible line point projection information; The movement vector, the line marking information, and the line projection markings in each of the visible line point projection information determine the candidate adsorption line set corresponding to the selected line segment; if the candidate adsorption line set is not empty, then Determine the target adsorption line of the selected line segment in the candidate adsorption line
  • This embodiment after displaying the combined three-dimensional element formed after adsorption, further includes: receiving a first state adjustment operation, where the first state adjustment operation acts on the target three-dimensional element of the combined three-dimensional element;
  • Control and adjust the combined three-dimensional element and display the combined three-dimensional element after state adjustment.
  • this embodiment further includes:
  • Receive a second state adjustment operation where the second state adjustment operation acts on the selected line segment of the combined three-dimensional element; control and adjust the selected line segment, and respectively display the selected line segment and the target three-dimensional element in the combined three-dimensional element The current state of the element.
  • a line segment adsorption method provided in an embodiment of the present application includes the following operations:
  • S201 Determine the line point projection information of each three-dimensional element displayed on the canvas.
  • a selected operation generated by a user's touch and click on the touch screen is received, and the selected line segment selected by the user is determined in response to the selected operation, and line point information of the selected line segment can be obtained.
  • S203 In response to receiving a movement operation acting on the selected line segment, determine a movement vector corresponding to the line segment to be adsorbed.
  • the movement operation generated by the user's touch and drag on the selected line segment is received, and the movement vector of the selected line segment is determined in response to the movement operation.
  • the following S204 to S209 in this embodiment are implementation steps for determining the target three-dimensional element.
  • S204 Extract point coordinate information and line label information from the line point information, and obtain the visible line point projection information of each three-dimensional element based on the line point projection information of each three-dimensional element.
  • the line point information of the selected line segment and the line point projection information of the displayed three-dimensional elements are the prerequisite information for determining the target three-dimensional element.
  • the point coordinates are extracted from the line point information of the selected line segment.
  • Information coordinate information of the end point of the selected line segment, coordinate information of any selected point on the selected line segment
  • line marking information of the line to which the selected line segment belongs End point coordinates to indicate.
  • this step obtains the visual line point projection information of each three-dimensional element from the line point projection information of each three-dimensional element.
  • the visual line point projection information can be understood as the projection of the three-dimensional element onto the canvas, and the user The projection information of the edges or points of the three-dimensional elements that can be actually seen on the interactive level.
  • the three-dimensional element after the three-dimensional element is projected onto the two-dimensional canvas, it includes two parts: visible line (side) points and non-visible line (side) points.
  • the line segment is only The visible line (edge) points can be adsorbed. Therefore, this embodiment extracts the visible line point projection information of the visible line point from the line point projection information based on this step.
  • the projection direction of the three-dimensional element after the projection direction of the three-dimensional element is known, it is possible to determine which edges and points of the three-dimensional element are invisible after being projected. Therefore, in this step, the projection information of the line point can be directly found to be in the projected state. The projection information corresponding to the edges and points in the non-visual state can be extracted from the projection information of the visible line points.
  • FIG. 3 shows an example diagram of the projection of the three-dimensional element behind the canvas.
  • the cuboid 21 is a three-dimensional projection element constructed in a three-dimensional scene and projected onto the canvas through a three-dimensional matrix, and the cuboid 21 contains vertices A, B, C, D, A', B in the three-dimensional scene ', C'and D', and the above vertices also respectively constitute the sides of the rectangular parallelepiped 21.
  • This embodiment can determine the point space coordinates of the above vertices and the associated point projection coordinates after projection.
  • the three-dimensional line marking information of the edge and the associated line projection marking after projection can be determined.
  • the vertex A'of the cuboid 21 projected on the canvas is in a non-visible state, and the edges AA', A'B' and A'D' composed of vertex A'are also in the non-visible state. It can be considered that when the cuboid 21 is in the current state, the line segment to be adsorbed cannot be adsorbed to the vertex A'or the side AA', the side A'B' and the side A'D'.
  • the vertices can be extracted The visible line point projection information of A', side AA', side A'B', and the remaining 7 points and 9 sides outside of side A'D'.
  • S205 Determine a set of candidate adsorption points corresponding to the selected line segment according to the movement vector, the point coordinate information, and the projection information of each visible line point.
  • the determination of the target three-dimensional element in this embodiment is considered in three different adsorption situations, and the premise for achieving the three different adsorption situations is to determine the set of candidate adsorption points and/or the set of candidate adsorption lines corresponding to the selected line segment. .
  • a set of candidate adsorption points for determining the target three-dimensional element is obtained.
  • the candidate adsorption point set can be understood as: a set of projection points on the three-dimensional element as candidate adsorption points for the selected line segment, and the candidate adsorption point set includes the selected The point coordinates of the point to be adsorbed on the fixed line segment and the point projection coordinates of the candidate adsorption point associated with it.
  • the situations for performing the determination of the candidate adsorption point set include: the end point of the selected line segment is adsorbed to the vertex of the solid element, and the point on the selected line segment is adsorbed to the edge of the solid element.
  • the situation where the point on the selected line segment is adsorbed to the edge of the three-dimensional element can actually be regarded as the situation where the point in the selected line segment can be adsorbed to the point on the edge of the three-dimensional element.
  • this step may select the end point coordinates, the movement vector, and the projection information of each visible line point in the point coordinate information corresponding to the selected line segment, and combine the given vertex filtering rules from each visible vertex of the solid element Can filter to determine the candidate adsorption point of the endpoint; it can also be based on the selected point coordinate, movement vector and projection information of each visible line point of any selected point in the point coordinate information corresponding to the selected line segment, combined with the given intersection point screening rule Screen the visible edges of the three-dimensional elements to determine the candidate adsorption points that can be adsorbed by the selected point.
  • S206 Determine a candidate adsorption line set corresponding to the selected line segment according to the movement vector, the line mark information, and the line projection mark in each of the visible line point projection information.
  • this step obtains the candidate adsorption line set for determining the target three-dimensional element, where the situation of performing the candidate adsorption line set determination includes: the selected line segment is adsorbed to the edge of the three-dimensional element.
  • the set of candidate adsorption lines can be understood as: a set of projection edges on the three-dimensional element as candidate adsorption lines of the selected line segment, and the set of candidate adsorption lines includes line projection marks of the candidate adsorption lines associated with the selected line segment.
  • the situation of performing the determination of the candidate adsorption line set is: the situation where the selected line segment is adsorbed to the edge of the solid element.
  • this embodiment considers using S208 to select the target adsorption line from the set of candidate adsorption lines, but if the determined candidate adsorption line set is empty, consider using S209 to select the target adsorption point from the set of candidate adsorption points .
  • S208 Determine a target adsorption line of the selected line segment from the set of candidate adsorption lines, and use a three-dimensional element including the target adsorption line as a target three-dimensional element.
  • this embodiment when the set of candidate adsorption lines is not empty, consider determining the target adsorption line from the set of candidate adsorption lines based on this step; among them, this embodiment considers the method of minimizing the cost to determine the set of candidate adsorption lines
  • the target adsorption line, and the three-dimensional element including the target adsorption line is used as the target three-dimensional element.
  • the line adsorption distance from the selected line segment to the candidate adsorption line can be used as the criterion for cost minimization, and the candidate adsorption line with the smallest line adsorption distance to the selected line segment can be determined as the target adsorption line.
  • determining the target adsorption line of the selected line segment from the candidate adsorption line set may include: for each candidate adsorption line in the candidate adsorption line set, determining the The line adsorption distance from the candidate adsorption line to the selected line segment; the line adsorption distance of each candidate adsorption line is compared, and the candidate adsorption line corresponding to the minimum adsorption distance is determined as the target adsorption line.
  • a variable of the minimum adsorption cost can be set first, and a set threshold value can be assigned to the minimum adsorption cost; Select a candidate adsorption line from the set of adsorption lines, and determine the line adsorption distance between the candidate adsorption line and the selected line segment.
  • the line adsorption distance is less than the current assignment of the minimum adsorption cost, then the line adsorption distance is regarded as the new minimum adsorption cost
  • cost minimization is used to screen the distance of the target adsorption line, which can ensure that the adsorption effect from the selected line segment to the selected target adsorption line for adsorption is better and the adsorption cost is better.
  • S209 Determine the target adsorption point of the selected line segment from the set of candidate adsorption points, and use the three-dimensional element containing the target adsorption point as the target three-dimensional element.
  • this embodiment when the set of candidate adsorption lines is empty, consider determining the target adsorption point from the set of candidate adsorption points based on this step, and this embodiment also considers the method of minimizing the cost to determine the set of candidate adsorption points
  • the target adsorption point, and the three-dimensional element containing the target adsorption point is used as the target three-dimensional element.
  • This step can determine the point adsorption distance from the selected line segment to the candidate adsorption point; it can also determine the adsorption vector from the selected line segment to the candidate adsorption point. Since the cost minimization criterion should be composed of one parameter, it can be based on the existence of two Knowing information is used to determine a parameter as the criterion for cost minimization. In this step, the candidate adsorption point with the smallest parameter value to the selected line segment can be determined as the target adsorption point.
  • this embodiment will determine the target adsorption point of the selected line segment from the candidate adsorption point set, which may include: for each candidate adsorption point in the candidate adsorption point set, determining the candidate The point adsorption distance and the adsorption vector from the adsorption point to the corresponding point to be adsorbed; the determination distance of the candidate adsorption point is determined according to the adsorption distance and adsorption vector of each point and the movement vector; the determination distance of each candidate adsorption point is compared , Determine the candidate adsorption point corresponding to the minimum judgment distance as the target adsorption point.
  • a right angle including the candidate adsorption point and the associated end point on the selected line segment can be constructed with the point adsorption distance as the hypotenuse.
  • Triangle the right-angled side formed by the candidate adsorption point perpendicular to the movement vector in the right-angled triangle can be used as the criterion for cost minimization, and the right-angled side as the criterion for cost minimization is equivalent to the candidate adsorption point and the point to be adsorbed The judgment distance.
  • the to-be-adsorbed point is the end point or selected point associated with the currently determined candidate adsorption point on the selected line segment.
  • the judgment distance is taken as the new minimum adsorption cost
  • this embodiment uses cost minimization to screen the target adsorption line distance, which can ensure that the adsorption effect of the selected line segment to the selected target adsorption line for adsorption is better and the adsorption cost is better.
  • S210 Control the selected line segment to be adsorbed to the target three-dimensional element.
  • the above-mentioned S210 in this embodiment is implemented in different ways based on the determination of the target three-dimensional element, and can be implemented in different ways.
  • the controlling the adsorption of the selected line segment to the target three-dimensional element includes: determining a point to be adsorbed on the selected line segment corresponding to the target adsorption point; determining the target adsorption point and the target point corresponding to the point to be adsorbed Adsorption distance and target adsorption vector; controlling the selected line segment to offset the target point adsorption distance along the target adsorption vector, so that the point to be adsorbed on the selected line segment and the target three-dimensional element
  • the target adsorption point phase adsorption.
  • the target adsorption point comes from a set of candidate adsorption points, and the candidate adsorption point set stores the coordinate value of the candidate adsorption point and the coordinate value of the corresponding point to be adsorbed.
  • the coordinates of the two points can be The value determines the distance between the two points.
  • the distance is used as the adsorption distance between the target adsorption point and the target point to be adsorbed; the coordinate value of the two points can also be used to determine the coordinate vector formed by the two points, which can be used as the target adsorption The target adsorption vector of the point and the point to be adsorbed.
  • This step can control the offset of the selected line segment along the target adsorption vector for the target adsorption distance, so as to realize the adsorption of the selected line segment based on the point to be adsorbed and the target three-dimensional element.
  • the controlling the selected line segment to be adsorbed to the target three-dimensional element includes: determining the target line adsorption distance from the target adsorption line to the selected line segment; Determine the suction movement direction of the selected line segment by the movement vector of the selected line segment; control the selected line segment to offset the target line suction distance along the suction movement direction, so that the selected line segment It is adsorbed with the target adsorption line on the target three-dimensional element.
  • the above-mentioned adsorption control process for the target adsorption line can realize the dynamic adsorption from the target adsorption line to the target three-dimensional element, and ensures the intelligent adsorption of the line segment.
  • the target adsorption line comes from a set of candidate adsorption lines, and the candidate adsorption line set stores line projection marks indicating candidate adsorption lines. It can be seen that the target adsorption line is parallel to the selected line segment, and the selected line segment moves to the target adsorption line.
  • the movement vector of the selected line segment can be used to determine the suction movement direction of the selected line segment.
  • this step can also determine the movement distance of the selected line segment when it moves along the movement vector direction, and record the movement distance as the target The adsorption distance from the snap line to the target line of the selected line segment.
  • the selected line segment is controlled to offset the target line adsorption distance along the adsorption movement direction, so as to realize the adsorption of the selected line segment based on the target adsorption line and the target three-dimensional element.
  • the selected line segment after the selected line segment is adsorbed to the target three-dimensional element, the selected line segment needs to be processed, so that the selected line segment is converted into a three-dimensional line segment of the three-dimensional scene.
  • the space coordinate conversion from the perspective of human-computer interaction, the position of the selected line segment that the user sees in the canvas is still the position after the two-dimensional adsorption of the three-dimensional element, but in terms of data representation, the selected line segment is already The three-dimensional geometric representation of the three-dimensional space.
  • This representation can be understood as a special representation, which is equivalent to the data representation of the selected line segment from three levels.
  • Figure 4 shows a schematic diagram of the three-layer representation of the data information of the selected line segment; as shown in Figure 4, the data information of the selected line segment can be represented in three layers.
  • the first layer 201 is the line segment layer, and the line segment layer can be considered Is the data representation of the selected line segment on the target three-dimensional element, that is, it represents the selected line segment in the three-dimensional scene;
  • the second layer 202 is the projection layer, and the projection layer represents the data information of the selected line segment in the three-dimensional scene projected onto the canvas.
  • the third layer 203 is the interactive layer, because the currently selected line segment has formed a combined three-dimensional element with the target three-dimensional element, but the user expects that the selected line segment also has an interactive method for the line segment, such as clicking the combination on the canvas
  • the selected line segment in the three-dimensional element performs independent operations on the selected line segment, so the processing of the selected line segment data on the interactive layer is to make the interactive user not perceive that the selected line segment has been combined with the target three-dimensional element, and still can
  • the selected line segment performs the same interaction as before in the canvas.
  • the key to displaying the combined solid elements in this step is to determine the data information of the selected line segment in the three-dimensional scene.
  • the above-mentioned S211 in this embodiment is implemented in a different manner based on the determination of the target three-dimensional element, and may also be implemented in a different manner.
  • the displaying the combined three-dimensional element formed after adsorption includes: determining the selected line segment according to the spatial coordinate information of the target adsorption point Combine the first line point space information with the line point space information of the target three-dimensional element to form a first combined three-dimensional element including the selected line segment and the target three-dimensional element; The first combined three-dimensional element is projected and displayed on the canvas.
  • Fig. 5 shows a display example of a combined solid element. As shown in Fig. 5, it can be seen that vertex C in the target solid element is the target adsorption point, and the end point A'in the selected line segment is the same as the vertex C associated point to be adsorbed.
  • the spatial coordinates of the endpoint A' should be the same as the vertex C, and the z-coordinates of the points on the selected line segment A'B' in this adsorption method are the same in the three-dimensional scene, and they are all vertex C
  • the space coordinates of the endpoint B' can be determined inversely, and then the space coordinates of the endpoint A'and the endpoint B'are used as the selected line segment to mark the three-dimensional The first line point spatial information in the scene.
  • Fig. 6 shows another display example of the combined solid element. As shown in Fig. 6, it can be seen that there is a point Q on the edge CE of the target solid element as the target adsorption point, and the line segment A'is selected There is a point W on B'that is the to-be-adsorbed point associated with the target adsorption point Q.
  • the spatial coordinates of point W are the same as point Q, and the z-coordinate value of each point on the selected line segment A'B' in this adsorption method is still the same in the three-dimensional scene, and they are all of point Q
  • the z-coordinate value therefore, on the premise of the projection matrix of the three-dimensional scene on the canvas, the spatial coordinates of the endpoint A'and the endpoint B'in the selected line segment can be determined inversely, and then based on the spatial coordinates of the endpoint A'and the endpoint B' As the selected line segment, it marks the first line point spatial information in the 3D scene.
  • the displaying the combined three-dimensional element formed after adsorption includes: determining the second line of the selected line segment according to the line point space information of the target adsorption line Point space information; combining the second line point space information with the line point space information of the target three-dimensional element to form a second combined three-dimensional element containing the selected line segment and the target three-dimensional element; combining the second The three-dimensional element projection is displayed in the canvas.
  • the spatial adsorption of the selected line segment in different adsorption scenarios corresponding to the target adsorption point or the target adsorption line is taken into consideration, thereby ensuring that the selected line segment and the target three-dimensional element are performed Integrity in three-dimensional space after adsorption.
  • Fig. 7 shows another display example of the combined solid element.
  • the edge CE in the target solid element is the target adsorption line
  • the selected line segment A'B' is adsorbed to the edge On CE
  • the process of determining the second line point spatial information of the selected line segment A'B' can be expressed as: Obtain the point projection coordinates of the edge CE on the canvas and the coordinates of the endpoints A'and B'of the selected line segment
  • the length values of the line segment CA', line segment A'E, line segment EB' and line segment CB' in the canvas can be determined; the angle between the edge CE and the canvas in the three-dimensional scene is obtained as a; based on the angle a and the length value of line segment CA', line segment A'E, line segment EB' and line segment CB' in the canvas, can determine the line segment length value of each line segment in the three-dimensional scene; the space coordinates of each line segment in
  • S212 Receive the first state adjustment operation, control the adjustment of the combined three-dimensional element, and display the combined three-dimensional element after the state adjustment.
  • the user may perform a first state adjustment operation on the combined three-dimensional element displayed on the canvas, and the first state adjustment operation may be applied to the target three-dimensional element of the combined three-dimensional element.
  • the display state of the combined stereo element can be controlled and adjusted according to the operation content of the first state adjustment operation.
  • the first state adjustment operation may be a movement operation on the target stereo element , Rotation operation, etc. At this time, the selected line segment adsorbed to the target three-dimensional element moves or rotates the same with the target three-dimensional element.
  • S213 Receive a second state adjustment operation, control the adjustment of the selected line segment, and respectively display the current state of the selected line segment in the combined three-dimensional element and the target three-dimensional element.
  • the user can also perform a second state adjustment operation on the combined three-dimensional element displayed on the canvas, and the second state adjustment operation acts on the selected line segment of the combined three-dimensional element.
  • the second state adjustment operation is received in this step, according to the operation content of the second state adjustment operation, only the display state of the selected line segment on the combined three-dimensional element can be controlled and adjusted.
  • the second state adjustment operation may be a selection The movement operation and rotation operation of the line segment.
  • the second state adjustment operation is a movement operation of the selected line segment
  • only the selected line segment is moved, which is equivalent to canceling the adsorption connection between the selected line segment and the target three-dimensional element, and the combined three-dimensional element will be displayed separately The selected line segment and target three-dimensional element.
  • the determination operation of selecting the three-dimensional element to be adsorbed on the selected line segment may include: determining a set of candidate adsorption points or a set of candidate adsorption lines, determining a target adsorption point from the set of candidate adsorption points, or selecting a set of candidate adsorption lines
  • the target adsorption line is determined, and the target adsorption point or the three-dimensional element to which the target adsorption line belongs is determined as the target three-dimensional element to be adsorbed.
  • the adjustment operation of the state of the combined three-dimensional element formed after adsorption is also added.
  • the intelligent adsorption of the line segment to the three-dimensional element is realized, forming a combined three-dimensional element with the selected line segment and the target three-dimensional element as a whole, and the formed combined three-dimensional element can be adjusted and selected when the state of the target three-dimensional element is adjusted
  • the line segment avoids the tedious operation of manually re-adjusting the state of the line segment and improves the teaching experience.
  • it can also keep the target three-dimensional element contained when adjusting the selected line segment in the combined three-dimensional element, and only control the selected line segment
  • the adjustment not only realizes the state adjustment of the three-dimensional elements attached to the line segment, but also avoids the influence of the line segment adsorption on the user's control of the line segment state in the interactive level.
  • FIG. 8 is a flow chart for determining the set of candidate adsorption points provided in the second embodiment of the application. As shown in FIG. 8, this embodiment will be based on the movement vector, the point coordinate information, and For each of the visible line point projection information, determining the candidate adsorption point set corresponding to the selected line segment includes the following operations:
  • this step is used to obtain the end point coordinates and the selected point coordinates of the selected point line segment required for determining the set of candidate adsorption points.
  • the selected point may be any point on the selected line segment, and may be randomly selected in advance.
  • this step is used to extract the projection point information and projection line information required for determining the set of candidate adsorption points, and this step uniformly adds the point projection coordinates extracted from the projection information of each visible line point to the projection point information
  • the line projection labels extracted from the projection information of each visible line point are uniformly added to the projection side information set.
  • this step will record the projection side information set as the first projection side information set.
  • the following S2053 and S2055 are equivalent to two parallel situations, which respectively correspond to the situation where the end point of the selected line segment is adsorbed to the vertex of the solid element and the point in the selected line segment that can be adsorbed on the edge of the solid element Case.
  • this step is equivalent to the following prerequisite step of S2054, and the focus is to determine the execution object, which is actually each end point of the selected line segment. For each end point of the selected line segment, the following S2054 operation can be performed.
  • the endpoint coordinates of the endpoint, and the projection point information collection determine the first candidate projection point to be adsorbed by the endpoint, and use the endpoint as the adsorption point and each first candidate projection point as the candidate adsorption point, and add the association to A collection of candidate adsorption points.
  • the movement vector is equivalent to the movement direction of the user dragging the selected line segment
  • the end point coordinates of the end point refer to the initial end point coordinates of the selected line segment on the canvas
  • the projection point information set includes the canvas
  • the process of determining the first candidate projection point for the endpoint to be adsorbed in this step can be described as: based on the endpoint coordinates of the endpoint and the point projection coordinates of each projection point to determine the endpoint to each projection
  • the coordinate vector and the movement vector are used to determine whether the corresponding projection point can be used as the candidate projection point of the endpoint.
  • the candidate projection point is the first candidate projection point in this step.
  • first candidate projection point of the endpoint After determining the first candidate projection point of the endpoint, it is necessary to associate the endpoint as the point to be adsorbed and the first candidate projection point as the candidate adsorption point to the candidate adsorption point set. Based on the operation of this step, the endpoint is in the candidate One or more first candidate projection points may be associated with the set of adsorption points, or there may be no first candidate projection points.
  • the implementation of S2054 in this embodiment may be: for each projection point in the projection point information set, based on the endpoint coordinates and the point projection coordinates of the projection point, determine the endpoint to The coordinate vector of the projection point; determine the vector included angle value of the coordinate vector and the movement vector; if the absolute value of the vector included angle value is less than or equal to the set included angle threshold, the projection point is determined Is the first candidate projection point to be adsorbed on the endpoint.
  • the coordinate vector of each projection point in the end point relative to the projection point information set can be determined, and the coordinate vector and the movement vector can form a vector angle value.
  • This embodiment can pass The absolute value of the vector included angle value is compared with the set included angle threshold to determine whether the projection point can be used as the first candidate projection point of the endpoint.
  • this embodiment considers all projection points when determining the first candidate projection point based on the above implementation process.
  • This processing method may increase the execution time of candidate projection point determination, thereby affecting the adsorption of the entire line segment. Performance.
  • this embodiment determines an effective area according to the movement vector and endpoint coordinates of the selected line segment, and selects the effective projection points in the effective area from the projection point information set to form an effective projection point set.
  • determining the effective area and screening the projection points may include at least one of the following methods:
  • Manner 1 Determine a critical line perpendicular to the movement vector and passing through the currently selected endpoint, divide the canvas into two plane areas by the critical line, and determine the plane area containing the movement vector as the first area .
  • the effective area for projection point screening When simply considering the first area formed in this way as the effective area for projection point screening, based on the point projection coordinates of each projection point in the projection point information set, determine whether the projection point is located in the effective area; if the projection point is located in the effective area In the area, the projection point is added to the first effective projection point set.
  • the judging process of whether the projection point is located in the effective area is: determining whether the effective area is above or below the critical line. If it is above, when the projection point is above the critical line, it is determined that the projection point is in the effective area. If it is below, when the projection point is below the critical line, it is determined that the projection point is in the effective area.
  • FIG. 9 is a diagram of an implementation example of screening projection points in the projection point information set.
  • point A, point B, point C, point D, point E, point F, and point G It is equivalent to the display of the projection point in the projection point information set on the canvas; among them, the point M is an end point of the selected line segment displayed in the canvas, the extension direction of the ray L is the movement vector of the selected line segment, and the line L'is and The ray L is perpendicular to the critical straight line passing the point M, and the plane area 22 containing the ray L corresponds to the effective area. Based on the above determination operation, it can be known that only the point A, the point B, and the point C are in the plane area 22, and thus the point A, the point B, and the point C can be added to the first effective projection point set.
  • Method 2 Take the currently selected endpoint as the center of the circle, draw a circle with the set distance threshold as the radius, and record the obtained circular area as the second area.
  • the effective area for projection point screening When only considering the second area formed in this way as the effective area for projection point screening, it is also based on the point projection coordinates of each projection point in the projection point information set to determine whether the projection point is located in the effective area; if the projection point is located in the effective area Within the effective area, the projection point is added to the second set of effective projection points.
  • the process of determining whether the projection point is located in the effective area is: calculating the square of the coordinate distance between the projection point and the selected endpoint, and determining that the projection point whose coordinate distance is less than the square of the radius is in the effective area.
  • FIG. 10 is another example diagram for filtering the projection points in the projection point information set.
  • point A, point B, point C, point D, point E, point F, and point G is equivalent to the projection point in the projection point information set;
  • point M is an end point of the selected line segment, and the closed area 23 formed by circle O is equivalent to the effective area.
  • this embodiment can filter the projection points based on any of the above methods, or combine the above two methods to filter the projection points at the same time, and the effective area is determined in the filtering process: determining the first area The intersection area with the second area, the intersection area is marked as the effective area.
  • the first effective projection point set can be obtained in the above-mentioned way-to-corresponding screening judgment method, and the first effective projection point set is used as the waiting The screening set is performed again in the screening and judging mode corresponding to the second way to obtain the second effective projection point set, which speeds up the screening speed and reduces the number of effective projection points.
  • S2055 Perform S2056 for the selected point on the selected line segment.
  • this step is equivalent to the following prerequisite step of S2056.
  • the focus is also to determine the execution object.
  • the execution object is actually a selected point on the selected line segment. For the selected point, the following S2056 can be executed. Operation.
  • the movement vector corresponds to the movement direction of the user dragging the selected line segment
  • the selected point coordinates are used to represent the selected point
  • the first projection edge information set includes
  • the line projection indicator of the visible projection side of the three-dimensional element displayed in the canvas is represented by the point projection coordinates of the two projection points constituting the projection side.
  • the process of determining the second candidate projection point of the selected point to be adsorbed in this step can be described as: based on the selected point coordinates, the movement vector and the line projection mark of each projection edge, the selected point’s projection edge to be adsorbed can be determined. Determine the second candidate projection point to be adsorbed at the selected point on the edge of the projection to be adsorbed.
  • the selected point may be associated with one or more second candidate projection points in the candidate adsorption point set, or there may be no second candidate projection points.
  • the implementation of S2056 in this embodiment may be: based on the selected point coordinates of the selected point and the movement vector, constructing the selected point as the starting end point and the direction parallel to the movement vector Ray, and obtain the ray label of the ray; for each first projection side in the first projection side information set, according to the line projection label of the first projection side and the ray label, determine the Whether there is a first intersection point between the first projection edge and the ray; if so, the coordinate point distance between the first intersection point and the selected point is determined, and when the coordinate point distance is less than a set distance threshold, it is determined
  • the first projection edge is the to-be-adsorbed projection edge of the selected point
  • the first intersection point is the second candidate projection point of the selected point.
  • a ray with a selected point as the starting end point can be constructed, and the ray label of the ray can be obtained.
  • the ray label includes the coordinates of the starting end point and the extension direction of the ray (and The moving vector is parallel).
  • the straight line equation where the ray is located can be determined, and the straight line equation where the first projection edge is located can be determined according to the line projection label of the first projection side.
  • the first projection edge can be considered as the selected point’s to-be-adsorbed projection edge
  • the existing first intersection point can be used as the second candidate projection point of the selected point.
  • the above-mentioned step flow from S2051 to S2056 realizes the determination of the set of candidate adsorption points corresponding to the selected line segment. Based on the above steps, the method of determining the candidate adsorption points corresponding to the selected line segment under different circumstances is considered, thereby ensuring the determined candidate adsorption point The accuracy and effectiveness of the points, thereby improving the screening accuracy when the target adsorption points are obtained by subsequent screening.
  • FIG. 11 is a flowchart of the implementation of determining the set of candidate adsorption lines provided in the second embodiment of the present application. As shown in FIG. 11, this optional embodiment will be based on The movement vector, the line indication information, and the line projection indication in each of the visible line point projection information determine the candidate adsorption line set corresponding to the selected line segment, including the following operations:
  • the movement vector is equivalent to the movement direction of the user dragging the selected line segment
  • the line label information is information based on the endpoint coordinates of the two ends of the selected line segment.
  • the implementation of S2061 in this embodiment may be: determining the line segment length of the selected line segment according to the endpoint coordinates of the two ends of the selected line segment in the line marking information; determining the selected line segment and the selected line segment The included angle value formed by the movement vector; the construction takes the line segment length as the first side length, the set adsorption distance threshold value is the second side length, and the side included angle is the included angle value or is the remainder of the included angle value The parallelogram area of the corner.
  • the two adjacent sides of the parallelogram to be constructed are respectively marked as the first side and the second side, and the first side corresponding to the first side is the length of the selected line segment, and the second side corresponding to the first side
  • the length of the two sides is the set adsorption distance threshold, and the side angle is the included angle or the complementary angle formed by the selected line segment and the movement vector.
  • FIG. 12 is an example diagram of a parallelogram constructed for adsorption screening.
  • line segment AB is used as the selected line segment, which is equivalent to the first parallelogram in the parallelogram 210.
  • the length of the first side of one side, the line segment AC as the set adsorption distance threshold, is equivalent to the second side length of the second side of the parallelogram 210, and the line segment AB and the line segment AC formed by ⁇ BAC is equivalent to the first in the parallelogram
  • the angle between the side and the second side, and the angle value of the side included angle ⁇ BAC can be the included angle formed by the selected line segment and the movement vector.
  • the line projection indication in the visible line point projection information is used to indicate the visible projection edge of the three-dimensional element on the canvas.
  • the line projection indicator in the visible line point projection information can be added to the second projection side information set, thereby forming a projection side information set including all visible projection sides in the canvas.
  • the adsorption filter condition of the parallelogram area can be set by the adsorption distance threshold, so as to filter the second projection that meets the adsorption filter condition from the second projection edge information set Edge, as the candidate snap line for the selected line segment.
  • the implementation of S2063 in this embodiment may include: for each second projection side in the second projection side information set, according to the line projection label and the line label of the second projection side Information, determine whether the second projection side is parallel to the selected line segment; if parallel, determine whether the second projection side meets the adsorption filtering conditions set based on the parallelogram area; if so, then all The second projection edge is determined as a candidate adsorption line of the selected line segment.
  • each second projection edge in the second projection edge information set can be subjected to the screening determination of the above steps, thereby screening candidate adsorption lines that are parallel to the selected line segment and meet the adsorption screening conditions, wherein the adsorption
  • the setting of the filter conditions can be used to determine whether the second projection side is in the parallelogram or whether there is an intersection with the second side of the parallelogram, so as to determine whether the second projection side can be used as a candidate adsorption line for the selected line segment.
  • the adsorption screening conditions include at least one of the following:
  • intersection point There is a second intersection point between the second projection edge extension line and the first threshold distance side as the second edge, and the second intersection point is located on the second projection edge; the second projection edge extension line and the second edge as the second edge There is a third intersection point between the two threshold distance edges, and the third intersection point is located on the second projection edge; the extension line of the second projection edge and the first threshold distance edge and the second threshold distance edge as the second edge respectively have the first The fourth intersection point and the fifth intersection point, and the second projection edge is located on the line connecting the fourth intersection point and the fifth intersection point.
  • the constructed parallelogram area includes two second sides.
  • the two second sides are respectively marked as the first threshold distance side and the second threshold distance side.
  • the adsorption screening conditions may include at least one of the foregoing, that is, when the second projection edge that has undergone parallel screening meets the foregoing at least one, the second projection edge can be considered as a candidate adsorption line for the selected line segment.
  • Figs. 13 to 15 respectively show an effect display diagram of the set adsorption filtering conditions.
  • the line segment AC shown is a second side of the parallelogram. , Is equivalent to the first threshold distance side; the line segment BD is another second side, which is equivalent to the second threshold distance side; and the line segment EF can be recorded as the second projection side.
  • the effect of the above-mentioned first adsorption screening method is shown, that is, the second projection edge EF forms an extension line and intersects the line segment AC, and the intersection point is on the second projection edge EF;
  • the effect of the above second adsorption screening method that is, the extension line formed by the second projection edge EF intersects the line segment BD, and the intersection point is on the second projection edge EF;
  • the The effect of the above-mentioned third adsorption screening method is shown, that is, the extension line formed by the second projection edge EF intersects the line segment AC and the line segment BD, and the second projection edge EF is on the line connecting the two intersection points.
  • all the candidate adsorption lines determined based on the above S2063 can be added to the candidate adsorption line set.
  • the above step flow from S2061 to S2064 realizes the determination of the set of candidate adsorption lines corresponding to the selected line segment. Based on the above steps, the effective screening of the projection lines parallel to the selected line segment in the three-dimensional element is realized, thereby ensuring the determined candidate adsorption line The accuracy and effectiveness of the line, thereby improving the screening accuracy when the target adsorption line is obtained by subsequent screening.
  • FIG. 16 is a structural block diagram of a line segment adsorption device provided in the third embodiment of the application.
  • the line segment adsorption device provided in this embodiment is integrated into the line segment adsorption device.
  • the line segment adsorption device can be a computer, a mobile phone, a tablet or an interactive smart Tablet etc.
  • the device includes: a first determination module 31, a first response module 32, a second response module 33, a second determination module 34, an adsorption control module 35 and a combined display module 36.
  • the first determining module 31 is configured to determine the line point projection information of each three-dimensional element displayed on the canvas.
  • the first response module 32 is configured to obtain line point information of the selected line segment in response to receiving a selection operation acting on any line segment element in the canvas.
  • the second response module 33 is configured to determine a movement vector corresponding to the line segment to be adsorbed in response to receiving a movement operation acting on the selected line segment.
  • the second determining module 34 is configured to determine the target three-dimensional element to be adsorbed by the selected line segment according to the line point information, the movement vector, and the line point projection information of each of the three-dimensional elements.
  • the adsorption control module 35 is configured to control the adsorption of the selected line segment to the target three-dimensional element.
  • the combined display module 36 is configured to display combined three-dimensional elements formed after adsorption.
  • the above-mentioned technical solution of this embodiment can determine the target three-dimensional element that can be adsorbed from each three-dimensional element and adsorb it based on the line point information and the movement vector of the selected line segment, and the line point projection information of each three-dimensional element in the canvas.
  • the intelligent adsorption of line segments to three-dimensional elements is realized, forming a combined three-dimensional element with the selected line segment and the target three-dimensional element as a whole, so that the state of the adsorbed line segment can be adjusted when the state of the target three-dimensional element in the combined three-dimensional element is adjusted.
  • the tedious operation of manually re-adjusting the state of the line segment is avoided, and the teaching experience is improved.
  • the second determining module includes:
  • An information acquisition unit configured to extract point coordinate information and line label information in the line point information, and obtain the visible line point projection information of each three-dimensional element based on the line point projection information of each three-dimensional element;
  • a candidate point determination unit configured to determine a set of candidate adsorption points corresponding to the selected line segment according to the movement vector, the point coordinate information, and the projection information of each visible line point;
  • a candidate line determining unit configured to determine a set of candidate adsorption lines corresponding to the selected line segment according to the movement vector, the line marking information, and the line projection markings in each of the visible line point projection information;
  • the adsorption target determination unit is configured to determine the target adsorption line of the selected line segment from the candidate adsorption line set when the candidate adsorption line set is not empty, and use the three-dimensional element containing the target adsorption line as the target Three-dimensional element; otherwise, the target adsorption point of the selected line segment is determined from the set of candidate adsorption points, and the three-dimensional element containing the target adsorption point is used as the target three-dimensional element.
  • the candidate point determination unit includes:
  • the first obtaining subunit is configured to obtain the endpoint coordinates of the two ends of the selected line segment and the selected point coordinates of any selected point on the line segment in the point coordinate information;
  • the second acquisition subunit is configured to extract the point projection coordinates and line projection labels in each of the visible line point projection information, and obtain the projection point information set and the first projection edge information set respectively;
  • the first point determination subunit is set to determine the first candidate for the end point to be adsorbed according to the movement vector, the end point coordinates of the end point and the projection point information set for each end point of the selected line segment Projecting points, and using the endpoint as a point to be adsorbed and each of the first candidate projection points as candidate adsorption points respectively, and adding them to the candidate adsorption point set in association;
  • the second point determination subunit is configured to determine a second candidate projection point corresponding to the selected point on the projection edge to be adsorbed according to the movement vector, the coordinates of the selected point, and the first projection edge information set, and The selected point is used as a point to be adsorbed and each of the second candidate projection points is respectively used as a candidate adsorption point, and the association is added to the candidate adsorption point set.
  • the first point determination subunit is set to:
  • the endpoint is used as a point to be adsorbed and each of the first candidate projection points is respectively used as a candidate adsorption point, and the association is added to the candidate adsorption point set.
  • the first point determination subunit is set to:
  • each effective projection point in the set of effective projection points determine the effective coordinate vector from the endpoint to the effective projection point based on the endpoint coordinates and the point projection coordinates of the effective projection point;
  • the endpoint is used as a point to be adsorbed and each of the first candidate projection points is respectively used as a candidate adsorption point, and the association is added to the candidate adsorption point set.
  • the determining the effective area in the canvas based on the movement vector and the endpoint coordinates of the endpoint includes:
  • the intersecting area of the first area and the second area is determined as an effective area; or, the first area is determined as an effective area; or, the second area is determined as an effective area.
  • the second point determination subunit is set to:
  • the selected point is used as a point to be adsorbed and each of the second candidate projection points is respectively used as a candidate adsorption point, and the association is added to the candidate adsorption point set.
  • the determining the target adsorption point of the selected line segment from the candidate adsorption point set includes:
  • the candidate line determination unit includes:
  • An area determining subunit configured to construct a parallel quadrilateral area for adsorption screening according to the movement vector and the line marking information
  • the information screening subunit is set to form a second projection side information set according to the line projection indication in the projection information of each visible line point;
  • a line determination subunit configured to filter candidate adsorption lines of the selected line segment from the second projection edge information set according to the parallelogram area;
  • the set determining subunit is configured to obtain a candidate adsorption line set including each of the candidate adsorption lines of the selected line segment.
  • the area determining subunit is set to:
  • the set adsorption distance threshold value is the second side length
  • the side included angle is the included angle value or the complementary angle of the included angle value.
  • the line determination subunit is set to:
  • For each second projection edge in the second projection edge information set determine whether the second projection edge corresponds to the selected line segment according to the line projection label of the second projection edge and the line label information parallel;
  • the second projection edge is determined as a candidate adsorption line of the selected line segment.
  • the adsorption screening conditions include at least one of the following:
  • intersection point between the extension line of the second projection edge and the second threshold distance side as the second edge, and the third intersection point is located on the second projection edge;
  • the extension line of the second projection edge and the first threshold distance side and the second threshold distance side as the second side respectively have a fourth intersection point and a fifth intersection point, and the second projection edge is connected to the fourth intersection point and the fifth intersection point. on-line.
  • the determining the target adsorption line of the selected line segment from the candidate adsorption line set includes:
  • the line adsorption distance of each candidate target line is compared, and the candidate target line corresponding to the minimum adsorption distance is determined as the target adsorption line.
  • the adsorption control module is set to:
  • the selected line segment is controlled to shift the adsorption distance of the target point along the target adsorption vector, so that the point to be adsorbed on the selected line segment is adsorbed with the target adsorption point on the target three-dimensional element.
  • the adsorption control module is set to:
  • the selected line segment is controlled to shift the adsorption distance of the target line along the adsorption movement direction, so that the selected line segment is adsorbed to the target adsorption line on the target three-dimensional element.
  • the combined display module is set to:
  • the first combined stereoscopic element is projected and displayed on the canvas.
  • the combined display module is set to:
  • the second combined stereoscopic element is projected and displayed on the canvas.
  • the device further includes: a first receiving module configured to receive a first state adjustment operation after displaying the combined three-dimensional element formed after adsorption, and the first state adjustment operation acts on the combined three-dimensional element On the target three-dimensional element;
  • the first display module is configured to control and adjust the combined three-dimensional element, and display the combined three-dimensional element after state adjustment.
  • the device further includes:
  • the second receiving module is configured to receive a second state adjustment operation after displaying the combined three-dimensional element formed after adsorption, and the second state adjustment operation acts on the selected line segment of the combined three-dimensional element;
  • the second display module is configured to control and adjust the selected line segment, and respectively display the current state of the selected line segment in the combined three-dimensional element and the target three-dimensional element.
  • the device provided in this embodiment can be used to execute the method provided in any of the foregoing embodiments, and has corresponding functions and effects.
  • FIG. 17 is a schematic structural diagram of a line segment adsorption device provided by Embodiment 4 of the application.
  • the line segment adsorption equipment includes a processor 40, a memory 41, a display screen 42, an input device 43, and an output device 44.
  • the number of processors 40 in the line segment adsorption device may be one or more.
  • One processor 40 is taken as an example in FIG. 17.
  • the number of memories 41 in the line segment adsorption device may be one or more, and one memory 41 is taken as an example in FIG. 17.
  • the processor 40, the memory 41, the display screen 42, the input device 43, and the output device 44 of the line segment adsorption device may be connected by a bus or other methods. In FIG. 17, the connection by a bus is taken as an example.
  • the line segment adsorption device may be a computer, a mobile phone, a tablet or an interactive smart tablet, etc.
  • the memory 41 can be configured to store software programs, computer-executable programs, and modules, such as the program instructions/modules corresponding to the line segment adsorption device described in any embodiment of this application (for example, in the line segment adsorption device The first determination module 31, the first response module 32, the second response module 33, the second determination module 34, the adsorption control module 35 and the combined display module 36).
  • the memory 41 may include a program storage area and a data storage area.
  • the program storage area may store an operating system and an application program required by at least one function; the data storage area may store data created according to the use of the device, and the like.
  • the memory 41 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
  • the memory 41 may include a memory remotely provided with respect to the processor 40, and these remote memories may be connected to the device through a network. Examples of the aforementioned networks include the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
  • the display screen 42 may be a display screen 42 with a touch function, which may be a capacitive screen, an electromagnetic screen or an infrared screen.
  • the display screen 42 is set to display data according to the instructions of the processor 40, such as displaying three-dimensional elements, plane elements, and other elements other than elements projected on the canvas, and is also set to receive touches on the display screen 42. Operate and send the corresponding signal to the processor 40 or other devices.
  • the input device 43 can be configured to receive input digital or character information, and to generate key signal input related to user settings and function control of the display device, and can also be configured as a camera for acquiring images and a pickup device for acquiring audio data.
  • the output device 44 may include audio equipment such as speakers.
  • the composition of the input device 43 and the output device 44 can be set according to actual conditions.
  • the processor 40 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 41, that is, realizes the aforementioned line segment adsorption method.
  • the line segment adsorption device provided above can be used to execute the method provided in any of the above embodiments, and has corresponding functions and effects.
  • the fifth embodiment of the present application also provides a storage medium containing computer-executable instructions.
  • the computer-executable instructions are used to execute a line segment adsorption method when executed by a computer processor, including:
  • the movement operation on the selected line segment determines the movement vector corresponding to the line segment to be adsorbed; according to the line point information, the movement vector, and the line point projection information of each of the three-dimensional elements, the target to be adsorbed on the selected line segment is determined Three-dimensional element; controlling the selected line segment to be adsorbed to the target three-dimensional element; displaying the combined three-dimensional element formed after adsorption.
  • An embodiment of the present application provides a storage medium containing computer-executable instructions.
  • the computer-executable instructions are not limited to the operations of the method described above, and can also perform related operations in the method provided in any embodiment of the present application, and With corresponding functions and effects.
  • this application can be implemented by software and necessary general-purpose hardware, or can be implemented by hardware.
  • the technical solution of this application can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory ( Random Access Memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including several instructions to make a computer device (which can be a robot, a personal computer, a server, or a network device, etc.) execute any of the embodiments described in this application Methods.
  • a computer device which can be a robot, a personal computer, a server, or a network device, etc.
  • the units and modules included in the above-mentioned line segment adsorption device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding function can be realized; in addition, each functional unit
  • the names are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application.
  • each part of the application can be implemented by hardware, software, firmware or a combination thereof.
  • multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
  • it can be implemented by any one of the following technologies or a combination of them: discrete logic circuits with logic gates for implementing logic functions on data signals, Application specific integrated circuits with suitable combinational logic gate circuits, programmable gate array (PGA), field programmable gate array (Field Programmable Gate Array, FPGA), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Architecture (AREA)
  • Computer Graphics (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

一种线段吸附方法、装置、设备及存储介质,该方法包括:确定显示于画布中各立体元素的线点投影信息(S101);响应于接收到作用在画布中任一线段元素的选定操作,获得选定线段的线点信息(S102);响应于接收到作用于选定线段上的移动操作,确定待吸附线段对应的移动向量(S103);按照线点信息、移动向量、各立体元素的线点投影信息,确定选定线段待吸附的目标立体元素(S104);控制选定线段吸附至目标立体元素(S105);显示吸附后形成的组合立体元素(S106)。

Description

线段吸附方法、装置、设备及存储介质
本申请要求在2019年04月04日提交中国专利局、申请号为201910272405.3的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请涉及交互智能平板技术领域,例如涉及一种线段吸附方法、装置、设备及存储介质。
背景技术
交互智能平板是交互智能设备中较为重要的应用之一,广泛地应用在各种应用场景中,极大提升人们的工作和学习效率。例如,在教育场景中,教师可以在交互智能平板上绘制平面或立体的几何图、结构图等各种元素,以便教师结合图例讲解教学内容。
基于交互智能平板进行立体元素的教学时,通常需要拖动某个线形元素至立体元素上。例如,老师可以用交互智能平板的直尺工具在画布上绘制出一条线段,然后将线段拖动至立体元素上,以将线段的线点与立体元素上的目标部位进行贴合。
然而,在用户拖动线段与立体元素的目标部位贴合后,如果用户对立体元素进行了移动或旋转等操作,则需要重新调整线段与立体元素上目标部位的贴合状态,由此耗费用户时间,效率较低,同时影响用户体验。
发明内容
本申请实施例提供一种线段吸附方法、装置、设备及存储介质,以解决调整交互白板中吸附了线段的立体元素后,需要重新调整线段来吸附立体元素的问题。
在一实施例中,本申请实施例提供了一种线段吸附方法,包括:
确定显示于画布中各立体元素的线点投影信息;
响应于接收到作用在所述画布中任一线段元素的选定操作,获得选定线段的线点信息;
响应于接收到作用于所述选定线段上的移动操作,确定所述待吸附线段对应的移动向量;
按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素;
控制所述选定线段吸附至所述目标立体元素;
显示吸附后形成的组合立体元素。
在一实施例中,所述按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素,包括:
提取所述线点信息中的点坐标信息和线标示信息,并基于各所述立体元素的线点投影信 息,获得各所述立体元素的可视线点投影信息;
根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合;
根据所述移动向量、所述线标示信息及各所述可视线点投影信息中的线投影标示,确定所述选定线段对应的候选吸附线集合;
如果所述候选吸附线集合为非空,则从所述候选吸附线集合中确定所述选定线段的目标吸附线,将包含所述目标吸附线的立体元素作为目标立体元素;否则,
从所述候选吸附点集合中确定所述选定线段的目标吸附点,并将包含所述目标吸附点的立体元素作为目标立体元素。
在一实施例中,所述根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合,包括:
获取所述点坐标信息中选定线段两端点的端点坐标及线段上任一选定点的选定点坐标;
提取各所述可视线点投影信息中的点投影坐标和线投影标示,分别获得投影点信息集合和第一投影边信息集合;
针对所述选定线段的每个端点,根据所述移动向量、所述端点的端点坐标及所述投影点信息集合,确定所述端点待吸附的第一候选投影点,并将所述端点作为待吸附点以及各所述第一候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合;
根据所述移动向量、选定点坐标及所述第一投影边信息集合,确定所述选定点在待吸附投影边上对应的第二候选投影点,并将所述选定点作为待吸附点以及各所述第二候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在一实施例中,根据所述移动向量、所述端点的端点坐标及所述投影点信息集合,确定所述端点待吸附的第一候选投影点,包括:
针对所述投影点信息集合中的每个投影点,基于所述端点坐标及所述投影点的点投影坐标,确定所述端点到所述投影点的坐标向量;
确定所述坐标向量与所述移动向量的向量夹角值;
如果所述向量夹角值的绝对值小于或等于设定夹角阈值,则将所述投影点确定为所述端点待吸附的第一候选投影点。
在一实施例中,所述根据所述移动向量、所述端点的端点坐标及所述投影点信息集合,确定所述端点待吸附的第一候选投影点,包括:
基于所述移动向量及所述端点的端点坐标,确定所述画布中的有效区域;
从所述投影点信息集合中筛选处于所述有效区域的有效投影点,形成有效投影点集合;
针对所述有效投影点集合中的每个有效投影点,基于所述端点坐标及所述有效投影点的点投影坐标,确定所述端点到所述有效投影点的有效坐标向量;
确定所述有效坐标向量与所述移动向量的有效向量夹角值;
如果所述有效向量夹角值的绝对值小于或等于设定夹角阈值,则将所述有效投影点确定 为所述端点待吸附的第一候选投影点。
在一实施例中,所述基于所述移动向量及所述端点的端点坐标,确定所述画布中的有效区域,包括:
通过与所述移动向量垂直且过所述端点的临界直线,将所述画布划分成两个平面区域,并将包含所述移动向量的平面区域确定为第一区域;
将所述画布中以所述端点为圆心,以设定距离阈值为半径形成的圆形区域确定为第二区域;
将所述第一区域与所述第二区域的相交区域确定为有效区域;或者,将所述第一区域确定为有效区域;或者,将第二区域确定为有效区域。
在一实施例中,所述根据所述移动向量、选定点坐标及所述第一投影边信息集合,确定所述选定点在待吸附投影边上对应的第二候选投影点,包括:
基于选定点的选定点坐标及所述移动向量,构建以所述选定点为起始端点、方向与所述移动向量平行的射线,并获得所述射线的射线标示;
针对所述第一投影边信息集合中的每个第一投影边,根据所述第一投影边的线投影标示及所述射线标示,确定所述第一投影边是否与所述射线存在第一交点;
若存在,则确定所述第一交点与所述选定点的坐标点距离,并当所述坐标点距离小于设定距离阈值时,确定所述第一投影边为所述选定点的待吸附投影边,所述第一交点为所述选定点的第二候选投影点。
在一实施例中,所述从所述候选吸附点集合中确定所述选定线段的目标吸附点,包括:
针对所述候选吸附点集合中每个候选吸附点,确定所述候选吸附点到相应待吸附点的点吸附距离和吸附向量;
根据各所述点吸附距离及吸附向量,结合所述移动向量确定所述候选吸附点的判定距离;
比对各候选吸附点的判定距离,将最小判定距离对应的候选吸附点确定为目标吸附点。
在一实施例中,所述根据所述移动向量、所述线标示信息及各所述可视线点投影信息中的线投影标示,确定所述选定线段对应的候选吸附线集合,包括:
根据所述移动向量及所述线标示信息,构建用于吸附筛选的平行四边形区域;
根据各所述可视线点投影信息中的线投影标示,形成第二投影边信息集合;
根据所述平行四边形区域,从所述第二投影边信息集合中筛选所述选定线段的候选吸附线;
获得包含所述选定线段各所述候选吸附线的候选吸附线集合。
在一实施例中,所述根据所述移动向量及所述线标示信息,构建用于吸附筛选的平行四边形区域,包括:
根据所述线标示信息中选定线段两端点的端点坐标,确定所述选定线段的线段长度;
确定所述选定线段与所述移动向量构成的夹角值;
构建以所述线段长度为第一边长,设定的吸附距离阈值为第二边长以及边夹角为所述夹 角值或为所述夹角值余角的平行四边形区域。
在一实施例中,所述根据所述平行四边形区域,从所述第二投影边信息集合中筛选所述选定线段的候选吸附线,包括:
针对所述第二投影边信息集合中的每个第二投影边,根据所述第二投影边的线投影标示及所述线标示信息,确定所述第二投影边是否与所述选定线段平行;
若平行,则确定所述第二投影边是否满足基于所述平行四边形区域设定的吸附筛选条件;
若满足,则将所述第二投影边确定为所述选定线段的候选吸附线。
在一实施例中,所述吸附筛选条件包括下述至少一项:
第二投影边延长线与作为第二边的第一阈值距离边存在第二交点,且所述第二交点位于所述第二投影边上;
第二投影边延长线与作为第二边的第二阈值距离边存在第三交点,且所述第三交点位于所述第二投影边上;
第二投影边延长线与作为第二边的第一阈值距离边和第二阈值距离边分别存在第四交点和第五交点,且所述第二投影边处于第四交点和第五交点的连线上。
在一实施例中,所述从所述候选吸附线集合中确定所述选定线段的目标吸附线,包括:
针对所述候选吸附线集合中的每条候选吸附线,确定所述候选吸附线到所述选定线段的线吸附距离;
比对各候选目标线的线吸附距离,将最小吸附距离对应的候选目标线确定为目标吸附线。
在一实施例中,当所述目标立体元素通过确定目标吸附点获得时,所述控制所述选定线段吸附至所述目标立体元素,包括:
确定所述目标吸附点对应的所述选定线段上的待吸附点;
确定所述目标吸附点与相应待吸附点的目标点吸附距离和目标吸附向量;
控制所述选定线段沿所述目标吸附向量进行所述目标点吸附距离的偏移,以使所述选定线段上的待吸附点与所述目标立体元素上的目标吸附点相吸附。
在一实施例中,当所述目标立体元素通过确定目标吸附线获得时,所述控制所述选定线段吸附至所述目标立体元素,包括:
确定所述目标吸附线到选定线段的目标线吸附距离;
将所述选定线段的移动向量确定所述选定线段的吸附移动方向;
控制所述选定线段沿所述吸附移动方向进行所述目标线吸附距离的偏移,以使所述选定线段与所述目标立体元素上的目标吸附线相吸附。
在一实施例中,当所述目标立体元素通过确定目标吸附点获得时,所述显示吸附后形成的组合立体元素,包括:
根据所述目标吸附点的空间坐标信息,确定所述选定线段的第一线点空间信息;
将所述第一线点空间信息与所述目标立体元素的线点空间信息相结合,构成包含所述选定线段和目标立体元素的第一组合立体元素;
将所述第一组合立体元素投影显示在所述画布中。
在一实施例中,当所述目标立体元素通过确定目标吸附线获得时,所述显示吸附后形成的组合立体元素,包括:
根据所述目标吸附线的线点空间信息,确定所述选定线段的第二线点空间信息;
将所述第二线点空间信息与所述目标立体元素的线点空间信息相结合,构成包含所述选定线段和目标立体元素的第二组合立体元素;
将所述第二组合立体元素投影显示在所述画布中。
在一实施例中,在显示吸附后形成的组合立体元素之后,还包括:
接收第一状态调整操作,所述第一状态调整操作作用在所述组合立体元素的目标立体元素上;
控制调整所述组合立体元素,并显示状态调整后的组合立体元素。
在一实施例中,在显示吸附后形成的组合立体元素之后,还包括:
接收第二状态调整操作,所述第二状态调整操作作用在所述组合立体元素的选定线段上;
控制调整所述选定线段,分别显示所述组合立体元素中的选定线段和目标立体元素的当前状态。
在一实施例中,本申请实施例还提供了一种线段吸附装置,包括:
第一确定模块,设置为确定显示于画布中各立体元素的线点投影信息;
第一响应模块,设置为响应于接收到作用在所述画布中任一线段元素的选定操作,获得选定线段的线点信息;
第二响应模块,设置为响应于接收到作用于所述选定线段上的移动操作,确定所述待吸附线段对应的移动向量;
第二确定模块,设置为按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素;
吸附控制模块,设置为控制所述选定线段吸附至所述目标立体元素;
组合显示模块,设置为显示吸附后形成的组合立体元素。
在一实施例中,所述第二确定模块,包括:
信息获取单元,设置为提取所述线点信息中的点坐标信息和线标示信息,并基于各所述立体元素的线点投影信息,获得各所述立体元素的可视线点投影信息;
候选点确定单元,设置为根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合;
候选线确定单元,设置为根据所述移动向量、所述线标示信息及各所述可视线点投影信息中的线投影标示,确定所述选定线段对应的候选吸附线集合;
吸附目标确定单元,设置为当所述候选吸附线集合为非空时,从所述候选吸附线集合中确定所述选定线段的目标吸附线,将包含所述目标吸附线的立体元素作为目标立体元素;否则,
从所述候选吸附点集合中确定所述选定线段的目标吸附点,并将包含所述目标吸附点的立体元素作为目标立体元素。
在一实施例中,所述候选点确定单元,包括:
第一获取子单元,设置为获取所述点坐标信息中选定线段两端点的端点坐标及线段上任一选定点的选定点坐标;
第二获取子单元,设置为提取各所述可视线点投影信息中的点投影坐标和线投影标示,分别获得投影点信息集合和第一投影边信息集合;
第一点确定子单元,设置为针对所述选定线段的每个端点,根据所述移动向量、所述端点的端点坐标及所述投影点信息集合,确定所述端点待吸附的第一候选投影点,并将所述端点作为待吸附点以及各所述第一候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合;
第二点确定子单元,设置为根据所述移动向量、选定点坐标及所述第一投影边信息集合,确定所述选定点在待吸附投影边上对应的第二候选投影点,并将所述选定点作为待吸附点以及各所述第二候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在一实施例中,所述第一点确定子单元,是设置为:
针对所述投影点信息集合中的每个投影点,针对所述选定线段的每个端点,基于所述端点坐标及所述投影点的点投影坐标,确定所述端点到所述投影点的坐标向量;
确定所述坐标向量与所述移动向量的向量夹角值;
如果所述向量夹角值的绝对值小于或等于设定夹角阈值,则将所述投影点确定为所述端点待吸附的第一候选投影点;
将所述端点作为待吸附点以及各所述第一候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在一实施例中,所述第一点确定子单元,是设置为:
基于所述移动向量及所述端点的端点坐标,确定所述画布中的有效区域;
从所述投影点信息集合中筛选处于所述有效区域的有效投影点,形成有效投影点集合;
针对所述有效投影点集合中的每个有效投影点,基于所述端点坐标及所述有效投影点的点投影坐标,确定所述端点到所述有效投影点的有效坐标向量;
确定所述有效坐标向量与所述移动向量的有效向量夹角值;
如果所述有效向量夹角值的绝对值小于或等于设定夹角阈值,则将所述有效投影点确定为所述端点待吸附的第一候选投影点;
将所述端点作为待吸附点以及各所述第一候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在一实施例中,所述基于所述移动向量及所述端点的端点坐标,确定所述画布中的有效区域,包括:
通过与所述移动向量垂直且过所述端点的临界直线,将所述画布划分成两个平面区域, 并将包含所述移动向量的平面区域确定为第一区域;
将所述画布中以所述端点为圆心,以设定距离阈值为半径形成的圆形区域确定为第二区域;
将所述第一区域与所述第二区域的相交区域确定为有效区域;或者,将所述第一区域确定为有效区域;或者,将第二区域确定为有效区域。
在一实施例中,所述第二点确定子单元,是设置为:
基于选定点的选定点坐标及所述移动向量,构建以所述选定点为起始端点、方向与所述移动向量平行的射线,并获得所述射线的射线标示;
针对所述第一投影边信息集合中的每个第一投影边,根据所述第一投影边的线投影标示及所述射线标示,确定所述第一投影边是否与所述射线存在第一交点;
若存在,则确定所述第一交点与所述选定点的坐标点距离,并当所述坐标点距离小于设定距离阈值时,确定所述第一投影边为所述选定点的待吸附投影边,所述第一交点为所述选定点的第二候选投影点;
将所述选定点作为待吸附点以及各所述第二候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在一实施例中,所述从所述候选吸附点集合中确定所述选定线段的目标吸附点,包括:
针对所述候选吸附点集合中每个候选吸附点,确定所述候选吸附点到相应待吸附点的点吸附距离和吸附向量;
根据各所述点吸附距离及吸附向量,结合所述移动向量确定所述候选吸附点的判定距离;
比对各候选吸附点的判定距离,将最小判定距离对应的候选吸附点确定为目标吸附点。
在一实施例中,所述候选线确定单元,包括:
区域确定子单元,设置为根据所述移动向量及所述线标示信息,构建用于吸附筛选的平行四边形区域;
信息筛选子单元,设置为根据各所述可视线点投影信息中的线投影标示,形成第二投影边信息集合;
线确定子单元,设置为根据所述平行四边形区域,从所述第二投影边信息集合中筛选所述选定线段的候选吸附线;
集合确定子单元,设置为获得包含所述选定线段各所述候选吸附线的候选吸附线集合。
在一实施例中,所述区域确定子单元,是设置为:
根据所述线标示信息中选定线段两端点的端点坐标,确定所述选定线段的线段长度;
确定所述选定线段与所述移动向量构成的夹角值;
构建以所述线段长度为第一边长,设定的吸附距离阈值为第二边长以及边夹角为所述夹角值或为所述夹角值余角的平行四边形区域。
在一实施例中,所述线确定子单元,是设置为:
针对所述第二投影边信息集合中的每个第二投影边,根据所述第二投影边的线投影标示 及所述线标示信息,确定所述第二投影边是否与所述选定线段平行;
若平行,则确定所述第二投影边是否满足基于所述平行四边形区域设定的吸附筛选条件;
若满足,则将所述第二投影边确定为所述选定线段的候选吸附线。
在一实施例中,所述吸附筛选条件包括下述至少一项:
第二投影边延长线与作为第二边的第一阈值距离边存在第二交点,且所述第二交点位于所述第二投影边上;
第二投影边延长线与作为第二边的第二阈值距离边存在第三交点,且所述第三交点位于所述第二投影边上;
第二投影边延长线与作为第二边的第一阈值距离边和第二阈值距离边分别存在第四交点和第五交点,且所述第二投影边处于第四交点和第五交点的连线上。
在一实施例中,所述从所述候选吸附线集合中确定所述选定线段的目标吸附线,包括:
针对所述候选吸附线集合中的每条候选吸附线,确定所述候选吸附线到所述选定线段的线吸附距离;
比对各候选目标线的线吸附距离,将最小吸附距离对应的候选目标线确定为目标吸附线。
在一实施例中,当所述目标立体元素通过确定目标吸附点获得时,所述吸附控制模块,是设置为:
确定所述目标吸附点对应的所述选定线段上的待吸附点;
确定所述目标吸附点与相应待吸附点的目标点吸附距离和目标吸附向量;
控制所述选定线段沿所述目标吸附向量进行所述目标点吸附距离的偏移,以使所述选定线段上的待吸附点与所述目标立体元素上的目标吸附点相吸附。
在一实施例中,当所述目标立体元素通过确定目标吸附线获得时,所述吸附控制模块,是设置为:
确定所述目标吸附线到选定线段的目标线吸附距离;
将所述选定线段的移动向量确定所述选定线段的吸附移动方向;
控制所述选定线段沿所述吸附移动方向进行所述目标线吸附距离的偏移,以使所述选定线段与所述目标立体元素上的目标吸附线相吸附。
在一实施例中,当所述目标立体元素通过确定目标吸附点获得时,所述组合显示模块,是设置为:
根据所述目标吸附点的空间坐标信息,确定所述选定线段的第一线点空间信息;
将所述第一线点空间信息与所述目标立体元素的线点空间信息相结合,构成包含所述选定线段和目标立体元素的第一组合立体元素;
将所述第一组合立体元素投影显示在所述画布中。
在一实施例中,当所述目标立体元素通过确定目标吸附线获得时,所述组合显示模块,是设置为:
根据所述目标吸附线的线点空间信息,确定所述选定线段的第二线点空间信息;
将所述第二线点空间信息与所述目标立体元素的线点空间信息相结合,构成包含所述选定线段和目标立体元素的第二组合立体元素;
将所述第二组合立体元素投影显示在所述画布中。
在一实施例中,还包括:第一接收模块,设置为在显示吸附后形成的组合立体元素之后,接收第一状态调整操作,所述第一状态调整操作作用在所述组合立体元素的目标立体元素上;
第一显示模块,设置为控制调整所述组合立体元素,并显示状态调整后的组合立体元素。
在一实施例中,还包括:
第二接收模块,设置为在显示吸附后形成的组合立体元素之后,接收第二状态调整操作,所述第二状态调整操作作用在所述组合立体元素的选定线段上;
第二显示模块,设置为控制调整所述选定线段,分别显示所述组合立体元素中的选定线段和目标立体元素的当前状态。
在一实施例中,本申请实施例还提供了一种线段吸附设备,包括:
存储器以及一个或多个处理器;
所述存储器,设置为存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本申请实施例提供的方法。
在一实施例中,本申请实施例还提供了一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行本申请实施例所述的方法。
上述提供的一种线段吸附方法、装置、设备及存储介质,可以获取到显示于画布中各立体元素的线点投影信息,根据用户作用在画布中线段上的选定操作,确定选定线段的线点信息,还根据用户作用在选定线段上的移动操作,确定选定线段的移动向量,由此可根据选定线段的线点信息、移动向量以及各立体元素的线点投影信息,来确定线段可吸附的目标立体元素,可控制选定线段在移动过程中吸附至目标立体元素,并显示选定线段吸附后形成的组合立体元素。本实施例的上述技术方案,能够根据选定线段的线点信息及移动向量,结合画布中各立体元素的线点投影信息,从各立体元素中确定可吸附的目标立体元素并吸附,由此实现了线段到立体元素的智能化吸附,形成了以选定线段和目标立体元素为整体的组合立体元素,从而能够在调整组合立体元素中目标立体元素的状态时附带调整所吸附线段的状态,避免了重新手动调整线段状态的繁琐操作,提升了教学体验。
附图说明
图1为本申请实施例一提供的一种线段吸附方法的流程图;
图2为本申请实施例二提供的一种线段吸附方法的流程图;
图3给出了立体元素投影在画布后的投影示例图;
图4给出了选定线段的数据信息进行三层表示的示意图;
图5给出了组合立体元素的一种显示示例图;
图6给出了组合立体元素的另一种显示示例图;
图7给出了组合立体元素的又一种显示示例图;
图8为本申请实施例二提供的确定候选吸附点集合的实现流程图;
图9为对投影点信息集合中投影点进行筛选的一种实现示例图;
图10为对投影点信息集合中投影点进行筛选的另一种实现示例图;
图11为本申请实施例二提供的确定候选吸附线集合的实现流程图;
图12为所构建用于吸附筛选的平行四边形的示例图;
图13~图15分别给出了所设定吸附筛选条件的一种效果展示图;
图16为本申请实施例三提供的一种线段吸附装置的结构框图;
图17为本申请实施例四提供的一种线段吸附设备的结构示意图。
具体实施方式
下面结合附图和实施例对本申请进行说明。所描述的实施例仅仅用于解释本申请,而非对本申请的限定,此外,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。为了便于描述,附图中仅示出了与本申请相关的部分而非全部内容。
实施例一
图1为本申请实施例一提供的一种线段吸附方法的流程图。该实施例适用于将画布中的选定线段吸附到立体元素上的情况,其中,该实施例提供的方法可以由线段吸附设备执行,该线段吸附设备可以通过软件和/或硬件的方式实现,该线段吸附设备可以是两个或多个物理实体构成,也可以是一个物理实体构成。在一实施例中,该线段吸附设备可以是电脑,手机,平板或交互智能平板等。
实施例中以交互智能平板为线段吸附设备进行示例性描述。其中,交互智能平板可以是通过触控技术对显示在显示平板上的内容进行操控和实现人机交互操作的一体化设备,其集成了投影机、电子白板、幕布、音响、电视机以及视频会议终端等一种或多种功能。在一实施例中,交互智能平板的显示屏可以是电容屏、电阻屏、红外屏或者电磁屏等。用户可以通过手指或者触控笔对交互智能平板进行触控操作。
在一实施例中,交互智能平板中安装有操作系统自带的应用软件,同时,也安装有从第三方设备或者服务器中下载的应用软件,其中,应用软件的类型及内容可以根据实际情况设定,在一实施例中,该应用软件具有书写、绘图、批注、课件制作以及展示播放等功能。实施例中设定该应用软件具有绘图、课件制作及展示播放功能,其中,课件制作是指在交互智能平板等计算机设备上通过用户在课件编辑页面的画布上进行元素输入或插入操作,所述元 素可以是三维元素或二维元素等,其三维元素或二维元素可直接在画布上绘制形成,或者先基于绘图功能绘制并通过插入操作插入到画布上,且三维元素可以是立体几何元素如四面体、长方体、圆柱以及圆锥等,二维元素可以是点、线以及平面几何元素如四边形、多边形等。此外,展示播放可指将课件编辑页面中内容在授课模式下作为演示播放页面进行的课件演示,展示播放可通过演示播放按钮触发。在一实施例中,本实施例可以将用户在编辑画布上编辑的元素内容进行展示播放,且在展示播放模式下也可以对展示元素的状态进行调整,如对展示的线段进行选定及移动或旋转操作等。
示例性的,参考图1,本实施例提供的线段吸附方法包括:
S101、确定显示于画布中各立体元素的线点投影信息。
在本实施例中,所述画布可理解为进行元素绘制或元素展示的二维平面载体。在一实施例中,显示在画布中的立体元素相当于所绘制立体元素在二维平面中投影后的元素,其立体元素的绘制在设定的三维场景中实现,通过三维矩阵投影原理将绘制的立体元素投影显示在画布中。
在本实施例中,所述线点投影信息可理解为三维场景中所绘制立体元素的线和点投影后在画布中的标示信息,示例性地,三维场景中立体元素的点以空间坐标形式来标示,立体元素的边则可通过立体元素中处于该边上的两点的空间坐标来表示。相应的,在已知立体元素各顶点的空间坐标后,基于给定的投影矩阵,能够获得立体元素投影到画布后,立体元素各顶点的投影坐标,同时基于顶点的投影坐标,也可表示立体元素各边在画布中的线投影标示。本实施例将立体元素各顶点的投影坐标以及各边的线投影标示统称为线点投影信息。
在一实施例中,本实施例可预先确定立体元素的线点投影信息,并关联存储立体元素在三维空间下线点空间信息与画布中线点投影信息,本步骤可以在触发进行线段的吸附操作时,从关联存储的线点空间及投影信息中,获得画布中当前所显示各立体元素的线点投影信息。
S102、响应于接收到作用在所述画布中任一线段元素的选定操作,获得选定线段的线点信息。
在本实施例中,作为当前显示页或编辑页的画布中,除显示有投影后的立体元素外,还可以显示点、线或者面等平面几何元素,本实施例实现线段到立体元素的吸附,可认为画布中当前至少存在一条线段,且用户可对画布中的任一条线段进行选定操作,所述选定操作可理解为用户通过鼠标或对触摸显示屏对画布中元素进行点击或触摸选定的操作,本步骤可以响应用户作用在画布中任一线段元素上的选定操作。
在一实施例中,在接收到用户对任一线段元素的选定操作后,其对该操作的响应可以体现在获得选定线段的线点信息,所述线点信息可包括选定线段中端点以及线上任一选定点在平面坐标系中的点坐标,以及基于选定线段两端点的坐标信息来表示的选定线段所属线的线标示信息。
示例性地,本步骤可以监听用户所触发的选定操作,并确定选定操作作用的目标对象,由此可获知预先记录的该目标对象的相关标示信息,本实施例中该目标对象为一条线段,且 可将该线段记为选定线段,预先记录的该选定线段的相关标示信息则为选定线段中端点及所属线的线点信息。
S103、响应于接收到作用于所述选定线段上的移动操作,确定所述待吸附线段对应的移动向量。
在本实施例中,所述移动操作可理解为用户通过鼠标对选定线段进行拖拽或通过触摸触摸显示屏对选定线段进行拖拽的操作,本步骤可以响应用户作用在选定线段上的移动操作。
在一实施例中,在接收到用户对选定线段的拖拽操作后,其对该操作的响应可以体现在监听选定线段的被拖拽过程,以获取选定线段被拖拽过程中所经过至少两个拖拽点的拖拽点坐标,且基于获取的至少两个拖拽点坐标,可以确定选定线段在拖拽中的移动向量。
S104、按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素。
在本实施例中,所述线点信息可为上述所获取选定线段上端点、选定点以及所属线在画布中的点坐标信息及线标示信息,所述移动向量可为选定线段被移动(拖拽)时的移动方向信息。各立体元素的线点投影信息可为画布中显示的所有基于点和线构成的立体元素(如长方体、四方体、圆锥体以及圆柱体等,而球体因不基于线点形成,所以不作为本实施例的吸附对象)分别具备的线点投影信息。本实施例实现线段到立体元素的吸附,所吸附的立体元素可称为目标立体元素,所述目标立体元素可以是显示在画布中的任一基于点和线构成的立体元素。
在一实施例中,选定线段待吸附的目标立体元素的确定方式可分多种情况考虑,示例性地,一种可以是考虑选定线段中的端点到立体元素中顶点的吸附,另一种可以是考虑选定线段中的任一点到立体元素中边的吸附,还有一种情况可以是考虑选定线段所属线到立体元素中边的吸附。
在本实施例中,可通过本步骤来实现上述几种情况下的目标立体元素确定,可分情况来确定选定线段相对立体元素的候选吸附线集合或候选吸附点集合。针对上述线段中点吸附到立体元素顶点的情况,本步骤可以根据选定线段的线点信息中的点坐标信息、移动向量以及立体元素中投影点的点投影坐标,确定选定线段的端点可吸附的候选吸附点,并将候选吸附点与选定线段上对应的待吸附点关联添加至候选吸附点集合中,所述待吸附点可理解为选定线段上待进行吸附操作的端点或选定点。
针对上述线段中点吸附到立体元素中边的情况,可转换为线段中的点到立体元素中边上任一点的吸附,由此,本步骤可以根据选定线段的线点信息中的点坐标信息、移动向量以及立体元素中投影边的线投影标示(可通过投影点的点投影坐标来标示),来确定选定线段上的点到立体元素的边上可吸附的候选吸附点,同样可将候选吸附点与选定线段上对应的待吸附点关联添加在候选吸附点集合中。
针对上述线段所包含的线吸附到立体元素中边的情况,本步骤可以根据选定线段的线点信息中的线标示信息(可通过点坐标信息来标示)、移动向量以及立体元素中投影边的线投 影标示,来确定选定线段到立体元素可吸附的候选吸附线,且可将候选吸附线与选定线段关联添加至候选吸附线集合中。
基于上述集中几种情况可确定出用于确定目标立体元素的候选吸附线集合(该集合可能为空)及候选吸附点集合,在一实施例中,本步骤通过筛选规则从候选吸附线集合或候选吸附点集合中确定相应的目标吸附线或目标吸附点,本步骤可以确定目标吸附点或目标吸附线归属的立体元素,并将该立体元素作为目标立体元素。在一实施例中,在目标立体元素的确定过程中,通过设定的筛选规则只会确定出一个目标吸附点或一个目标吸附线,由此,本步骤只会确定出一个目标立体元素。
S105、控制所述选定线段吸附至所述目标立体元素。
在本实施例中,可以通过位移吸附的方式控制选定线段吸附至目标立体元素,所述位移吸附包括了选定线段中待吸目标到目标立体元素上可吸附目标的吸附距离和吸附向量,由此可控制选定线段的待吸目标沿确定的吸附向量进行所确定吸附距离的偏移,从而实现选定线段到目标立体元素的吸附。
在一实施例中,所述待吸目标可以是选定线段中的端点或线段上的任一点,也可以是选定线段,所述可吸附目标可以是目标立体元素中的可吸附点或可吸附线。在一实施例中,所述待吸目标及可吸附目标可基于上述S104确定目标立体元素时依赖的目标吸附点或目标吸附线来确定。
示例性地,当目标立体元素通过目标吸附点确定时,所述可吸附目标直接为该目标吸附点,而待吸目标则为目标吸附点关联的待吸附点(端点或线段上的选定点);当目标立体元素通过目标吸附线确定时,所述可吸附目标直接为该目标吸附线,而待吸目标则为选定线段自身。在一实施例中,本实施例基于待吸目标及可吸附目标的不同,其确定吸附距离及吸附向量时的方法也存在不同。
S106、显示吸附后形成的组合立体元素。
在本实施例中,所述组合立体元素可理解为选定线段吸附到目标立体元素后组合形成的立体元素,本步骤中的显示可指组合立体元素在画布中的显示,在一实施例中,将组合立体元素时显示在画布中之前,需要确定组合立体元素中各线点的三维标示信息,通过投影矩阵确定组合立体元素中各线点的三维标示信息到画布中的线点投影信息,根据组合立体元素的线点投影信息将组合立体元素显示在画布中。
本申请实施例提供的一种线段吸附方法,能够根据选定线段的线点信息及移动向量,结合画布中各立体元素的线点投影信息,从各立体元素中确定可吸附的目标立体元素并吸附,由此实现了线段到立体元素的智能化吸附,形成了以选定线段和目标立体元素为整体的组合立体元素,从而能够在调整组合立体元素中目标立体元素的状态时附带调整所吸附线段的状态,避免了重新手动调整线段状态的繁琐操作,提升了教学体验。
实施例二
图2为本申请实施例二提供的一种线段吸附方法的流程图,该实施例以上述实施例为基 础,在本实施例中,按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素,可以包括:提取所述线点信息中的点坐标信息和线标示信息,并基于各所述立体元素的线点投影信息,获得各所述立体元素的可视线点投影信息;根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合;根据所述移动向量、所述线标示信息及各所述可视线点投影信息中的线投影标示,确定所述选定线段对应的候选吸附线集合;如果所述候选吸附线集合为非空,则从所述候选吸附线集合中确定所述选定线段的目标吸附线,将包含所述目标吸附线的立体元素作为目标立体元素;否则,从所述候选吸附点集合中确定所述选定线段的目标吸附点,并将包含所述目标吸附点的立体元素作为目标立体元素。
本实施例在显示吸附后形成的组合立体元素之后,还包括:接收第一状态调整操作,所述第一状态调整操作作用在所述组合立体元素的目标立体元素上;
控制调整所述组合立体元素,并显示状态调整后的组合立体元素。
此外,本实施例在显示吸附后形成的组合立体元素之后,还包括:
接收第二状态调整操作,所述第二状态调整操作作用在所述组合立体元素的选定线段上;控制调整所述选定线段,分别显示所述组合立体元素中的选定线段和目标立体元素的当前状态。
在一实施例中,如图2所示,本申请实施例提供的一种线段吸附方法,包括如下操作:
S201、确定显示于画布中各立体元素的线点投影信息。
示例性地,可以监听当前显示在画布中的所有立体元素(本实施例可选为基于线点构成的立体元素),并从关联存储的线点空间及线点投影信息中,获取画布中各立体元素的线点投影信息。
S202、响应于接收到作用在所述画布中任一线段元素的选定操作,获得选定线段的线点信息。
示例性地,接收到用户对触摸显示屏的触摸点击生成的选定操作,响应该选定操作以确定用户选定的选定线段,并可获得该选定线段的线点信息。
S203、响应于接收到作用于所述选定线段上的移动操作,确定所述待吸附线段对应的移动向量。
示例性地,接收到用户对选定线段的触摸拖拽生成的移动操作,响应该移动操作以确定选定线段的移动向量。
在一实施例中,本实施例下述S204至S209为确定目标立体元素的实现步骤。
S204、提取所述线点信息中的点坐标信息和线标示信息,并基于各所述立体元素的线点投影信息,获得各所述立体元素的可视线点投影信息。
在本实施例中,所述选定线段的线点信息以及所显示各立体元素的线点投影信息均为目标立体元素确定的前提信息,本步骤从选定线段的线点信息中提取点坐标信息(可以是选定线段的端点坐标信息、选定线段上任一选定点的坐标信息),以及选定线段所属线的线标示 信息,所述线标示信息可选通过选定线段两端点的端点坐标来标示。
在一实施例中,本步骤从各立体元素的线点投影信息中获取各所述立体元素的可视线点投影信息,所述可视线点投影信息可理解为立体元素投影到画布后,用户在交互层面上可实际看到的立体元素的边或点的投影信息。
在一实施例中,三维立体元素到二维画布上进行投影后,其包括了可视的线(边)点和非可视的线(边)点两部分,而本实施例中,线段仅能对可视的线(边)点进行吸附,因此,本实施例基于本步骤从线点投影信息中提取可视线点的可视线点投影信息。在一实施例中,,在已知三维立体元素投影方向后,就可以确定立体元素的哪些边和点投影后处于不可见状态,由此本步骤可直接从线点投影信息查找到投影后处于非可视状态的边和点对应的投影信息,从而可以从中提取出可视线点投影信息。
示例性地,图3给出了立体元素投影在画布后的投影示例图。如图3所示,长方体21为在三维场景中构建,通过三维矩阵投影到画布后形成的立体投影元素,且长方体21在三维场景中包含了顶点A、B、C、D、A'、B'、C'以及D',且上述各顶点还分别构成了长方体21的各条边,本实施例可以确定上述各顶点的点空间坐标以及投影后关联的点投影坐标,同时也可以获得标示各条边的线三维标示信息以及投影后关联的线投影标示。
可以发现,投影在画布中的长方体21,其顶点A'处于非可视状态,且基于顶点A'构成的边AA'、边A'B'以及边A'D'也处于非可视状态,由此可认为长方体21处于当前状态时,待吸附线段无法吸附到顶点A'或者边AA'、边A'B'以及边A'D'上,基于本实施例上述S204,可以提取出除顶点A'、边AA'、边A'B'以及边A'D'外余下7点9边的可视线点投影信息。
S205、根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合。
基于上述描述,本实施例中目标立体元素的确定分三种不同的吸附情况考虑,而实现三种不同的吸附情况的前提是确定选定线段对应的候选吸附点集合和/或候选吸附线集合。
本步骤获得用于目标立体元素确定的候选吸附点集合,所述候选吸附点集合可理解为:立体元素上作为选定线段候选吸附点的投影点集合,所述候选吸附点集合中包括了选定线段上待吸附点的点坐标以及与其关联的候选吸附点的点投影坐标。
在一实施例中,执行候选吸附点集合确定的情况包括:选定线段的端点吸附到立体元素顶点的情况,以及选定线段上的点吸附到立体元素边的情况。其中,选定线段上的点吸附到立体元素边的情况,实际可看作选定线段中的点能够吸附在立体元素的边上的点的情况。
在一实施例中,本步骤可以根据选定线段所对应点坐标信息中的端点坐标、移动向量以及各所述可视线点投影信息,结合给定的顶点筛选规则从立体元素的各可视顶点中筛选确定端点的候选吸附点;还可以根据选定线段所对应点坐标信息中的任一选定点的选定点坐标、移动向量以及各可视线点投影信息,结合给定的交点筛选规则从立体元素的各可视边上筛选确定选定点可吸附的候选吸附点。
S206、根据所述移动向量、所述线标示信息及各所述可视线点投影信息中的线投影标示, 确定所述选定线段对应的候选吸附线集合。
基于上述描述,本步骤获得用于目标立体元素确定的候选吸附线集合,其中,执行候选吸附线集合确定的情况包括:选定线段吸附到立体元素边的情况。所述候选吸附线集合可理解为:立体元素上作为选定线段候选吸附线的投影边集合,所述候选吸附线集合中包括了选定线段关联的候选吸附线的线投影标示。执行候选吸附线集合确定的情况为:选定线段吸附到立体元素边的情况。
S207、确定所述候选吸附线集合是否为空,若否,则执行S208;若是,则执行S209。
在本实施例中,基于上述S205和S206分别获得候选吸附点集合和候选吸附线集合后,需要从候选吸附点集合或候选吸附线集合中选出选定线段待吸附的目标吸附点或目标吸附线。
在一实施例中,本实施例考虑采用S208从候选吸附线集合中选取目标吸附线,但如果确定出的候选吸附线集合为空,则可考虑采用S209从候选吸附点集合中选取目标吸附点。
S208、从所述候选吸附线集合中确定所述选定线段的目标吸附线,将包含所述目标吸附线的立体元素作为目标立体元素。
在本实施例中,当候选吸附线集合为非空时,考虑基于本步骤从候选吸附线集合中确定目标吸附线;其中,本实施例考虑采用成本最小化的方式在候选吸附线集合中确定目标吸附线,且将包含目标吸附线的立体元素作为目标立体元素。
本步骤可将选定线段到候选吸附线的线吸附距离作为成本最小化的判定标准,由此可确定出到选定线段的线吸附距离最小的候选吸附线来作为目标吸附线。
在一实施例中,本实施例将从所述候选吸附线集合中确定所述选定线段的目标吸附线,可以包括:针对所述候选吸附线集合中的每条候选吸附线,确定所述候选吸附线到所述选定线段的线吸附距离;比对各候选吸附线的线吸附距离,将最小吸附距离对应的候选吸附线确定为目标吸附线。
在本实施例中,上述目标吸附线的确定在实现时还存在另外一种方式,即可以先设定一个最小吸附成本的变量,并为该最小吸附成本进行一个设定阈值的赋值;从候选吸附线集合中选取一个候选吸附线,并确定该候选吸附线与选定线段的线吸附距离,如果该线吸附距离小于最小吸附成本的当前赋值,则将该线吸附距离作为最小吸附成本的新的当前赋值,并循环执行候选吸附线的选取及吸附距离判定,直至遍历完候选吸附线集合中的所有候选吸附线,之后确定最小吸附成本的当前赋值对应的候选吸附线并将其作为目标吸附线,如果最小吸附成本最终的当前赋值仍为初始的设定阈值,则选取吸附线距离与该设定阈值之差最小的候选吸附线作为目标吸附线。
本实施例采用成本最小化来进行目标吸附线距离的筛选,能够保证选中线段到筛选出的目标吸附线进行吸附时的吸附效果更好,吸附成本更优。
S209、从所述候选吸附点集合中确定所述选定线段的目标吸附点,并将包含所述目标吸附点的立体元素作为目标立体元素。
在本实施例中,当候选吸附线集合为空时,考虑基于本步骤从候选吸附点集合中确定目标吸附点,其中,本实施例同样考虑采用成本最小化的方式来候选吸附点集合中确定目标吸附点,且将包含目标吸附点的立体元素作为目标立体元素。
本步骤可确定选定线段到候选吸附点的点吸附距离;还可确定选定线段到候选吸附点的吸附向量,由于成本最小化的判定标准应当由一个参量构成,因此,可基于存在两个已知信息来确定一个参量作为成本最小化的判定标准,本步骤后续可确定出到选定线段的参量值最小的候选吸附点来作为目标吸附点。
在一实施例中,本实施例将从所述候选吸附点集合中确定所述选定线段的目标吸附点,可以包括:针对所述候选吸附点集合中每个候选吸附点,确定所述候选吸附点到相应待吸附点的点吸附距离和吸附向量;根据各所述点吸附距离及吸附向量,结合所述移动向量确定所述候选吸附点的判定距离;比对各候选吸附点的判定距离,将最小判定距离对应的候选吸附点确定为目标吸附点。
在本实施例中,基于上述选定线段与候选吸附点的点吸附距离和吸附向量,可以构建一个包含候选吸附点及选定线段上与之关联的端点且以点吸附距离为斜边的直角三角形,本实施例可将直角三角形中由候选吸附点垂直于移动向量形成的直角边作为成本最小化的判定标准,且作为成本最小化的判定标准的直角边相当于候选吸附点与待吸附点的判定距离。其中,待吸附点为选定线段上当前所判断候选吸附点关联的端点或选定点。
同样的,上述目标吸附点的确定在实现时也存在另外一种方式,即,也可以设定一个最小吸附成本的变量,并为该最小吸附成本进行一个设定长度值的赋值;从候选吸附点集合中选取一个候选吸附点,并确定该候选吸附点与选定线段上待吸附点的判定距离,如果该判定距离小于最小吸附成本的当前赋值,则将该判定距离作为最小吸附成本的新的当前赋值,并执行候选吸附点的选取及距离判定,直至遍历完候选吸附点集合中的所有候选吸附点,确定最小吸附成本的当前赋值对应的候选吸附点并将其作为目标吸附点,如果最小吸附成本最终的当前赋值仍为初始的设定长度值,则选取判定距离与该设定长度值之差最小的候选吸附点作为目标吸附点。
在一实施例中,本实施例采用成本最小化来进行目标吸附线距离的筛选,能够保证选中线段到筛选出的目标吸附线进行吸附时的吸附效果更好,吸附成本更优。
S210、控制所述选定线段吸附至所述目标立体元素。
在一实施例中,本实施例上述S210基于目标立体元素的确定实现方式不同,可以采用不同的方式来实现,在一实施例中,当所述目标立体元素通过确定目标吸附点获得时,所述控制所述选定线段吸附至所述目标立体元素,包括:确定所述目标吸附点对应的所述选定线段上的待吸附点;确定所述目标吸附点与相应待吸附点的目标点吸附距离和目标吸附向量;控制所述选定线段沿所述目标吸附向量进行所述目标点吸附距离的偏移,以使所述选定线段上的待吸附点与所述目标立体元素上的目标吸附点相吸附。
在一实施例中,目标吸附点出自于候选吸附点集合,候选吸附点集合中存储了候选吸附 点的坐标值以及与之对应的待吸附点的坐标值,由此,可以根据两点的坐标值确定两点的距离,本实施例将该距离作为目标吸附点与待吸附点的目标点吸附距离;根据两点的坐标值还可以确定两点形成的坐标向量,该坐标向量可作为目标吸附点与待吸附点的目标吸附向量。本步骤可以控制选定线段沿目标吸附向量进行目标吸附距离的偏移,实现选定线段基于待吸附点与目标立体元素的吸附。
此外,当所述目标立体元素通过确定目标吸附线获得时,所述控制所述选定线段吸附至所述目标立体元素,包括:确定所述目标吸附线到选定线段的目标线吸附距离;将所述选定线段的移动向量确定所述选定线段的吸附移动方向;控制所述选定线段沿所述吸附移动方向进行所述目标线吸附距离的偏移,以使所述选定线段与所述目标立体元素上的目标吸附线相吸附。
上述对目标吸附线的吸附控制过程,能够实现目标吸附线到目标立体元素的动态吸附,保证了线段的智能化吸附。
在一实施例中,目标吸附线出自候选吸附线集合,候选吸附线集合中存储了标示候选吸附线的线投影标示,可知,目标吸附线与选定线段平行,选定线段到目标吸附线移动时,可将选定线段的移动向量确定所述选定线段的吸附移动方向,此外,本步骤还可以确定出选定线段沿移动向量方向移动时的移动距离,并将该移动距离记为目标吸附线到选定线段的目标线吸附距离。本步骤控制选定线段沿吸附移动方向进行目标线吸附距离的偏移,实现选定线段基于目标吸附线与目标立体元素的吸附。
S211、显示吸附后形成的组合立体元素。
在一实施例中,当选定线段吸附到目标立体元素后,需要对选定线段进行处理,从而让选定线段转换为三维场景的立体线段。进行空间坐标转换后,站在人机交互的角度,用户看到的选定线段在画布中展现的位置仍是二维吸附立体元素后的位置,但在数据表示上,选定线段则已为三维空间的立体几何表示,该种表示方式可理解为一种特殊表示方式,相当于将选定线段从三个层次进行数据表示。
图4给出了选定线段的数据信息进行三层表示的示意图;如图4所示,选定线段的数据信息可以分为三层来表示,第一层201为线段层,线段层可认为是选定线段在目标立体元素上的数据表示,即表示三维场景中的选定线段;第二层202为投影层,投影层表示将选定线段在三维场景下的数据信息投影到画布中对应的数据信息,第三层203为交互层,因为当前的选定线段已经与目标立体元素形成了组合立体元素,但用户期望该选定线段还具备用来线段的交互方式,如点击画布上组合立体元素中的选定线段对该选定线段进行独立操作,所以交互层上对选定线段数据的处理就是让交互的用户感知不到选定线段已经与目标立体元素进行了组合,仍可以对选定线段在画布中进行与之前相同的交互。
综上,本步骤对组合立体元素进行显示的关键在于确定三维场景下选定线段的数据信息。在一实施例中,本实施例上述S211基于目标立体元素的确定实现方式不同,同样可以采用不同的方式来实现。
在一实施例中,当所述目标立体元素通过确定目标吸附点获得时,所述显示吸附后形成的组合立体元素,包括:根据所述目标吸附点的空间坐标信息,确定所述选定线段的第一线点空间信息;将所述第一线点空间信息与所述目标立体元素的线点空间信息相结合,构成包含所述选定线段和目标立体元素的第一组合立体元素;将所述第一组合立体元素投影显示在所述画布中。
示例性地,图5给出了组合立体元素的一种显示示例图,如图5所示,可知,目标立体元素中的顶点C为目标吸附点,选定线段中的端点A'为与顶点C关联的待吸附点。可以发现,在三维场景中,端点A'的空间坐标应与顶点C相同,且该种吸附方式中选定线段A'B'上各点在三维场景中的z坐标值相同,均为顶点C的z坐标值,由此,已知三维场景在画布的投影矩阵的前提下,可逆向确定端点B'的空间坐标,进而依据端点A'和端点B'的空间坐标作为选定线段在标示三维场景中第一线点空间信息。
示例性地,图6给出了组合立体元素的另一种显示示例图,如图6所示,可知,目标立体元素中的边CE上存在一个点Q为目标吸附点,选定线段A'B'上存在一个点W为与目标吸附点Q关联的待吸附点。可以发现,在三维场景中,点W的空间坐标与点Q相同,且该种吸附方式中选定线段A'B'上各点在三维场景中的z坐标值依旧相同,均为点Q的z坐标值,由此,已知三维场景在画布的投影矩阵的前提下,可逆向确定选定线段中端点A'和端点B'的空间坐标,进而依据端点A'和端点B'的空间坐标作为选定线段在标示三维场景中第一线点空间信息。
此外,当所述目标立体元素通过确定目标吸附线获得时,所述显示吸附后形成的组合立体元素,包括:根据所述目标吸附线的线点空间信息,确定所述选定线段的第二线点空间信息;将所述第二线点空间信息与所述目标立体元素的线点空间信息相结合,构成包含所述选定线段和目标立体元素的第二组合立体元素;将所述第二组合立体元素投影显示在所述画布中。
本实施例将选定线段和目标立体元素进行组合时,考虑了目标吸附点或目标吸附线所对应不同吸附场景下选定线段的空间化吸附,由此保证了选定线段和目标立体元素进行吸附后在三维空间中的整体性。
示例性地,图7给出了组合立体元素的又一种显示示例图,如图7所示,可知,目标立体元素中的边CE为目标吸附线,选定线段A'B'吸附到了边CE上,由此,确定选定线段A'B'的第二线点空间信息的过程可表示为:获取边CE在画布中的点投影坐标以及选定线段的端点A'和端点B'的坐标值;根据上述坐标信息,可以确定画布中线段CA'、线段A'E、线段EB'以及线段CB'的长度值;获取三维场景中边CE与画布之间的夹角为a;基于夹角a以及画布中线段CA'、线段A'E、线段EB'以及线段CB'的长度值,可以确定各线段在三维场景中的线段长度值;在已知边CE的空间坐标、各线段在三维场景中的线段长度值以及三维场景在画布的投影矩阵后,可逆向确定选定线段A'B'的端点A'和端点B'的空间坐标,进而依据端点A'和端点B'的空间坐标作为选定线段在标示三维场景中第二线点空间信息。
S212、接收第一状态调整操作,控制调整所述组合立体元素,并显示状态调整后的组合立体元素。
在本实施例中,用户可以对显示在画布中的组合立体元素进行第一状态调整操作,且所述第一状态调整操作可以作用在所述组合立体元素的目标立体元素上。本步骤接收到该第一状态调整操作时,可以根据第一状态调整操作的操作内容,控制调整该组合立体元素的显示状态,所述第一状态调整操作可以是对目标立体元素上的移动操作、旋转操作等,此时,吸附到目标立体元素上的选定线段跟随目标立体元素进行同样的移动或旋转。
S213、接收第二状态调整操作,控制调整所述选定线段,分别显示所述组合立体元素中的选定线段和目标立体元素的当前状态。
在本实施例中,用户还可以对显示在画布中的组合立体元素进行第二状态调整操作,且所述第二状态调整操作作用在所述组合立体元素的选定线段上。本步骤接收到该第二状态调整操作时,可以根据第二状态调整操作的操作内容,仅控制调整该组合立体元素上选定线段的显示状态,所述第二状态调整操作可以是对选定线段的移动操作、旋转操作等。
示例性地,假设第二状态调整操作为选定线段的移动操作,则只对选定线段进行移动,则相当于取消了选定线段和目标立体元素的吸附联系,将分离显示组合立体元素中的选定线段和目标立体元素。
本申请实施例提供的方法,选定线段待吸附立体元素的确定操作可包括:确定候选吸附点集合或候选吸附线集合,从候选吸附点集合中确定目标吸附点,或从候选吸附线集合中确定目标吸附线,将目标吸附点或目标吸附线归属的立体元素确定为待吸附的目标立体元素。同时还增加对吸附后所形成组合立体元素的状态调整操作。利用该方法,实现了线段到立体元素的智能化吸附,形成了以选定线段和目标立体元素为整体的组合立体元素,且形成的组合立体元素能够在调整目标立体元素状态时附带调整选定线段,避免了重新手动调整线段状态的繁琐操作,提升了教学体验,同时,还能够在调整组合立体元素中的选定线段时,保持所包含的目标立体元素不变,仅控制选定线段的调整,由此既实现了线段随附立体元素的状态调整,又避免了交互层面中线段吸附对用户调控线段状态的影响。
同时,在一实施例中,图8为本申请实施例二提供的确定候选吸附点集合的实现流程图,如图8所示,本实施例将根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合,包括下述操作:
S2051、获取所述点坐标信息中选定线段两端点的端点坐标及线段上任一选定点的选定点坐标。
在一实施例中,本步骤用来获取候选吸附点集合确定所需的选点线段的端点坐标及选定点坐标。其中,所述选定点可以是选定线段上的任一点,可以预先随机选定。
S2052、提取各所述可视线点投影信息中的点投影坐标和线投影标示,分别获得投影点信息集合和第一投影边信息集合。
在一实施例中,本步骤用来提取候选吸附点集合确定所需的投影点信息和投影线信息, 且本步骤将从各可视线点投影信息提取出的点投影坐标统一添加至投影点信息集合,将从各可视线点投影信息提取出的线投影标示统一添加至投影边信息集合,为便于区分,本步骤记该投影边信息集合为第一投影边信息集合。
在一实施例中,下述S2053和S2055相当于两个并列情况,分别对应了选定线段的端点吸附到立体元素顶点的情况以及选定线段中的点能够吸附在立体元素的边上的点的情况。
S2053、针对所述选定线段的每个端点,执行S2054。
示例性地,本步骤相当于下述S2054的前提步骤,重点在于确定执行对象,所述执行对象实际为选定线段的每个端点。对于选定线段的每个端点,都可以执行下述S2054的操作。
S2054、根据移动向量、端点的端点坐标及投影点信息集合,确定端点待吸附的第一候选投影点,并将端点作为待吸附点以及各第一候选投影点分别作为候选吸附点,关联添加至候选吸附点集合。
在本实施例中,所述移动向量相当于用户拖拽选定线段移动的移动方向,所述端点的端点坐标指选定线段初始在画布上的端点坐标,所述投影点信息集合包含了画布中所显示立体元素投影点的点投影坐标,本步骤确定端点待吸附第一候选投影点的过程可描述为:基于端点的端点坐标,以及各投影点的点投影坐标,来确定端点到各投影点的坐标向量和坐标距离,通过坐标向量和移动向量来判定相应投影点是否可以作为该端点的候选投影点,为便于区分,本步骤该候选投影点为第一候选投影点。
此外,确定出端点的第一候选投影点后,需要将该端点作为待吸附点与作为候选吸附点的第一候选投影点关联添加至候选吸附点集合,基于本步骤的操作,该端点在候选吸附点集合中可以关联存在一个或多个第一候选投影点,或者,不存在第一候选投影点。
在一实施例中,本实施例上述S2054的实现可为:针对所述投影点信息集合中的每个投影点,基于所述端点坐标及所述投影点的点投影坐标,确定所述端点到所述投影点的坐标向量;确定所述坐标向量与所述移动向量的向量夹角值;如果所述向量夹角值的绝对值小于或等于设定夹角阈值,则将所述投影点确定为所述端点待吸附的第一候选投影点。
在本实施例中,基于上述实现过程,可以确定出端点相对投影点信息集合中每个投影点的坐标向量,并可将该坐标向量与移动向量形成一个向量夹角值,本实施例可通过向量夹角值的绝对值与设定夹角阈值的比对,来确定该投影点是否可作为端点的第一候选投影点。
在一实施例中,本实施例基于上述实现过程进行第一候选投影点的确定时,考虑了所有的投影点,这种处理方式可能会增加候选投影点确定的执行时间,从而影响整个线段吸附的执行性能。为加快候选投影点的执行时间,本实施例根据选定线段的移动向量和端点坐标,确定一个有效区域,从投影点信息集合中筛选处于有效区域的有效投影点,形成有效投影点集。在一实施例中,确定有效区域并对投影点的筛选可以包括下述至少一种方式:
方式一:确定与所述移动向量垂直的且过当前所选端点的临界直线,将画布以所述临界直线划分成两个平面区域,并将包含所述移动向量的平面区域确定为第一区域。
单考虑以该种方式形成的第一区域作为有效区域进行投影点筛选时,基于投影点信息集 合中各投影点的点投影坐标,确定投影点是否位于该有效区域内;如果投影点位于该有效区域内,则将该投影点加入至第一有效投影点集合。
其中,投影点是否位于该有效区域内的判定过程为:确定有效区域位于临界直线的上方还是下方,若为上方,则当投影点处于临界直线上方时,确定投影点处于有效区域,同理,若为下方,则当投影点处于临界直线下方时,确定投影点处于有效区域。
示例性地,图9为对投影点信息集合中投影点进行筛选的一种实现示例图,如图9所示,点A、点B、点C、点D、点E、点F以及点G相当于投影点信息集合中投影点在画布中的显示;其中,点M为显示在画布中的选定线段的一个端点,射线L的延伸方向为选定线段的移动向量,直线L'为与射线L垂直且过点M的临界直线,包含射线L的平面区域22则相当于有效区域。基于上述判定操作,可知只有点A、点B以及点C处于平面区域22中,由此可将点A、点B以及点C添加至第一有效投影点集合。
方式二:以当前选定的端点为圆心,以设定距离阈值为半径画圆,记获得的圆形区域为第二区域。
单考虑以该种方式形成的第二区域作为有效区域进行投影点筛选时,同样基于投影点信息集合中各投影点的点投影坐标,确定投影点是否位于该有效区域内;如果投影点位于该有效区域内,则将该投影点加入至第二有效投影点集合。
其中,投影点是否位于该有效区域内的判定过程为:计算投影点与所选端点的坐标距离的平方,确定坐标距离的平方小于半径平方的投影点处于有效区域中。
示例性地,图10为对投影点信息集合中投影点进行筛选的另一种实现示例图,如图10所示,点A、点B、点C、点D、点E、点F以及点G相当于投影点信息集合中投影点;点M为选定线段的一个端点,圆O形成的封闭区域23相当于有效区域,基于上述判定操作,可知只有点A、点B以及点D处于平面区域23中,由此可将点A、点B以及点D添加至第二有效投影点集合。
在一实施例中,本实施例可以基于上述任一方式对投影点进行筛选,也可以同时结合上述两种方式对投影点进行筛选,其筛选过程中有效区域的确定为:确定上述第一区域和第二区域的相交区域,将相交区域记为有效区域,基于该有效区域进行筛选时,可以以上述方式一对应的筛选判定方式获得第一有效投影点集合,第一有效投影点集合作为待筛选集合,再次进行上述方式二对应的筛选判定方式,从而获得第二有效投影点集合,由此即加快了筛选速度,又减少有效投影点的数量。
S2055、针对所述选定线段上的选定点,执行S2056。
示例性地,本步骤相当于下述S2056的前提步骤,重点在于也在于确定执行对象,所述执行对象实际为选定线段上的一个选定点,对于该选定点,可以执行下述S2056的操作。
S2056、根据移动向量、选定点坐标及第一投影边信息集合,确定选定点在待吸附投影边上对应的第二候选投影点,并将选定点作为待吸附点以及各第二候选投影点分别作为候选吸附点,关联添加至候选吸附点集合。
在本实施例中,基于上述描述,可知所述移动向量相当于用户拖拽选定线段移动的移动方向,所述选定点坐标用来表示选定点,所述第一投影边信息集合包含了画布中所显示立体元素可视投影边的线投影标示,所述线投影标示通过构成该投影边的两个投影点的点投影坐标来表示。本步骤确定选定点待吸附的第二候选投影点的过程可描述为:基于选定点坐标,移动向量以及各投影边的线投影标示,来确定选定点的待吸附投影边,之后可以确定待吸附投影边上选定点待吸附的第二候选投影点。
此外,确定出选定点的第二候选投影点后,需要将该选定点作为待吸附点与将作为候选吸附点的第二候选投影点关联添加至候选吸附点集合,基于本步骤的操作,该选定点在候选吸附点集合中可以关联存在一个或多个第二候选投影点,或者,不存在第二候选投影点。
在一实施例中,本实施例上述S2056的实现可为:基于选定点的选定点坐标及所述移动向量,构建以所述选定点为起始端点、方向与所述移动向量平行的射线,并获得所述射线的射线标示;针对所述第一投影边信息集合中的每个第一投影边,根据所述第一投影边的线投影标示及所述射线标示,确定所述第一投影边是否与所述射线存在第一交点;若存在,则确定所述第一交点与所述选定点的坐标点距离,并当所述坐标点距离小于设定距离阈值时,确定所述第一投影边为所述选定点的待吸附投影边,所述第一交点为所述选定点的第二候选投影点。
在本实施例中,基于上述实现过程,可以构建以选定点为起始端点的射线,并可以获得该射线的射线标示,所述射线标示包括起始端点的坐标以及射线的延伸方向(与移动向量平行)。基于所述射线标示,可以确定该射线所在的直线方程,根据第一投影边的线投影标示,可以确定第一投影边所在的直线方程,由此,基于两直线方程,可以确定射线与第一投影边是否存在第一交点,当存在第一交点,且第一交点与选定点的坐标点距离小于设定距离阈值时,就可认为该第一投影边为选定点的待吸附投影边,并可将存在的第一交点作为选定点的第二候选投影点。
上述S2051至S2056的步骤流程,实现了选定线段所对应候选吸附点集合的确定,基于上述步骤,考虑了不同情况下选定线段所对应候选吸附点的确定方式,从而保证了所确定候选吸附点的准确性和有效性,进而提高了后续筛选获得目标吸附点时的筛选准确度。
此外,在本申请实施例二的另一个可选实施例中,图11为本申请实施例二提供的确定候选吸附线集合的实现流程图,如图11所示,本可选实施例将根据所述移动向量、所述线标示信息及各所述可视线点投影信息中的线投影标示,确定所述选定线段对应的候选吸附线集合,包括下述操作:
S2061、根据所述移动向量及所述线标示信息,构建用于吸附筛选的平行四边形区域。
在本实施例中,所述移动向量相当于用户拖拽选定线段移动的移动方向,所述线标示信息为基于选定线段两端点的端点坐标组成的信息。本步骤在已知选定线段的移动向量和线标示信息后,基于已知信息来确定平行四边形的边长及相邻边的夹角值,从而构建一个平行四边形区域,以用于选定线段可吸附投影边的筛选。
在一实施例中,本实施例上述S2061的实现可为:根据所述线标示信息中选定线段两端点的端点坐标,确定所述选定线段的线段长度;确定所述选定线段与所述移动向量构成的夹角值;构建以所述线段长度为第一边长,设定的吸附距离阈值为第二边长以及边夹角为所述夹角值或为所述夹角值余角的平行四边形区域。
在本实施例中,将待构建的平行四边形相邻两边分别记为第一边和第二边,且第一边对应的第一边长为选定线段的线段长度,第二边对应的第二边长为设定的吸附距离阈值,边夹角为选定线段与移动向量构成的夹角值或夹角值余角。
示例性地,图12为所构建用于吸附筛选的平行四边形的示例图,如图12所示,在构建形成的平行四边形210中,线段AB作为选定线段,相当于平行四边形210中的第一边的第一边长,线段AC作为设定的吸附距离阈值,相当于平行四边形210中第二边的第二边长,且线段AB与线段AC构成的∠BAC相当于平行四边形中第一边与第二边的边夹角,边夹角∠BAC的角度值可以为选定线段与所述移动向量构成的夹角值。
S2062、根据各所述可视线点投影信息中的线投影标示,形成第二投影边信息集合。
在本实施例中,可视线点投影信息中的线投影标示用于标示立体元素在画布中可视的投影边。本步骤可以将可视线点投影信息中的线投影标示添加至第二投影边信息集合中,从而形成了包含画布中所有可视的投影边的投影边信息集合。
S2063、根据所述平行四边形区域,从所述第二投影边信息集合中筛选所述选定线段的候选吸附线。
在本实施例中,对于选定线段到立体元素边的吸附,可保证选定线段应当与待吸附的边保持平行,从而使选定线段能够完全贴合立体元素的边进行吸附;此外,由于平行四边形中第二边的边长为吸附距离阈值,本步骤可以通过该吸附距离阈值设定平行四边形区域的吸附筛选条件,从而从第二投影边信息集合中筛选满足吸附筛选条件的第二投影边,以作为选定线段的候选吸附线。
在一实施例中,本实施例上述S2063的实现可包括:针对所述第二投影边信息集合中的每个第二投影边,根据所述第二投影边的线投影标示及所述线标示信息,确定所述第二投影边是否与所述选定线段平行;若平行,则确定所述第二投影边是否满足基于所述平行四边形区域设定的吸附筛选条件;若满足,则将所述第二投影边确定为所述选定线段的候选吸附线。
本实施例可对第二投影边信息集合中的每个第二投影边进行上述步骤的筛选判定,从而筛选出与选定线段平行的,且满足吸附筛选条件的候选吸附线,其中所述吸附筛选条件的设定可用于来判定第二投影边是否处于平行四边形内,或者是否与平行四边形的第二边存在交点,从而来确定第二投影边是否可作为选定线段的候选吸附线。
在一实施例中,所述吸附筛选条件包括下述至少一项:
第二投影边延长线与作为第二边的第一阈值距离边存在第二交点,且所述第二交点位于所述第二投影边上;第二投影边延长线与作为第二边的第二阈值距离边存在第三交点,且所述第三交点位于所述第二投影边上;第二投影边延长线与作为第二边的第一阈值距离边和第 二阈值距离边分别存在第四交点和第五交点,且所述第二投影边处于第四交点和第五交点的连线上。
在一实施例中,所构建的平行四边形区域包括两条第二边,本实施例将其中两条第二边分别记为第一阈值距离边和第二阈值距离边,本实施例给出的吸附筛选条件可以包含上述至少一项,即当已经过平行筛选的第二投影边满足上述至少一条时,就可认为该第二投影边为选定线段的候选吸附线。
示例性地,图13~图15分别给出了所设定吸附筛选条件的一种效果展示图,其中,在图13至图15中,所示的线段AC为平行四边形其中的一条第二边,相当于第一阈值距离边;线段BD为另一条第二边,相当于第二阈值距离边;且可将线段EF记为第二投影边。如图13所示,给出了上述第一种吸附筛选方式的效果展示,即,第二投影边EF形成延长线与线段AC相交,且交点处于第二投影边EF上;如图14所示,给出了上述第二种吸附筛选方式的效果展示,即,第二投影边EF形成的延长线与线段BD相交,且交点处于第二投影边EF上;如图15所示,给出了上述第三种吸附筛选方式的效果展示,即,第二投影边EF形成的延长线分别与线段AC和线段BD相交,且第二投影边EF处于两交点的连线上。
S2064、获得包含所述选定线段各所述候选吸附线的候选吸附线集合。
本步骤可将基于上述S2063确定出的候选吸附线均添加到候选吸附线集合中。
上述S2061至S2064的步骤流程,实现了选定线段所对应候选吸附线集合的确定,基于上述步骤,实现了立体元素中与选定线段所平行投影线的有效筛选,从而保证了所确定候选吸附线的准确性和有效性,进而提高了后续筛选获得目标吸附线时的筛选准确度。
实施例三
图16为本申请实施例三提供的一种线段吸附装置的结构框图,本实施例提供的线段吸附装置集成在线段吸附设备中,一般地,线段吸附设备可以是电脑,手机,平板或交互智能平板等。如图16所示,该装置包括:第一确定模块31、第一响应模块32、第二响应模块33、第二确定模块34、吸附控制模块35以及组合显示模块36。
其中,第一确定模块31,设置为确定显示于画布中各立体元素的线点投影信息。
第一响应模块32,设置为响应于接收到作用在所述画布中任一线段元素的选定操作,获得选定线段的线点信息。
第二响应模块33,设置为响应于接收到作用于所述选定线段上的移动操作,确定所述待吸附线段对应的移动向量。
第二确定模块34,设置为按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素。
吸附控制模块35,设置为控制所述选定线段吸附至所述目标立体元素。
组合显示模块36,设置为显示吸附后形成的组合立体元素。
本实施例的上述技术方案,能够根据选定线段的线点信息及移动向量,结合画布中各立体元素的线点投影信息,从各立体元素中确定可吸附的目标立体元素并吸附,由此实现了线 段到立体元素的智能化吸附,形成了以选定线段和目标立体元素为整体的组合立体元素,从而能够在调整组合立体元素中目标立体元素的状态时附带调整所吸附线段的状态,避免了重新手动调整线段状态的繁琐操作,提升了教学体验。
在上述实施例的基础上,所述第二确定模块,包括:
信息获取单元,设置为提取所述线点信息中的点坐标信息和线标示信息,并基于各所述立体元素的线点投影信息,获得各所述立体元素的可视线点投影信息;
候选点确定单元,设置为根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合;
候选线确定单元,设置为根据所述移动向量、所述线标示信息及各所述可视线点投影信息中的线投影标示,确定所述选定线段对应的候选吸附线集合;
吸附目标确定单元,设置为当所述候选吸附线集合为非空时,从所述候选吸附线集合中确定所述选定线段的目标吸附线,将包含所述目标吸附线的立体元素作为目标立体元素;否则,从所述候选吸附点集合中确定所述选定线段的目标吸附点,并将包含所述目标吸附点的立体元素作为目标立体元素。
在上述实施例的基础上,所述候选点确定单元,包括:
第一获取子单元,设置为获取所述点坐标信息中选定线段两端点的端点坐标及线段上任一选定点的选定点坐标;
第二获取子单元,设置为提取各所述可视线点投影信息中的点投影坐标和线投影标示,分别获得投影点信息集合和第一投影边信息集合;
第一点确定子单元,设置为针对所述选定线段的每个端点,根据所述移动向量、所述端点的端点坐标及所述投影点信息集合,确定所述端点待吸附的第一候选投影点,并将所述端点作为待吸附点以及各所述第一候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合;
第二点确定子单元,设置为根据所述移动向量、选定点坐标及所述第一投影边信息集合,确定所述选定点在待吸附投影边上对应的第二候选投影点,并将所述选定点作为待吸附点以及各所述第二候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在上述实施例的基础上,所述第一点确定子单元,是设置为:
针对所述投影点信息集合中的每个投影点,针对所述选定线段的每个端点,基于所述端点坐标及所述投影点的点投影坐标,确定所述端点到所述投影点的坐标向量;
确定所述坐标向量与所述移动向量的向量夹角值;
如果所述向量夹角值的绝对值小于或等于设定夹角阈值,则将所述投影点确定为所述端点待吸附的第一候选投影点;
将所述端点作为待吸附点以及各所述第一候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在一实施例中,所述第一点确定子单元,是设置为:
基于所述移动向量及所述端点的端点坐标,确定所述画布中的有效区域;
从所述投影点信息集合中筛选处于所述有效区域的有效投影点,形成有效投影点集合;
针对所述有效投影点集合中的每个有效投影点,基于所述端点坐标及所述有效投影点的点投影坐标,确定所述端点到所述有效投影点的有效坐标向量;
确定所述有效坐标向量与所述移动向量的有效向量夹角值;
如果所述有效向量夹角值的绝对值小于或等于设定夹角阈值,则将所述有效投影点确定为所述端点待吸附的第一候选投影点;
将所述端点作为待吸附点以及各所述第一候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在一实施例中,所述基于所述移动向量及所述端点的端点坐标,确定所述画布中的有效区域,包括:
通过与所述移动向量垂直且过所述端点的临界直线,将所述画布划分成两个平面区域,并将包含所述移动向量的平面区域确定为第一区域;
将所述画布中以所述端点为圆心,以设定距离阈值为半径形成的圆形区域确定为第二区域;
将所述第一区域与所述第二区域的相交区域确定为有效区域;或者,将所述第一区域确定为有效区域;或者,将第二区域确定为有效区域。
在上述实施例的基础上,所述第二点确定子单元,是设置为:
基于选定点的选定点坐标及所述移动向量,构建以所述选定点为起始端点、方向与所述移动向量平行的射线,并获得所述射线的射线标示;
针对所述第一投影边信息集合中的每个第一投影边,根据所述第一投影边的线投影标示及所述射线标示,确定所述第一投影边是否与所述射线存在第一交点;
若存在,则确定所述第一交点与所述选定点的坐标点距离,并当所述坐标点距离小于设定距离阈值时,确定所述第一投影边为所述选定点的待吸附投影边,所述第一交点为所述选定点的第二候选投影点;
将所述选定点作为待吸附点以及各所述第二候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合。
在上述实施例的基础上,所述从所述候选吸附点集合中确定所述选定线段的目标吸附点,包括:
针对所述候选吸附点集合中每个候选吸附点,确定所述候选吸附点到相应待吸附点的点吸附距离和吸附向量;
根据各所述点吸附距离及吸附向量,结合所述移动向量确定所述候选吸附点的判定距离;
比对各候选吸附点的判定距离,将最小判定距离对应的候选吸附点确定为目标吸附点。
在上述实施例的基础上,所述候选线确定单元,包括:
区域确定子单元,设置为根据所述移动向量及所述线标示信息,构建用于吸附筛选的平 行四边形区域;
信息筛选子单元,设置为根据各所述可视线点投影信息中的线投影标示,形成第二投影边信息集合;
线确定子单元,设置为根据所述平行四边形区域,从所述第二投影边信息集合中筛选所述选定线段的候选吸附线;
集合确定子单元,设置为获得包含所述选定线段各所述候选吸附线的候选吸附线集合。
在上述实施例的基础上,所述区域确定子单元,是设置为:
根据所述线标示信息中选定线段两端点的端点坐标,确定所述选定线段的线段长度;
确定所述选定线段与所述移动向量构成的夹角值;
构建以所述线段长度为第一边长,设定的吸附距离阈值为第二边长以及边夹角为所述夹角值或为所述夹角值余角的平行四边形区域。
在上述实施例的基础上,所述线确定子单元,是设置为:
针对所述第二投影边信息集合中的每个第二投影边,根据所述第二投影边的线投影标示及所述线标示信息,确定所述第二投影边是否与所述选定线段平行;
若平行,则确定所述第二投影边是否满足基于所述平行四边形区域设定的吸附筛选条件;
若满足,则将所述第二投影边确定为所述选定线段的候选吸附线。
在上述实施例的基础上,所述吸附筛选条件包括下述至少一项:
第二投影边延长线与作为第二边的第一阈值距离边存在第二交点,且所述第二交点位于所述第二投影边上;
第二投影边延长线与作为第二边的第二阈值距离边存在第三交点,且所述第三交点位于所述第二投影边上;
第二投影边延长线与作为第二边的第一阈值距离边和第二阈值距离边分别存在第四交点和第五交点,且所述第二投影边处于第四交点和第五交点的连线上。
在上述实施例的基础上,所述从所述候选吸附线集合中确定所述选定线段的目标吸附线,包括:
针对所述候选吸附线集合中的每条候选吸附线,确定所述候选吸附线到所述选定线段的线吸附距离;
比对各候选目标线的线吸附距离,将最小吸附距离对应的候选目标线确定为目标吸附线。
在上述实施例的基础上,当所述目标立体元素通过确定目标吸附点获得时,所述吸附控制模块,是设置为:
确定所述目标吸附点对应的所述选定线段上的待吸附点;
确定所述目标吸附点与相应待吸附点的目标点吸附距离和目标吸附向量;
控制所述选定线段沿所述目标吸附向量进行所述目标点吸附距离的偏移,以使所述选定线段上的待吸附点与所述目标立体元素上的目标吸附点相吸附。
在上述实施例的基础上,当所述目标立体元素通过确定目标吸附线获得时,所述吸附控 制模块,是设置为:
确定所述目标吸附线到选定线段的目标线吸附距离;
将所述选定线段的移动向量确定所述选定线段的吸附移动方向;
控制所述选定线段沿所述吸附移动方向进行所述目标线吸附距离的偏移,以使所述选定线段与所述目标立体元素上的目标吸附线相吸附。
在上述实施例的基础上,当所述目标立体元素通过确定目标吸附点获得时,所述组合显示模块,是设置为:
根据所述目标吸附点的空间坐标信息,确定所述选定线段的第一线点空间信息;
将所述第一线点空间信息与所述目标立体元素的线点空间信息相结合,构成包含所述选定线段和目标立体元素的第一组合立体元素;
将所述第一组合立体元素投影显示在所述画布中。
在上述实施例的基础上,当所述目标立体元素通过确定目标吸附线获得时,所述组合显示模块,是设置为:
根据所述目标吸附线的线点空间信息,确定所述选定线段的第二线点空间信息;
将所述第二线点空间信息与所述目标立体元素的线点空间信息相结合,构成包含所述选定线段和目标立体元素的第二组合立体元素;
将所述第二组合立体元素投影显示在所述画布中。
在一实施例中,该装置还包括:第一接收模块,设置为在显示吸附后形成的组合立体元素之后,接收第一状态调整操作,所述第一状态调整操作作用在所述组合立体元素的目标立体元素上;
第一显示模块,设置为控制调整所述组合立体元素,并显示状态调整后的组合立体元素。
在一实施例中,该装置还包括:
第二接收模块,设置为在显示吸附后形成的组合立体元素之后,接收第二状态调整操作,所述第二状态调整操作作用在所述组合立体元素的选定线段上;
第二显示模块,设置为控制调整所述选定线段,分别显示所述组合立体元素中的选定线段和目标立体元素的当前状态。
本实施例提供的装置可以用于执行上述任意实施例提供的方法,具备相应的功能和效果。
实施例四
图17为本申请实施例四提供的一种线段吸附设备的结构示意图。该线段吸附设备包括:处理器40、存储器41、显示屏42、输入装置43以及输出装置44。该线段吸附设备中处理器40的数量可以是一个或者多个,图17中以一个处理器40为例。该线段吸附设备中存储器41的数量可以是一个或者多个,图17中以一个存储器41为例。该线段吸附设备的处理器40、存储器41、显示屏42、输入装置43以及输出装置44可以通过总线或者其他方式连接,图17中以通过总线连接为例。实施例中,线段吸附设备可以是电脑,手机,平板或交互智能平板等。
存储器41作为一种计算机可读存储介质,可设置为存储软件程序、计算机可执行程序以及模块,如本申请任意实施例所述的线段吸附设备对应的程序指令/模块(例如,线段吸附装置中的第一确定模块31、第一响应模块32、第二响应模块33、第二确定模块34、吸附控制模块35以及组合显示模块36)。存储器41可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据设备的使用所创建的数据等。此外,存储器41可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器41可包括相对于处理器40远程设置的存储器,这些远程存储器可以通过网络连接至设备。上述网络的实例包括互联网、企业内部网、局域网、移动通信网及其组合。
显示屏42可以为具有触摸功能的显示屏42,其可以是电容屏、电磁屏或者红外屏。一般而言,显示屏42设置为根据处理器40的指示显示数据,例如显示投影在画布中的立体元素、平面元素以及除元素外的其他元素等,还设置为接收作用于显示屏42的触摸操作,并将相应的信号发送至处理器40或其他装置。
输入装置43可设置为接收输入的数字或者字符信息,以及产生与展示设备的用户设置以及功能控制有关的键信号输入,还可以设置为获取图像的摄像头以及获取音频数据的拾音设备。输出装置44可以包括扬声器等音频设备。在一实施例中,输入装置43和输出装置44的组成可以根据实际情况设定。
处理器40通过运行存储在存储器41中的软件程序、指令以及模块,从而执行设备的各种功能应用以及数据处理,即实现上述的线段吸附方法。
上述提供的线段吸附设备可用于执行上述任意实施例提供的方法,具备相应的功能和效果。
实施例五
本申请实施例五还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行一种线段吸附方法,包括:
确定显示于画布中各立体元素的线点投影信息;响应于接收到作用在所述画布中任一线段元素的选定操作,获得选定线段的线点信息;响应于接收到作用于所述选定线段上的移动操作,确定所述待吸附线段对应的移动向量;按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素;控制所述选定线段吸附至所述目标立体元素;显示吸附后形成的组合立体元素。
本申请实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述方法的操作,还可以执行本申请任意实施例所提供的方法中的相关操作,且具备相应的功能和效果。
通过以上关于实施方式的描述,本申请可借助软件及必需的通用硬件来实现,也可以通过硬件实现。本申请的技术方案可以以软件产品的形式体现出来,该计算机软件产品可以存 储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是机器人,个人计算机,服务器,或者网络设备等)执行本申请任意实施例所述的方法。
在一实施例中,上述线段吸附装置中,所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的名称也只是为了便于相互区分,并不用于限制本申请的保护范围。
在一实施例中,本申请的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(Programmable Gate Array,PGA),现场可编程门阵列(Field Programmable Gate Array,FPGA)等。
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“示例”、或“一些示例”等的描述意指结合该实施例或示例描述的特征、结构、材料或者特点包含于本申请的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。

Claims (10)

  1. 一种线段吸附方法,包括:
    确定显示于画布中各立体元素的线点投影信息;
    响应于接收到作用在所述画布中任一线段元素的选定操作,获得选定线段的线点信息;
    响应于接收到作用于所述选定线段上的移动操作,确定所述待吸附线段对应的移动向量;
    按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素;
    控制所述选定线段吸附至所述目标立体元素;
    显示吸附后形成的组合立体元素。
  2. 根据权利要求1所述的方法,其中,所述按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素,包括:
    提取所述线点信息中的点坐标信息和线标示信息,并基于各所述立体元素的线点投影信息,获得各所述立体元素的可视线点投影信息;
    根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合;
    根据所述移动向量、所述线标示信息及各所述可视线点投影信息中的线投影标示,确定所述选定线段对应的候选吸附线集合;
    如果所述候选吸附线集合为非空,则从所述候选吸附线集合中确定所述选定线段的目标吸附线,将包含所述目标吸附线的立体元素作为目标立体元素;否则,
    从所述候选吸附点集合中确定所述选定线段的目标吸附点,并将包含所述目标吸附点的立体元素作为目标立体元素。
  3. 根据权利要求2所述的方法,其中,所述根据所述移动向量、所述点坐标信息及各所述可视线点投影信息,确定所述选定线段对应的候选吸附点集合,包括:
    获取所述点坐标信息中选定线段两端点的端点坐标及线段上选定点的选定点坐标;
    提取各所述可视线点投影信息中的点投影坐标和线投影标示,分别获得投影点信息集合和第一投影边信息集合;
    针对所述选定线段的每个端点,根据所述移动向量、所述端点的端点坐标及所述投影点信息集合,确定所述端点待吸附的第一候选投影点,并将所述端点作为待吸附点以及各所述第一候选投影点分别作为候选吸附点,关联添加至所述候选吸附点集合;
    根据所述移动向量、选定点坐标及所述第一投影边信息集合,确定所述选定点在待吸附投影边上对应的第二候选投影点,并将所述选定点作为待吸附点以及各所述第二候选投影点 分别作为候选吸附点,关联添加至所述候选吸附点集合。
  4. 根据权利要求3所述的方法,其中,所述根据所述移动向量、所述端点的端点坐标及所述投影点信息集合,确定所述端点待吸附的第一候选投影点,包括:
    针对所述投影点信息集合中的每个投影点,基于所述端点坐标及所述投影点的点投影坐标,确定所述端点到所述投影点的坐标向量;
    确定所述坐标向量与所述移动向量的向量夹角值;
    如果所述向量夹角值的绝对值小于或等于设定夹角阈值,则将所述投影点确定为所述端点待吸附的第一候选投影点。
  5. 根据权利要求3所述的方法,其中,所述根据所述移动向量、所述端点的端点坐标及所述投影点信息集合,确定所述端点待吸附的第一候选投影点,包括:
    基于所述移动向量及所述端点的端点坐标,确定所述画布中的有效区域;
    从所述投影点信息集合中筛选处于所述有效区域的有效投影点,形成有效投影点集合;
    针对所述有效投影点集合中的每个有效投影点,基于所述端点坐标及所述有效投影点的点投影坐标,确定所述端点到所述有效投影点的有效坐标向量;
    确定所述有效坐标向量与所述移动向量的有效向量夹角值;
    如果所述有效向量夹角值的绝对值小于或等于设定夹角阈值,则将所述有效投影点确定为所述端点待吸附的第一候选投影点。
  6. 根据权利要求1-5任一项所述的方法,在显示吸附后形成的组合立体元素之后,还包括:
    接收第一状态调整操作,所述第一状态调整操作作用在所述组合立体元素的目标立体元素上;
    控制调整所述组合立体元素,并显示状态调整后的组合立体元素。
  7. 根据权利要求1-5任一项所述的方法,在显示吸附后形成的组合立体元素之后,还包括:
    接收第二状态调整操作,所述第二状态调整操作作用在所述组合立体元素的选定线段上;
    控制调整所述选定线段,分别显示所述组合立体元素中的选定线段和目标立体元素的当前状态。
  8. 一种线段吸附装置,包括:
    第一确定模块,设置为确定显示于画布中各立体元素的线点投影信息;
    第一响应模块,设置为响应于接收到作用在所述画布中任一线段元素的选定操作,获得 选定线段的线点信息;
    第二响应模块,设置为响应于接收到作用于所述选定线段上的移动操作,确定所述待吸附线段对应的移动向量;
    第二确定模块,设置为按照所述线点信息、移动向量、各所述立体元素的线点投影信息,确定所述选定线段待吸附的目标立体元素;
    吸附控制模块,设置为控制所述选定线段吸附至所述目标立体元素;
    组合显示模块,设置为显示吸附后形成的组合立体元素。
  9. 一种线段吸附设备,包括:
    存储器以及一个或多个处理器;
    所述存储器,设置为存储一个或多个程序;
    所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一项所述的方法。
  10. 一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如权利要求1-7中任一项所述的方法。
PCT/CN2019/120855 2019-04-04 2019-11-26 线段吸附方法、装置、设备及存储介质 WO2020199616A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910272405.3 2019-04-04
CN201910272405.3A CN109979020B (zh) 2019-04-04 2019-04-04 一种线段吸附方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020199616A1 true WO2020199616A1 (zh) 2020-10-08

Family

ID=67083065

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/120855 WO2020199616A1 (zh) 2019-04-04 2019-11-26 线段吸附方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN109979020B (zh)
WO (1) WO2020199616A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109979020B (zh) * 2019-04-04 2020-12-22 广州视源电子科技股份有限公司 一种线段吸附方法、装置、设备及存储介质
CN111104036B (zh) * 2019-11-21 2022-04-05 广州视源电子科技股份有限公司 元素控制方法、装置、设备及存储介质
CN112764654B (zh) * 2021-01-29 2022-10-25 北京达佳互联信息技术有限公司 组件的吸附操作方法、装置、终端及存储介质
CN113031899B (zh) * 2021-05-28 2021-08-27 卡莱特云科技股份有限公司 一种显示区域的处理方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103400387A (zh) * 2013-08-06 2013-11-20 上海合合信息科技发展有限公司 在图像中线段吸附的方法及装置,构造多边形的方法及装置
US20160203381A1 (en) * 2013-08-16 2016-07-14 Intsig Information Co., Ltd. Method and apparatus for adsorbing straight line/line segment, method and apparatus for constructing polygon
CN107798715A (zh) * 2017-10-19 2018-03-13 广州视睿电子科技有限公司 立体图形的对齐吸附方法、装置、计算机设备及存储介质
CN109191547A (zh) * 2018-08-20 2019-01-11 广州视源电子科技股份有限公司 元素吸附方法、装置、设备和存储介质
CN109979020A (zh) * 2019-04-04 2019-07-05 广州视源电子科技股份有限公司 一种线段吸附方法、装置、设备及存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017004305A (ja) * 2015-06-11 2017-01-05 株式会社日立製作所 解析モデル作成支援システム、解析モデル作成支援装置及び解析モデル作成支援プログラム
CN105787926B (zh) * 2016-02-04 2018-07-27 上海爱福窝云技术有限公司 一种图形自动对齐的方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103400387A (zh) * 2013-08-06 2013-11-20 上海合合信息科技发展有限公司 在图像中线段吸附的方法及装置,构造多边形的方法及装置
US20160203381A1 (en) * 2013-08-16 2016-07-14 Intsig Information Co., Ltd. Method and apparatus for adsorbing straight line/line segment, method and apparatus for constructing polygon
CN107798715A (zh) * 2017-10-19 2018-03-13 广州视睿电子科技有限公司 立体图形的对齐吸附方法、装置、计算机设备及存储介质
CN109191547A (zh) * 2018-08-20 2019-01-11 广州视源电子科技股份有限公司 元素吸附方法、装置、设备和存储介质
CN109979020A (zh) * 2019-04-04 2019-07-05 广州视源电子科技股份有限公司 一种线段吸附方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN109979020B (zh) 2020-12-22
CN109979020A (zh) 2019-07-05

Similar Documents

Publication Publication Date Title
WO2020199616A1 (zh) 线段吸附方法、装置、设备及存储介质
US10812780B2 (en) Image processing method and device
CN107798715B (zh) 立体图形的对齐吸附方法、装置、计算机设备及存储介质
US9436369B2 (en) Touch interface for precise rotation of an object
EP2701152B1 (en) Media object browsing in a collaborative window, mobile client editing, augmented reality rendering.
US10701334B2 (en) Virtual reality parallax correction
CN111080799A (zh) 基于三维建模的场景漫游方法、系统、装置和存储介质
CN110069204B (zh) 基于书写轨迹的图形处理方法、装置、设备及存储介质
CN108874292B (zh) 批注显示方法、装置以及智能交互平板
US20190212901A1 (en) Manipulation of content on display surfaces via augmented reality
KR20140122054A (ko) 2차원 이미지를 3차원 이미지로 변환하는 3차원 이미지 변환 장치 및 그 제어 방법
CN109906600B (zh) 模拟景深
CN109191547B (zh) 元素吸附方法、装置、设备和存储介质
WO2020192175A1 (zh) 一种立体图形的标注方法、装置、设备及介质
CN107590337A (zh) 一种家装展示互动方法和装置
CN109743566A (zh) 一种用于识别vr视频格式的方法与设备
CN102445998A (zh) 遥控光点投影位置的获取方法及交互式投影系统
CN109146775B (zh) 二维图片转换方法、装置、设备及存储介质
JP2016100016A (ja) 画像分割
CN114511684A (zh) 场景切换方法、装置、电子设备及存储介质
CN105046740A (zh) 基于OpenGL ES的3D图形处理方法及装置
WO2023056879A1 (zh) 一种模型处理方法、装置、设备及介质
WO2022179544A1 (zh) 书写笔迹绘制方法、装置、介质以及交互平板
CN113344957B (zh) 图像处理方法、图像处理装置和非瞬时性存储介质
CN109472873B (zh) 三维模型的生成方法、装置、硬件装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19922474

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19922474

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 23.02.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19922474

Country of ref document: EP

Kind code of ref document: A1