Method, apparatus, device and storage medium for drawing a primitive
By adjusting the size of the graphic elements and the number of sub-graphic elements, and recombining the sub-graphic elements based on reference points, the problem of inaccurate graphic element adjustment in the prior art is solved, and the production efficiency and accuracy of the plan layout drawing are improved.
Patent Information
- Application Number
- CN202210855014.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-19
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-07-19
AI Technical Summary
When drawing a floor plan, the existing technology directly stretches and adjusts the graphic elements by drawing images, which leads to errors between the size and proportion and the measurement data, and makes it impossible to flexibly adjust the size and shape of the graphic elements.
By responding to input to adjust the size of the primitives, determining the changed size and number of sub-primitives, identifying a new combination of sub-primitives based on a reference point, and presenting replacement primitives to accurately adjust the size and shape of the primitives.
It enables flexible adjustment of graphic elements, improves the efficiency and accuracy of spatial layout diagram production, and enhances the presentation effect.
Smart Images

Figure CN115131463B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to a method, apparatus, device and computer readable storage medium for rendering a graphic primitive. BACKGROUND
[0002] In the scenario of rendering a floor plan, in order to reflect the spatial structure and area, the position orientation, use function and other information of each sub-space, it is usually necessary to use corresponding graphic primitives to represent various elements in the space according to the measurement data of the space. At present, floor plans can be made with the help of computers. However, when rendering some elements in the floor plan, a method of directly stretching the picture of the element is still used to adjust the graphic primitive. This will inevitably cause errors between the size and scale in the floor plan and the measurement data. SUMMARY
[0003] In a first aspect of the present disclosure, a method for rendering a graphic primitive is provided. The method comprises: in response to detecting an input of changing a first size of a first graphic primitive in a floor plan of a target space, determining a changed second size, the first graphic primitive representing a target element in the target space and the first graphic primitive comprising a first number of sub-graphic primitives; determining a second number of the sub-graphic primitives based on the second size; determining a second set of reference points for at least part of the second number of the sub-graphic primitives based on a first set of reference points for the first number of the sub-graphic primitives and the second number; and presenting a second graphic primitive representing the target element in the floor plan to replace the first graphic primitive based on the second set of reference points, the second graphic primitive comprising the second number of the sub-graphic primitives.
[0004] In a second aspect of the present disclosure, an apparatus for rendering a graphic primitive is provided. The apparatus comprises: a size determining module configured to, in response to detecting an input of changing a first size of a first graphic primitive in a floor plan of a target space, determine a changed second size, the first graphic primitive representing a target element in the target space and the first graphic primitive comprising a first number of sub-graphic primitives; a sub-graphic primitive determining module configured to determine a second number of the sub-graphic primitives based on the second size; a reference point determining module configured to determine a second set of reference points for at least part of the second number of the sub-graphic primitives based on a first set of reference points for the first number of the sub-graphic primitives and the second number; and a presenting module configured to present a second graphic primitive representing the target element in the floor plan to replace the first graphic primitive based on the second set of reference points, the second graphic primitive comprising the second number of the sub-graphic primitives.
[0005] In a third aspect of the disclosure, an electronic device is provided. The electronic device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. The instructions, when executed by the at least one processing unit, cause the electronic device to perform the method of the first aspect.
[0006] In a fourth aspect of the disclosure, a computer-readable storage medium is provided. The computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method of the first aspect.
[0007] It is to be understood that the description in this summary section is not intended to define key or essential features of embodiments of the disclosure, nor is it intended to limit the scope of the disclosure. Other aspects of the disclosure will be appreciated through the description that follows. BRIEF DESCRIPTION OF DRAWINGS
[0008] The above and other features, aspects, and advantages of embodiments of the present disclosure will become more apparent from the following detailed description taken in conjunction with the accompanying drawings. In the drawings similar elements are denoted by similar reference numerals, wherein:
[0009] Figure 1 A schematic diagram illustrating an example environment in which embodiments of the present disclosure can be implemented is shown;
[0010] Figure 2 An interaction diagram illustrating a process for generating a three-dimensional model is shown in accordance with some embodiments of the present disclosure;
[0011] Figures 3A-3D A schematic diagram illustrating a user interface rendering an example primitive is shown in accordance with some embodiments of the present disclosure;
[0012] Figures 4A-4D A schematic diagram illustrating a user interface rendering another example primitive is shown in accordance with some embodiments of the present disclosure;
[0013] Figure 5 A block diagram illustrating an apparatus for rendering a primitive is shown in accordance with some embodiments of the present disclosure; and
[0014] Figure 6 A block diagram of an apparatus that can implement various embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0015] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be implemented in various forms and should not be interpreted as being limited to the embodiments set forth herein, but rather, these embodiments are provided so as to more completely and thoroughly understand the present disclosure. It is understood that the drawings and embodiments of the present disclosure are for exemplary purposes only and are not intended to limit the scope of protection of the present disclosure.
[0016] In the description of embodiments of the present disclosure, the term "comprising" and similar terms are understood to encompass open-ended inclusion, i.e., "comprising but not limited to". The term "based on" is understood to mean "based at least in part on". The term "one embodiment" or "the embodiment" is understood to mean "at least one embodiment". The term "some embodiments" is understood to mean "at least some embodiments". Other explicit and implicit definitions can also be included below.
[0017] It can be understood that the data involved in the technical solutions of the present disclosure (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of relevant laws and regulations and relevant provisions.
[0018] In the description of embodiments of the present disclosure, the use of the terms "first", "second", etc. is only for the purpose of distinguishing between different elements, objects, targets, units, and does not imply the order or difference in time, space, priority between these elements, objects, targets, units.
[0019] It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the type, scope of use, use scenario, etc. of the personal information involved in the present disclosure should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.
[0020] For example, in response to receiving the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require the acquisition and use of the personal information of the user. Thus, the user can voluntarily choose whether to provide personal information to the software or hardware such as electronic devices, application programs, servers or storage media that perform the operation of the technical solutions of the present disclosure according to the prompt information.
[0021] As an optional but non-limiting implementation manner, in response to receiving the active request of the user, the manner of sending prompt information to the user may, for example, be a pop-up window manner, and the prompt information can be presented in the form of text in the pop-up window. In addition, the pop-up window can also carry selection controls for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0022] It can be understood that the above notification and user authorization obtaining process is only illustrative, and does not limit the implementation of the present disclosure, and other ways that meet relevant laws and regulations can also be applied to the implementation of the present disclosure.
[0023] One exemplary application scenario of the planar layout diagram is a house layout diagram, elements in the house layout diagram can include walls, doors, windows, stairs, and the like. The house layout diagram is used to reflect information such as house area, house layout, wall distribution, room orientation, functional partition, and house lighting. Generally, when drawing a house layout diagram, reference is needed to be made to images taken on site and data measured. However, when drawing some elements in the planar layout diagram, the corresponding primitives cannot be generated by computer, but a way of scaling the pictures proportionally is used to adjust the primitives.
[0024] For example, when drawing a straight staircase, only the way of scaling the picture proportionally can be used to adjust the size of the staircase. This way cannot dynamically adjust the number of steps and the width of the staircase according to the house condition. In addition, when stretching the picture, distortion of the picture can be caused. In addition to the house layout diagram, other scenarios of drawing a space layout diagram also face similar problems. Therefore, it is expected to improve the production process of the space layout diagram so as to be able to flexibly adjust various primitives in the space layout diagram.
[0025] Embodiments of the present disclosure propose a scheme for drawing primitives. The scheme can parameterize attribute parameters of space elements, so that the size and shape of the primitives in the space layout diagram can be accurately adjusted according to the parameters. In addition, the scheme also provides a user interface for drawing primitives and supports adjusting the primitives in a flexible interactive manner. In this way, the production efficiency of the space layout diagram can be improved, the accuracy of the space layout diagram is guaranteed, and the presentation effect is enhanced.
[0026] In the following, embodiments of the present disclosure will be described in combination with the scenario of the house layout diagram. However, it should be understood that the house layout diagram is only one of many application scenarios of the embodiments of the present disclosure, and the embodiments of the present disclosure are also applicable to other scenarios, such as engineering construction, urban planning, traffic management, and the like. Therefore, the scope of the embodiments of the present disclosure is not limited thereto.
[0027] In addition, in the following, embodiments will also be described with reference to example states of several user interfaces (UIs). It should be understood that these UIs and interactions are only illustrative, and various interface designs and interaction modes can actually exist. In addition, the controls included in these UIs can be implemented by any currently known or future developed UI elements and technologies. In addition, the types, forms, operation modes, layouts, arrangements, and the like of these controls in the UIs are illustrative, and are not intended to limit the scope of the present disclosure in any form.
[0028] Figure 1A schematic diagram illustrating an example environment 100 in which embodiments of the present disclosure can be implemented is shown. In the example environment 100, a terminal device 110 can be used to make a floor plan for a target space. In some embodiments, the target space can be a house, a building, etc. Accordingly, the floor plan can be a house plan, a building plan, etc. Of course, in other embodiments, the target space can be any other suitable physical or virtual space. Thus, embodiments of the present disclosure are not limited in this respect.
[0029] In some embodiments, the real scene pictures, modeling images used to make the floor plan can be taken or generated by the user through the terminal device 110. In other embodiments, these real scene pictures or modeling images can come from any other data source. Further, in some embodiments, the measurement data for the target space can be uploaded by the user 102 or can be acquired from any other data source.
[0030] In some embodiments, the terminal device 110 can be installed with an application 120 for making the floor plan. In some embodiments, the application 120 can present a user interface to the user 102 for the user to make the floor plan, which will be described in more detail below in connection with Figure 2 、 Figures 3A-3D and Figures 4A-4D .
[0031] The terminal device 110 can be any type of mobile terminal, fixed terminal, or portable terminal including a mobile handset, a tablet computer, a notebook computer, a laptop computer, a netbook computer, a smartbook, a tablet computer, a media computer, a multimedia tablet, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an electronic book device, a game device, or any combinations of the aforementioned and the like, including accessories and peripherals for these devices, or any combinations thereof. In some embodiments, the terminal devices 110 and 120 can also be capable of supporting any type of interface to the user (such as "wearable" circuitry, etc.).
[0032] The terminal device 110 can communicate with a remote device (not shown) to enable storage, updating, and access of the floor plan data for the target space. For example, the remote device can be used to extend the storage and processing capabilities of the terminal device 110. In some embodiments, the remote device can be various types of computing systems / servers capable of providing computing capabilities, including but not limited to mainframes, edge computing nodes, electronic devices in a cloud environment, etc.
[0033] In this document, the pictures, measurement data, and floor plan of the target space can have any data format. Embodiments of the present disclosure are not limited in this regard. It should also be understood that the structure and function of the environment 100 are described only for illustrative purposes and do not imply any limitation on the scope of the present disclosure.
[0034] Reference will be made to the environment 100 of Figure 2 which shows a flowchart of a process 200 for drawing a graphic primitive according to some embodiments of the present disclosure. The process 200 can be implemented at the terminal device 110. Of course, the process 200 can also be implemented at any appropriate device. For ease of discussion, the process 200 will be described with reference to the environment 100 of Figure 1 .
[0035] In the example of Figure 2 , the user 102 makes a floor plan for a target space through the terminal device 110. As mentioned before, the target space can be a real space or a virtual space, and has elements therein capable of reflecting the structural layout, area, location of each sub-space, orientation, area, usage function, etc. of the space, including but not limited to stairs, doors, windows, walls, etc. These elements can be represented by corresponding graphic primitives in the floor plan, and the scale of the graphic primitives in the floor plan is substantially the same as the scale of the elements in the target space.
[0036] In the process 200, the terminal device 110 adjusts the graphic primitives in the floor plan. As an example, the user 102 can adjust the size, angle, shape, etc. of various graphic primitives in the floor plan through the user interface of the application 120 presented in the terminal device 110.
[0037] Figures 3A-3D which shows a schematic diagram of a user interface for drawing a graphic primitive according to some embodiments of the present disclosure, wherein a straight ladder graphic primitive is presented, and the straight ladder graphic primitive has a first number of sub-primitives representing the rectangular steps of the straight ladder. As Figure 3A shown, the user interface 300 includes an element control 310, and the user 102 can activate a sub-control in the element control 310 representing a corresponding element through a gesture such as a click, a drag, etc. to add a graphic primitive to the floor plan. In Figure 3A the example, a first graphic primitive 320 is added to the floor plan by activating a sub-control representing a straight ladder.
[0038] The user interface 300 also includes a control 312 for manipulating the floor plan, and a corresponding operation on the floor plan can be triggered by activating a corresponding sub-control in the control 312. It should be understood that the sub-controls in the control 312 are merely exemplary. In practice, different sub-controls from the user interface 300 can be provided as needed, and the present disclosure does not elaborate on this aspect.
[0039] The user interface 300 further includes an information area 330 and an operation area 340 for the target element. The information area 330 presents the attributes and dimension parameters of the target element, and includes a type control 331 and dimension controls 333, 335, 337 and 338. The type of the currently drawn primitive can be changed by activating the type control 331. The length 332, width 334, angle 336, etc. dimension parameters of the primitive can be adjusted by activating the controls 333, 335, 337 and 338, respectively. In Figure 3A In the example shown, the controls 333, 335 and 337 are shown as slider controls, by which the user 102 changes the size of the corresponding dimension parameter by dragging the slider left or right. In addition, the control 338 provides several sub-controls for predetermined angles. The user 102 can set the first primitive 320 to a corresponding predetermined angle by activating one of the sub-controls of the control 338. The operation area 340 includes controls 341 to 343 for performing left-right mirroring, inside-outside mirroring, deleting the element, etc. operations on the first primitive.
[0040] It should be appreciated that the types and numbers of attributes, operations and controls presented for different target elements can be different. Therefore, the layout of the user interface 300 and the controls therein are merely illustrative, and are not intended to limit the scope of the present disclosure in any form.
[0041] At block 210, the terminal device 110 detects an input for changing a first dimension of the first primitive in the layout of the target space. In some embodiments, the input can be a touch gesture on the screen of the terminal device 110, including but not limited to a drag gesture, a pinch gesture, etc. Additionally or alternatively, in other embodiments, the input can be an input of a dimension parameter for the length control 332, the width control 334, the angle control 336 of the primitive.
[0042] In response to detecting the input for changing the first dimension of the first primitive 320 in the layout of the target space, at block 220, the terminal device 110 determines a second dimension changed from the first dimension. The first primitive 320 represents a target element in the target space, and the first primitive includes a first number of sub-primitives. In some embodiments, the target element is a straight ladder, and the sub-primitives represent rectangular steps of the straight ladder, and the first dimension includes at least one of the length, the width, the height of the straight ladder or the rectangular steps.
[0043] In Figures 3A-3D In the example shown, the length of the sub-primitives is 300 mm. In Figure 3B In the user interface 301 shown, the terminal device 110 detects a drag gesture of the user 102 on the control 335, and thus determines that the width of the first primitive 320 is changed from the first dimension “1000 mm” to the second dimension “2000 mm”. As shown in the user interface 302, the terminal device 110 displays the first primitive 320 with the changed width. Figure 3BAs shown, the terminal device 110 can further scale the first graphic element 320 to a second graphic element 322 having a second size with the drag gesture.
[0044] In some embodiments, the input of changing the first size only changes the size of the sub-graphic elements in the first graphic element without changing the first number of the sub-graphic elements. For example, in the example of FIG. 3, the first graphic element 320 and the second graphic element 322 have the same number of sub-graphic elements. In comparison with the first graphic element 320, the second graphic element 322 represents a wider straight ladder in the target space. Figure 3B
[0045] Additionally or alternatively, in some other embodiments, the input of changing the first size will cause a change of the first number of the sub-graphic elements. Depending on the size of the second size, it can happen that the last sub-graphic element does not have a full size. In this case, the last sub-graphic element needs to be drawn as a full size. In the example of FIG. 3, the first graphic element 320 and the second graphic element 322 have different numbers of sub-graphic elements. In comparison with the first graphic element 320, the second graphic element 322 represents a wider straight ladder in the target space. Figure 3C In the user interface 302 as shown, the terminal device 110 detects a drag gesture of the user 102 on the control 333, thereby determining that the length of the first graphic element 324 is changed from the first size "1200mm" to the second size "2600mm". In this case, the changed second size corresponds to more sub-graphic elements than the first number, but the length of the last sub-graphic element 325 is only 200mm, in comparison with the first size. In practice, such a sub-graphic element needs to be drawn as a full sub-graphic element with a length of 300mm.
[0046] At block 230, the terminal device 110 determines a second number of the sub-graphic elements based on the second size.
[0047] In some embodiments, in response to the second size corresponding to a non-integer number of sub-graphic elements, the terminal device 110 can determine a remainder based on the second size and the size of the sub-graphic elements. Then, the terminal device 110 can determine the second number based on the second size and the remainder. Specifically, assuming that the width of the straight ladder (e.g., corresponding to the width of the first graphic element) is denoted by W, the height (e.g., corresponding to the length of the first graphic element) is denoted by H, and the height of each step (e.g., corresponding to the length of each sub-graphic element) is m, the terminal device 110 can determine the remainder, denoted by R, based on the following equation (1):
[0048] R = H % m (1)
[0049] Then, the terminal device 110 can determine the number of full sub-graphic elements corresponding to the height of the straight ladder, denoted by N, based on the following equation (2):
[0050] N = (H - R) / m (2)
[0051] As mentioned before, since a remainder occurs, i.e. R≠0, the last step should be represented by a complete subgraph element, thus the second number of subgraph elements is determined as N+1.
[0052] In the example of FIG. 3A, m=300mm, H=2600mm, thus R=200, N=8, and the second number is determined as 9 accordingly. Figure 3C
[0053] At block 240, the terminal device 110 determines a second set of reference points for at least a portion of the second number of subgraph elements based on the first set of reference points for the first number of subgraph elements and the second number.
[0054] In some embodiments, the first set of reference points and the second set of reference points respectively comprise vertices of at least one subgraph element. For example, in a case where the target element is a straight ladder, the vertices of the subgraph element can be vertices of the rectangular steps. As another example, in a case where the target element is a spiral ladder, the vertices of the subgraph element can be vertices of the fan-shaped steps.
[0055] At block 250, the terminal device 110 presents the second graph element in the layout to replace the first graph element based on the second set of reference points.
[0056] In some embodiments, in response to the first number being less than the second number, the terminal device 110 can connect the second set of reference points based on the first predetermined order to present the second graph element. Figure 3D The second graph element 326 presented based on the input to the control 333 in FIG. 3B is shown. Compared to the subgraph elements 325 in FIG. 3A, in the user interface 303, the last subgraph element 327 of the second graph element 326 is presented as a complete subgraph element with a length of 300mm. Additionally or alternatively, as one example implementation, since the first number is less than the second number, the second set of reference points can be vertices of the subgraph elements of the second number that are more than the subgraph elements of the first number. Accordingly, the terminal device 110 can connect the second set of reference points based on the first predetermined order to draw the rectangular subgraph elements (e.g., draw the rectangles with a vector graphics renderer) on a basis of the first number of subgraph elements in a loop until the second number of rectangular subgraph elements are obtained. Figure 3C Figure 3C Additionally or alternatively, in other embodiments, in response to the first number being greater than the second number, the terminal device 110 can determine a third number as a difference between the first number and the second number. Then, the terminal device 110 can present the second graph element by removing the third number of subgraph elements from the first graph element.
[0057] Additionally or alternatively, in other embodiments, in response to the first number being greater than the second number, the terminal device 110 can determine a third number as a difference between the first number and the second number. Then, the terminal device 110 can present the second graph element by removing the third number of subgraph elements from the first graph element.
[0058] In some embodiments, the terminal device 110 may smoothly display the second graphic element upon input. Additionally or alternatively, in other embodiments, the terminal device 110 may display the second graphic element after a size change reaches a certain length.
[0059] In some embodiments, the target element is a spiral staircase, and the sub-element represents the fan-shaped steps of the spiral staircase. The first dimension includes at least one of the following: the length, width, height, and spiral angle of the spiral staircase or the fan-shaped steps. Figures 4A-4D A schematic diagram of a user interface for drawing primitives according to some embodiments of the present disclosure is shown, wherein a spiral staircase primitive is presented, and the spiral staircase primitive has a first number of sub-primitives, the sub-primitives representing the fan-shaped steps of the spiral staircase.
[0060] like Figure 4A As shown, the user interface 400 includes element controls 410 similar to those in user interfaces 300, 301, 302, and 303, controls 412 for manipulating the layout diagram, and controls 441 to 443 in the operation area 440. Therefore, they will not be described in detail here.
[0061] The user interface 400 also includes an information area 430 for the target element, which presents the target element's attributes, size, and deformation parameters, and includes type controls 431, size controls 433 and 435, and deformation controls 437 and 439. Activating type control 431 changes the type of the currently drawn primitive. Activating controls 433, 435, and 437 adjusts parameters such as the primitive's length 432, width 434, and angle range 436 accordingly. Figure 4A In the example, controls 433, 435, and 437 are shown as slider controls, which the user 102 can drag left or right to change the size or deformation parameters. Additionally, control 439 provides several sub-controls for predetermined angles. The user 102 can set the first element 420 to the corresponding predetermined angle by activating one of the sub-controls of control 439. Alternatively or additionally, the user 102 can input corresponding parameters in the length control 432, width control 434, angle range control 436, and angle control 438 to adjust the presented element.
[0062] It should be understood that the attributes, operations, and types and numbers of controls presented may differ for different target elements. Therefore, the layout of the user interface 400 and the controls therein are merely illustrative and are not intended to limit the scope of this disclosure in any way.
[0063] exist Figure 4B In the user interface 401 shown, user 102 drags control 433 to change the length of the first graphic element 420. Terminal device 110 detects the input of the changed length and determines that the changed length is "3200mm".Figure 4A and Figure 4B In the example shown in FIG. 4A, since the length parameter of the first primitive corresponds to the diameter of the spiral staircase, the width parameter of the first primitive also changes proportionally with the length parameter. As shown in the user interface 401, the first primitive 420 is scaled to a second primitive 422 with a larger diameter as the drag gesture is applied. In this case, the input that changes the length only changes the size of the sub-primitives representing the steps of the spiral staircase, but not the number of sub-primitives. Figure 4B
[0064] In the example shown in FIG. 4B, the user 102 drags the control 437 to change the angular range of the first primitive 420. In embodiments of the present disclosure, the angular range represents the amplitude of the spiral staircase. The terminal device 110 detects the input that changes the angular range and determines that the changed angular range is “80%”, which corresponds to 288 degrees. Thus, in the example shown in FIG. 4B, the input that changes the angular range will cause a change in the first number of sub-primitives representing the steps of the spiral staircase. Depending on the size of the angular range, it can happen that the last sub-primitive does not have a full size. In this case, the last sub-primitive needs to be drawn as a full size. Figure 4C Figure 4C In the example shown in FIG. 4B, the changed angular range corresponds to a larger number of sub-primitives than the original angular range. However, in the example shown in FIG. 4C, the angular range of the sub-primitives is 22.5 degrees, and in this case, the angular range of the last sub-primitive 424 is only 18 degrees. In practice, such a sub-primitive needs to be drawn as a full sub-primitive with a length of 22.5 degrees.
[0065] In the example shown in FIG. 4B, the changed angular range corresponds to a larger number of sub-primitives than the original angular range. However, in the example shown in FIG. 4C, the angular range of the sub-primitives is 22.5 degrees, and in this case, the angular range of the last sub-primitive 424 is only 18 degrees. In practice, such a sub-primitive needs to be drawn as a full sub-primitive with a length of 22.5 degrees. Figure 4C Figures 4A-4D In some embodiments, the terminal device 110 can determine the integer number of sub-primitives corresponding to the changed angular range, i.e., the second number of sub-primitives, based on the formulas (1) and (2). Then, the terminal device 110 can determine the second set of reference points of at least a portion of the second number of sub-primitives based on the first set of reference points of the first number of sub-primitives and the second number. As an example, the first and second sets of reference points can be represented by the coordinates of the four corner points of the sector sub-primitives representing the respective steps of the spiral staircase.
[0066] In some embodiments, the terminal device 110 can scale the first primitive 420 to a second primitive with a larger angular range as the user 102 applies the drag gesture to the control 437. Additionally, as an example implementation, in the user interface 403 shown in FIG. 4D, the terminal device 110 can present the last sub-primitive 424 as a full sub-primitive 426 upon detecting that the user 102 releases the drag gesture applied to the control 437.
[0067] In some embodiments, the terminal device 110 can scale the first primitive 420 to a second primitive with a larger angular range as the user 102 applies the drag gesture to the control 437. Additionally, as an example implementation, in the user interface 403 shown in FIG. 4D, the terminal device 110 can present the last sub-primitive 424 as a full sub-primitive 426 upon detecting that the user 102 releases the drag gesture applied to the control 437. Figure 4D In some embodiments, the terminal device 110 can scale the first primitive 420 to a second primitive with a larger angular range as the user 102 applies the drag gesture to the control 437. Additionally, as an example implementation, in the user interface 403 shown in FIG. 4D, the terminal device 110 can present the last sub-primitive 424 as a full sub-primitive 426 upon detecting that the user 102 releases the drag gesture applied to the control 437.
[0068] In some embodiments, the terminal device 110 can connect the second set of reference points based on a second predetermined order to cyclically draw the fan-shaped sub-graphics (e.g., draw the fan-shape based on the way of drawing straight lines and circular arcs based on the angle range of the fan-shaped sub-graphics) on the basis of the first number of sub-graphics until the second number of fan-shaped sub-graphics is obtained. Figure 4D In the example of FIG. 6, the terminal device 110 can connect the second set of reference points based on a second predetermined order to cyclically draw the fan-shaped sub-graphics (e.g., draw the fan-shape based on the way of drawing straight lines and circular arcs based on the angle range of the fan-shaped sub-graphics) on the basis of the first number of sub-graphics until the second number of fan-shaped sub-graphics is obtained.
[0069] In some embodiments, the terminal device 110 can smoothly display the second graphic with the input. Additionally or alternatively, in other embodiments, the terminal device 110 can display the second graphic after the size change reaches a certain angle.
[0070] According to some embodiments of the present disclosure, a scheme for drawing graphics is provided. The scheme can parameterize the properties and size of spatial elements, so that the size, angle and shape of the graphics in the layout diagram of the space can be flexibly adjusted by changing the parameters. The scheme also provides a user interface for drawing graphics and supports adjusting the graphics in a visual and interactive manner. Through the scheme, the production process of the layout diagram can be simplified and the labor cost can be saved. In addition, the scheme can also guarantee the accuracy of the layout diagram of the space and enhance the presentation effect of the layout diagram.
[0071] Figure 5 A schematic structural block diagram of an apparatus 500 for drawing graphics according to some embodiments of the present disclosure is shown. The apparatus 500 can be implemented as or included in the terminal device 110. The various modules / components in the apparatus 500 can be implemented by hardware, software, firmware or any combination thereof.
[0072] As shown, the apparatus 500 includes a size determination module 510 configured to, in response to detecting an input of changing a first size of a first graphic in a layout diagram of a target space, determine a changed second size, the first graphic representing a target element in the target space and the first graphic including a first number of sub-graphics; a sub-graphics determination module 520 configured to, based on the second size, determine a second number of sub-graphics; a reference point determination module 530 configured to, based on a first set of reference points for the first number of sub-graphics and the second number, determine a second set of reference points for at least part of the second number of sub-graphics; and a presentation module 540 configured to, based on the second set of reference points, present a second graphic representing the target element in the layout diagram to replace the first graphic, the second graphic including the second number of sub-graphics.
[0073] In some embodiments, the sub-graphics determination module 520 includes a remainder determination module configured to, in response to the second size corresponding to a non-integer number of sub-graphics, determine a remainder based on the second size and the size of the sub-graphics; and a number determination module configured to, based on the second size and the remainder, determine the second number.
[0074] In some embodiments, the first set of reference points and the second set of reference points respectively comprise vertices of at least one sub-mesh.
[0075] In some embodiments, the presenting module 540 comprises a reference point connecting module configured to, in response to the first number being less than the second number, connect the second set of reference points based on the predetermined order to present the second mesh.
[0076] In some embodiments, the presenting module 540 comprises a third number determining module configured to, in response to the first number being greater than the second number, determine a difference between the first number and the second number as a third number; and a sub-mesh removing module configured to present the second mesh by removing the third number of sub-meshes from the first mesh.
[0077] In some embodiments, the target element is a straight ladder, and the sub-mesh represents a rectangular step of the straight ladder, and the first dimension comprises at least one of a length, a width, or a height of the straight ladder or the rectangular step.
[0078] In some embodiments, the target element is a spiral ladder, and the sub-mesh represents a fan-shaped step of the spiral ladder, and the first dimension comprises at least one of a length, a width, a height, or a spiral angle of the spiral ladder or the fan-shaped step.
[0079] In some embodiments, the input is a drag gesture, and the presenting module 540 comprises a scaling module configured to scale the first mesh to the second mesh in proportion to the drag gesture.
[0080] Figure 6 A block diagram illustrating an electronic device 600 in which one or more embodiments of the disclosure can be implemented is shown. It should be understood that Figure 6 The electronic device 600 shown is merely exemplary and should not be construed as limiting the scope of the embodiments described herein. Figure 6 The electronic device 600 shown can be used to implement Figure 1 the terminal device 110.
[0081] As Figure 6 shown, the electronic device 600 is in the form of a general electronic device. Components of the electronic device 600 can include, but are not limited to, one or more processors or processing units 610, a memory 620, a storage device 630, one or more communication units 640, one or more input devices 650, and one or more output devices 660. The processing unit 610 can be a real or virtual processor and is capable of executing various processing in accordance with programs stored in the memory 620. In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of the electronic device 600.
[0082] Electronic device 600 typically includes a plurality of computer storage media. Such media can be removable and non-removable, and can be volatile and non-volatile. Storage 620 can be volatile (such as registers, cache, RAM), non-volatile (such as ROM, EEPROM, flash memory), or some combination of the two. Storage device 630 can be a removable or non-removable media, and can include machine readable media such as flash drives, magnetic disks, or any other media that can be used to store information and / or data (e.g., training data for training) and that can be accessed by electronic device 600.
[0083] Electronic device 600 can further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown, a disk drive can be provided for reading from or writing to a removable, non- volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive can be provided for reading from or writing to a removable, non-volatile optical disk (e.g., a CD-ROM). In such instances, each drive can be connected to the bus by one or more data media interfaces. The memory 620 can include a computer program product 625 having one or more program modules configured to carry out the various methods or actions of the various embodiments of the present disclosure. Figure 6
[0084] Communication unit 640 enables communications with other electronic devices over a communication medium. Additionally, the functionality of the components of electronic device 600 can be implemented in a single computing cluster or a plurality of computer machines that are capable of communicating with one another over a communication connection. As such, electronic device 600 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network nodes.
[0085] Input device 650 can be one or more input devices, such as a mouse, a keyboard, a trackball, etc. Output device 660 can be one or more output devices, such as a display, a speaker, a printer, etc. Electronic device 600 can also communicate with one or more external devices (not shown) such as a storage device, a display device, etc. through communication unit 640, as needed, one or more devices that enable a user to interact with electronic device 600, or any devices (e.g., a network card, a modem, etc.) that enable electronic device 600 to communicate with one or more other electronic devices. Such communication can be enabled by an input / output (I / O) interface (not shown).
[0086] According to an example implementation of the present disclosure, a computer readable storage medium is provided having computer executable instructions stored thereon, where the computer executable instructions are executed by a processor to implement the method described above. According to an example implementation of the present disclosure, a computer program product is also provided that is tangibly stored on a non-transitory computer readable medium and includes computer executable instructions, where the computer executable instructions are executed by a processor to implement the method described above.
[0087] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0088] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium. The instructions stored on the computer readable storage medium can be used to program a computer, a programmable data processing apparatus, and / or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0089] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0090] The computer program product of the present disclosure can have a signal including said computer program. This signal can be electronic, electromagnetic, optical, or any other suitable type of signal. Such a signal can be provided through a communication connection, such as electrical wiring, optical fiber, wireless interface, etc. Examples of computer program products include computer program implemented on a personal computer, server, or other networked device. A non-transitory computer readable medium, such as a floppy disk, CD-ROM, DVD-ROM, Blu-ray Disc, hard disk drive, or any other suitable non-transitory computer readable medium can store the computer program product.
[0091] Various implementations of the disclosure have been described in detail above. The foregoing description is exemplary and explanatory only, and is not intended to be exhaustive or to limit various implementations of the disclosure to the precise forms disclosed. Many modifications and variations are possible in light of the above teachings without departing from the scope and spirit of the disclosure. It is intended that the scope of the disclosure be limited only by the claims and the equivalents thereof. The use of the terms "including," "containing," "comprising," "having," "in involving," "portions," "elements," "components," "steps," "phases," "processes," "operations," "steps," "stages," "procedures," "methods," "mechanisms," "devices," "systems," "apparatuses," "units," "means," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "apparatuses," "units," "devices," "systems," "
Claims
1. A method for rendering a graphic element, comprising: in response to detecting an input of changing a first size of a first graphic element in a layout diagram of a target space, determining a changed second size, the first graphic element representing a target element in the target space, and the first graphic element comprising a first number of sub-graphic elements; based on the second size, determining a second number of the sub-graphic elements; based on a first set of reference points for the first number of sub-graphic elements and the second number, determining a second set of reference points for at least a portion of the second number of sub-graphic elements; and based on the second set of reference points, presenting a second graphic element representing the target element in the layout diagram to replace the first graphic element, the second graphic element comprising the second number of the sub-graphic elements, wherein the input is a drag gesture for a size control of the target element, and presenting the second graphic element comprises smoothly scaling the first graphic element to the second graphic element along the drag gesture. 2.The method of claim 1, wherein determining the second number comprises: in response to the second size corresponding to a non-integer number of the sub-graphic elements, determining a remainder based on the second size and a size of the sub-graphic element; based on the second size and the remainder, determining the second number. 3.The method of claim 1, wherein the first set of reference points and the second set of reference points respectively comprise vertices of at least one of the sub-graphic elements. 4.The method of claim 1, wherein presenting the second graphic element comprises: in response to the first number being less than the second number, connecting the second set of reference points based on a first predetermined order to present the second graphic element. 5.The method of claim 1, wherein presenting the second graphic element comprises: in response to the first number being greater than the second number, determining a difference between the first number and the second number as a third number; and presenting the second graphic element by removing the third number of the sub-graphic elements from the first graphic element. 6.The method of claim 1, wherein the target element is a straight ladder, and the sub-graphic elements represent rectangular steps of the straight ladder, the first size comprising at least one of a length, a width, a height of the straight ladder or the rectangular steps. 7.The method of claim 1, wherein the target element is a spiral ladder, and the sub-graphic elements represent fan-shaped steps of the spiral ladder, the first size comprising at least one of a length, a width, a height, a spiral angle of the spiral ladder or the fan-shaped steps. 8.An apparatus for rendering a graphic element, comprising: a size determining module configured to, in response to detecting an input of changing a first size of a first graphic element in a layout diagram of a target space, determine a changed second size, the first graphic element representing a target element in the target space, and the first graphic element comprising a first number of sub-graphic elements; a sub-graphic element determining module configured to, based on the second size, determine a second number of the sub-graphic elements; a reference point determination module configured to determine, based on a first set of reference points for the first number of sub-graphic elements and the second number, a second set of reference points for at least a portion of the second number of sub-graphic elements; and a presentation module configured to present, based on the second set of reference points, a second graphic element representing the target element in the layout to replace the first graphic element, the second graphic element comprising the second number of the sub-graphic elements, wherein the input is a drag gesture of a size control for the target element, and the presentation module is configured to present the second graphic element by smoothly scaling the first graphic element to the second graphic element along the drag gesture.
9. The apparatus of claim 8, wherein the sub-graphic element determination module comprises: a remainder determination module configured to determine, in response to the second size corresponding to a non-integer number of the sub-graphic elements, a remainder based on the second size and a size of the sub-graphic element; and a number determination module configured to determine, based on the second size and the remainder, the second number.
10. The apparatus of claim 8, wherein the first set of reference points and the second set of reference points each comprise at least one vertex of the sub-graphic element.
11. The apparatus of claim 8, wherein the presentation module comprises: a reference point connection module configured to connect, in response to the first number being less than the second number, the second set of reference points based on a predetermined order to present the second graphic element.
12. The apparatus of claim 8, wherein the presentation module comprises: a third number determination module configured to determine, in response to the first number being greater than the second number, a difference between the first number and the second number as a third number; and a sub-graphic element removal module configured to present the second graphic element by removing the third number of the sub-graphic elements from the first graphic element.
13. The apparatus of claim 8, wherein the target element is a straight ladder, and the sub-graphic element represents a rectangular step of the straight ladder, the first size comprising at least one of a length, a width, a height of the straight ladder or the rectangular step.
14. The apparatus of claim 8, wherein the target element is a spiral ladder, and the sub-graphic element represents a sector step of the spiral ladder, the first size comprising at least one of a length, a width, a height, a spiral angle of the spiral ladder or the sector step.
15. An electronic device, comprising: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions when executed by the at least one processing unit causing the electronic device to perform the method according to any one of claims 1-7.
16. A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method according to any one of claims 1-7.
Citation Information
Patent Citations
Scaling composite shapes for a graphical human-machine interface
CN101833289A