Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, an electronic device and a medium for calculating the discharge of a product with a relative texture.
In a first aspect, an embodiment of the present application provides a method for calculating a discharge of a relatively textured paving commodity, including:
S1, calculating according to design scheme data to generate a broken brick set;
S2, classifying broken bricks into transverse bricks, brick-on-end and corner bricks;
s3, integrating all the corner bricks into transverse bricks or brick-on-end;
S4, calculating a transverse brick discharging scheme and a brick-on-end discharging scheme, and combining the transverse brick discharging scheme and the brick-on-end discharging scheme to generate a relative texture paving commodity discharging scheme;
Wherein the broken bricks are incomplete paving commodities;
The length of the transverse brick is the same as the length of the whole paving commodity, and the width of the transverse brick is smaller than the width of the whole paving commodity;
Brick-on-end has the same width as the whole paving commodity and has a length smaller than that of the whole paving commodity;
The length and width of the corner bricks are smaller than the length and width of the complete paving commodity.
In a specific embodiment, the design solution includes to-be-paved surface data and to-be-paved commodity data, the to-be-paved surface data includes position data of geometric boundaries of the to-be-paved surface, the to-be-paved commodity data includes position information of all of the to-be-paved commodities paved on the to-be-paved surface in the design solution, and each of the to-be-paved commodity data includes a to-be-paved commodity ID, a to-be-paved commodity position data and a classification label.
In a specific embodiment, step S1 includes:
performing intersection operation on the contour of each paving commodity and the contour of the surface to be paved;
The intersection result is not equal to the outline of the paving commodity, and the vertex coordinates of the intersection result are updated to the position data of the paving commodity;
and updating the classification label of the paving commodity data into broken bricks.
In a specific embodiment, in step S2, the bounding box of each tile is first determined, and then the tiles are classified according to the size of the bounding box.
In a specific embodiment, step S2 includes:
Step S201, inputting all vertex coordinates;
step S202, obtaining the maximum value and the minimum value of the x coordinate in all vertex coordinates;
step S203, obtaining the maximum value and the minimum value of the y coordinates in all vertex coordinates;
Step S204, determining the lower left corner coordinate and the upper right corner coordinate of the bounding box according to the coordinate values obtained in the steps S202 and S203;
step S205, calculating the length and the width of the bounding box;
And S206, classifying the broken bricks according to the length and the width of the bounding box.
In a specific embodiment, a method of classifying crushed tiles includes:
If the length and the width of the broken brick bounding box are the same as those of the whole brick, classifying the broken brick into the whole brick;
if the length of the broken brick bounding box is the same as that of the whole brick and the width is different, classifying the broken brick into a transverse brick;
if the width of the broken brick bounding box is the same as the whole brick and the length is different, returning the broken brick to brick-on-end;
Otherwise, the broken bricks are classified as corner bricks.
In a specific embodiment, in step S3, an integration scheme for integrating all the corner bricks into the transverse bricks and an integration scheme for integrating all the corner bricks into brick-on-end are calculated and generated, and an integration scheme with the least material is selected to retain the transverse bricks or brick-on-end after the integration of all the corner bricks.
In a specific embodiment, a method of integrating corner tiles into a transverse tile includes:
Step S3101, ordering the corner bricks according to the length of the bounding box;
Step S3102, a transverse brick is generated, the length of the transverse brick is the length of the whole brick, and the height is not determined;
Step S3103, placing an angle brick into the right lower corner of the transverse brick, taking the right lower corner of the transverse brick as an origin of coordinates, and recording the coordinates of the placement of the angle brick, the length sum of all the angle bricks placed in the transverse brick and the maximum height of all the angle bricks;
step S3104, judging whether the sum of the lengths of all the corner bricks in the transverse brick exceeds the length of the whole brick:
if not exceeded and the current corner tile is not the last block, go to step S3103;
ending if the current corner brick is not exceeded and the current corner brick is the last brick;
if so, the height of the tile is set to the maximum height of the corner tiles it makes up, and then the process proceeds to step S3102.
In a specific embodiment, the method of integrating the corner tiles into brick-on-end comprises:
Step S3105, ordering the corner tiles according to the bounding box height.
Step S3106, generating a block brick-on-end, brick-on-end, the height of which is the height of the whole brick, and the height is not determined;
step S3107, a piece of corner brick is placed in the right lower corner of brick-on-end, the right lower corner of brick-on-end is taken as an origin of coordinates, and the placed coordinates, the height sum of all the corner bricks placed in brick-on-end and the maximum length of all the corner bricks are recorded;
Step S3108, determining brick-on-end whether the sum of the heights of all the corner bricks exceeds the height of the whole brick:
If not exceeded and the current corner tile is not the last block, go to step S3107;
ending if the current corner brick is not exceeded and the current corner brick is the last brick;
If so, the length of brick-on-end is set to the maximum value of the lengths of the corner bricks it constitutes, and then the process goes to step S3106.
In a specific embodiment, the method for calculating the flat brick discharging scheme in step S4 includes:
sorting the transverse bricks according to the height;
taking out one whole brick at a time to traverse the transverse brick, and loading the traversed transverse brick into the whole brick;
traversing once is performed to indicate that one whole brick is full, and then taking off one whole brick until all the whole bricks are arranged.
In a specific embodiment, the method of calculating brick-on-end a discharge regime in step S4 comprises:
Sorting brick-on-end by length;
taking out one whole brick at a time, traversing brick-on-end, and loading brick-on-end traversed if the whole brick can be loaded;
Once through brick-on-end, one brick is filled, and then one brick is removed until all brick-on-end rows are completed.
In a second aspect, an embodiment of the present application provides a relative texture-paving commodity discharge calculation apparatus, including:
The broken brick identification unit is used for calculating and generating a broken brick set according to the design scheme data;
the broken brick classification unit is used for classifying broken bricks into transverse bricks, brick-on-end and corner bricks;
the corner brick integrating unit is used for integrating all the corner bricks into transverse bricks or brick-on-end;
and the discharge calculation unit is used for calculating a transverse brick discharge scheme and a brick-on-end discharge scheme, and combining the transverse brick discharge scheme and the brick-on-end discharge scheme to generate a relative texture paving commodity discharge scheme.
In a third aspect, an embodiment of the present application provides an electronic device, including:
At least one processor, a memory communicatively coupled to the at least one processor, the memory storing instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the preceding first aspects.
In a fourth aspect, embodiments of the present application provide a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of the preceding first aspects.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, cause the computer to perform the method according to any of the preceding first aspects.
Compared with the prior art, the application has the following beneficial effects:
According to the discharging calculation method provided by the embodiment of the application, the two-dimensional discharging algorithm is optimized into a one-dimensional problem, the discharging result can be returned in real time, the discharging result accords with the relative texture characteristic of the commodity, and the discharging calculation method is suitable for various paving scenes. The application solves the problem of misalignment of information between home decoration design and specific construction, and opens the gap between design and construction. The designer can generate a decoration list adapting to the relative textures through one key of the design scheme, and output a more accurate structure within the time-consuming range acceptable by the user, so that the user can really see the structure.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Unless otherwise indicated, terms (including technical and scientific terms) used in this example have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. In addition, it will be understood that terms defined in commonly used dictionaries should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and will not be interpreted in an idealized or overly formal sense.
Before describing embodiments of the present invention in further detail, the terms and terminology involved in the embodiments of the present invention will be described, and the terms and terminology involved in the embodiments of the present invention will be used in the following explanation.
The following is a partial term definition:
paving commodities: a paving object, such as a ceramic tile, which is paved on a wall surface or a ground surface in a waiting area.
Discharging relative textures: and aiming at the paved commodity with the surface having a single-direction texture structure, outputting a list result of the most material saving by using a reasonable cutting and discharging algorithm. The method has the advantages that the least consumable material is used as much as possible, and the design material of a user is output more accurately.
Horizontal brick: incomplete shop pastes commodity belongs to one kind of broken brick, and the length of broken brick commodity is the same with the length of original commodity, and broken brick width is less than the width of original commodity. Representing the original commodity to be transversely (along the length direction) cut to obtain the broken brick.
Brick-on-end: incomplete shop pastes commodity belongs to one kind of broken brick, and the width of broken brick commodity is the same with the width of original commodity, and broken brick length is less than the length of original commodity. Representing the vertical (along the width direction) cutting of the original commodity to obtain the broken brick.
Corner brick: incomplete shop pastes commodity belongs to one of the broken brick, and the length and the width of broken brick are all less than the length and the width of original commodity. Indicating that the original commodity needs to be cut through a combination of transverse and vertical cuts to obtain the crushed bricks.
And (3) brick finishing: the length and width of the broken bricks of the whole paving commodity are the same as those of the original commodity. Meaning that the brick is the same shape as the original commodity without any cutting discharge.
Loading or putting in: a process of placing one flat model into the boundary contour of another flat model, such as placing a crushed brick model into the outer contour of a whole brick model or placing a corner brick model into a transverse brick, brick-on-end.
Fig. 1 is a schematic diagram of an alternative architecture of a discharge computing system 100 according to an embodiment of the present invention, referring to fig. 1, in order to support an exemplary application, a terminal (including a terminal 200-1 and a terminal 200-2) is connected to a server 400 through a network 300, where the network 300 may be a wide area network or a local area network, or a combination of both, and a wireless or wired link is used to implement data transmission.
A terminal (e.g., terminal 200-1) for receiving the discharge calculation instruction and sending an acquisition request of the discharge scheme to the server 400; here, in practical application, the server 400 may be one server supporting various services configured separately, or may be configured as a server cluster; the server 400 is configured to return at least one discharging scheme based on a discharging scheme acquisition request sent by the terminal;
The terminal (such as terminal 200-1) is further configured to receive an original data file of the design scheme, or receive a broken brick data file obtained by performing broken brick identification processing on the original data file, where the broken brick data includes data files of horizontal bricks, angular bricks and brick-on-end.
In some embodiments, a discharging calculation client is disposed on a terminal (such as the terminal 200-1), through which a user can perform discharging calculation on the relative texture paving commodity of the decoration design scheme, and illustratively, the user triggers a discharging calculation instruction through the discharging calculation client, and the discharging calculation client sends the decoration design scheme file to the server; the server receives the design scheme file and calculates to obtain a discharging scheme; the server returns a discharge scheme to the discharge calculation client.
In some embodiments, a discharging calculation client is provided on a terminal (such as the terminal 200-1), through which a user can perform discharging calculation on the relative texture paving commodity of the decoration design scheme, and illustratively, the user triggers a discharging calculation instruction through the discharging calculation client, and the discharging calculation client obtains the decoration design scheme file from the server; the user confirms the selected design scheme file from the server through the discharging calculation client; the server calculates to obtain a discharging scheme; the server returns a discharge scheme to the discharge calculation client.
In some embodiments, a discharging calculation client is provided on a terminal (such as the terminal 200-2), through which a user can perform discharging calculation on the relative texture paving commodity of the decoration design scheme, and illustratively, the user triggers a discharging calculation instruction through the discharging calculation client, and the discharging calculation client calculates and generates a broken brick data file according to the decoration design scheme; the discharging calculation client sends broken brick data files to the server; the server receives the broken brick data file and calculates to obtain a discharging scheme; the server returns a discharge scheme to the discharge calculation client.
An electronic device for implementing the method for calculating the discharge in the embodiment of the invention is described below. In some embodiments, the electronic device may be a terminal, and may also be a server. In the embodiment of the invention, the electronic equipment is taken as an example of the terminal, and the hardware structure of the terminal is described in detail. Terminals 200-1, 200-2, etc. may be various electronic devices having a display screen and supporting web browsing, including, but not limited to, smartphones, tablet computers, electronic book readers, portable computers, desktop computers, etc. It should be understood that the number of terminals, networks and servers in fig. 1 is merely illustrative. There may be any number of terminals, networks, and servers, as desired for implementation.
Next, an exemplary application and implementation of the terminal provided by the embodiment of the present invention are described. Fig. 2 is a schematic overall flow chart of a discharging calculation method for a relatively textured paving commodity according to an embodiment of the present invention, and fig. 3 is a simplified flow chart of a discharging calculation method according to the embodiment. In some embodiments, the method for calculating the discharge may be implemented by a terminal, or implemented by a server and the terminal cooperatively, for example, by the terminal 200-1 in fig. 1, and in conjunction with fig. 2 and 3, the method for calculating the discharge provided in the embodiment of the present invention includes:
and S1, calculating to generate a broken brick set.
The user uses in the design of the solution a product of laying (in this example, in particular a tile, or expressed as a brick), the information about which to lay down will be attached to the face of his design. And cutting the blocks by intersecting the area with the coordinates of the paving blocks, so as to obtain the blocks on all sides in the scheme. Specifically, the coordinates of the bricks are determined by the user when designing the design scheme, namely, a set of broken brick models is generated according to the contour of the paving area and the contour calculation of the brick models by using the coordinate system of the attaching surface.
The design scheme data comprises surface to be paved data and commodity to be paved data, the surface to be paved data comprises position data of geometric boundaries of the surface to be paved, the commodity to be paved data comprises position information of all commodity to be paved on the surface to be paved in the design scheme, and each commodity to be paved data comprises commodity to be paved ID, commodity to be paved position data (for example, the commodity to be paved position data is expressed in a coordinate array of all vertexes) and classification labels. The classification labels include whole bricks and crushed bricks, which may further include transverse bricks, brick-on-end and corner bricks. The initial classification labels are whole bricks.
In some embodiments, the method of identifying broken tiles is:
performing intersection operation on the contour of each paving commodity and the contour of the surface to be paved;
Updating the vertex coordinates of the intersection result to the position data of the paving commodity, namely replacing all initial vertex coordinates by all vertex coordinates of the intersection result;
And updating the classification labels of the tiles into broken tiles.
In some embodiments, broken tiles may also be identified in a relatively simple manner:
Traversing all vertexes of all paved commodities;
judging whether the position of each vertex is outside the paving area;
Marking paving commodities corresponding to the outer peaks of the areas as broken bricks, namely updating the classification labels into broken bricks;
And then solving the vertex coordinates of the intersected updated fragment paving commodity.
And S2, classifying the broken bricks.
According to the definition of transverse bricks, brick-on-end, corner bricks and whole bricks. If the length and width information of the broken bricks is the same as the length and width information of the whole bricks, classifying the broken bricks as the whole bricks; only different widths are classified as transverse bricks; only the lengths are different, homing brick-on-end; other cases are classified as corner bricks.
In some embodiments, considering that the tiles may not be rectangular, such as triangular, or even irregularly shaped, the bounding box of each tile may be first found, and then the tiles may be classified according to the size of the bounding box, including:
Step S201, inputting all vertex coordinates;
for example, the coordinate system may be established in the following manner: the x-axis is the paving direction, the vertical direction of the paving direction is the y-axis direction, and the paving starting point is the origin of the coordinate axis.
Step S202, obtaining the maximum value and the minimum value of the x coordinate in all vertex coordinates;
step S203, obtaining the maximum value and the minimum value of the y coordinates in all vertex coordinates;
Step S204, determining the lower left corner coordinate and the upper right corner coordinate of the bounding box according to the coordinate values obtained in the steps S202 and S203;
step S205, calculating the length and the width of the bounding box;
step S206, classifying the broken bricks according to the length and the width of the bounding box:
The classifying method specifically comprises the following steps:
If the length and the width of the broken brick bounding box are the same as those of the whole brick, classifying the broken brick into the whole brick;
if the length of the broken brick bounding box is the same as that of the whole brick and the width is different, classifying the broken brick into a transverse brick;
if the width of the broken brick bounding box is the same as the whole brick and the length is different, returning the broken brick to brick-on-end;
Otherwise, the broken bricks are classified as corner bricks.
And S3, integrating the corner bricks into transverse bricks or brick-on-end.
Illustratively, the crushed bricks are first pieced together in the form of transverse bricks as much as possible, i.e., some of the crushed bricks are pieced together so that the pieced length is as close as possible to the length of the original commodity. And sorting the corner bricks according to the length, for example, arranging the corner bricks in a reverse order according to the length, selecting the spliced corner bricks from front to back, if the sum of the lengths of the current corner bricks and the next corner bricks is greater than the length of the original commodity, skipping to carry out the next judgment until the found sum is less than or equal to the length of the original commodity, and then continuing to search until the whole queue is searched.
If the length combination of the corner bricks is smaller than the original commodity length, combining the corner bricks together to form a transverse brick. If the length of the combination is larger than that of the original commodity, a transverse brick space is opened up again, and then the next corner brick which can be combined with the transverse brick space is searched.
In some embodiments, all corner tiles calculate two integration schemes, namely one totally ascribed to the cross tiles and the other totally ascribed to brick-on-end, and then compare the two integration schemes, and select the most material-efficient scheme, namely the scheme occupying the least number of whole tiles.
As shown in fig. 4, the process of integrating the corner bricks specifically includes:
and step S301, sorting the corner bricks according to the length.
And step S302, carrying out length combination according to the sequence of the corner bricks, and if the length combination is still smaller than the length of the original commodity, continuing to combine the next block until the combined length exceeds the length of the original commodity.
And step S303, spatially combining the combined corner bricks and outputting the combined corner bricks into a transverse brick.
The remaining corner tiles continue to merge according to steps 302 to 303. Until all corner bricks are converted into transverse bricks.
And S304, sorting the corner bricks according to the width.
And step S305, carrying out width combination according to the sequence of the corner bricks, and if the length combination is still smaller than the width of the original commodity, continuing to combine the next block until the combined width exceeds the width of the original commodity.
And step S306, spatially combining the combined corner bricks, and outputting the combined corner bricks into one block brick-on-end. The remaining crushed bricks are combined in accordance with steps S302 to S303. Until all corner tiles are converted to brick-on-end.
To this end, an integration scheme is calculated that converts all corner tiles into either transverse tiles or brick-on-end.
In a specific embodiment, the transverse bricks or brick-on-end are represented by the same data structure, and if the transverse bricks are the transverse bricks brick-on-end formed by the angle bricks, a linked list is used in the transverse bricks brick-on-end to record the coordinates and length and width of the angle bricks formed internally, and if the transverse bricks are not formed by the angle bricks, only bounding box information of the transverse bricks brick-on-end is recorded.
The detailed process of integrating the corner bricks into the transverse bricks comprises the following steps:
step S3101, ordering the corner bricks according to the bounding box length.
In step S3102, a piece of transverse brick is generated, the length of the transverse brick is the length of the whole brick, and the height is not determined.
And step S3103, placing an angle brick into the right lower corner of the transverse brick, taking the right lower corner of the transverse brick as an origin of coordinates, and recording the coordinates of the placement of the angle brick, the length sum of all the angle bricks placed in the transverse brick and the maximum height of all the angle bricks.
Step S3104, determining whether the sum of the lengths of all the corner bricks in the transverse brick exceeds the length of the whole brick, repeating S3103 if not, if so, setting the height of the transverse brick to be the maximum value of the heights of the corner bricks formed by the transverse brick, and repeating step S3102.
Until all the corner bricks are integrated into transverse bricks.
The detailed process of integrating the corner brick into brick-on-end includes:
Step S3105, ordering the corner tiles according to the bounding box height.
Step S3106, generating a block brick-on-end, brick-on-end of undetermined height of the entire brick
Step S3107, a corner brick is placed in the lower right corner of brick-on-end, and the coordinates placed, the height sum of all corner bricks placed in brick-on-end, and the maximum length of all corner bricks are recorded with the lower right corner of brick-on-end as the origin of coordinates.
Step S3108, determining brick-on-end whether the height of all the corner bricks exceeds the height of the whole brick, if not, repeating S3107, if so, setting the length of brick-on-end to the maximum value of the lengths of the corner bricks comprising the same, and repeating step S3106.
Until all corner tiles are integrated brick-on-end.
After integration is completed, the mode of integrating all the corner bricks into transverse bricks or brick-on-end is compared, the mode is more material-saving, and the final integration mode of the corner bricks is determined.
And S4, calculating a discharging scheme of the transverse bricks and brick-on-end.
The classification of broken bricks is completed in the step S3, and the corner bricks are divided into transverse bricks and brick-on-end respectively. The condition of whole brick also can filter, because whole brick does not need the row material, and the quantity of whole brick can directly bring into row material result and add can.
Whereas a list of two types of transverse bricks and brick-on-end is available from step S3, the following two cases need to be separately discharged:
1. and (5) calculating the discharge of the transverse bricks.
Because the length of the transverse bricks is always equal to the length of the whole bricks, only the height values of all the transverse bricks are recorded, and then a one-dimensional packing algorithm is carried out on the heights of all the transverse bricks, so that the discharging result of the transverse bricks is calculated. The list of corner bricks inside the transverse bricks is transparent in this step, i.e. the list of corner bricks inside each integrated transverse brick is known and does not care about the corner brick discharge inside it.
In one embodiment, a specific method of calculating the discharge of a flat brick comprises:
Firstly, sequencing all the transverse bricks from big to small in height;
building a whole brick linked list, taking out one transverse brick each time, and traversing from the first whole brick:
if the horizontal brick can be put down, putting down, then taking out a horizontal brick again and traversing from the first one; if not, a new whole brick is opened, and the transverse brick is placed inside.
In another embodiment, the method for calculating the discharge of the transverse bricks can be as follows:
firstly, sorting the transverse bricks from big to small in height;
taking out one whole brick at a time to traverse the transverse brick, and loading the traversed transverse brick into the whole brick;
traversing once is performed to indicate that one whole brick is full, and then taking off one whole brick until all the whole bricks are arranged.
2. The discharge of brick-on-end was calculated.
Since brick-on-end is always equal to the height of the whole brick, only all brick-on-end length values need to be recorded, and then all brick-on-end lengths are subjected to a discharging algorithm to calculate a brick-on-end discharging result.
In one embodiment, a specific method of calculating brick-on-end a discharge includes:
firstly, sequencing all brick-on-end from large to small according to the length;
building a brick-setting linked list, taking one brick-on-end at a time, and traversing from the first brick-setting:
if so, then put down, then re-fetch a block brick-on-end and traverse from the first; if not, a new brick is opened and the block brick-on-end is placed inside.
In another embodiment, the method of calculating brick-on-end the discharge may also be:
Sorting brick-on-end according to the length from big to small;
taking out one whole brick at a time, traversing brick-on-end, and loading brick-on-end traversed if the whole brick can be loaded;
Once through brick-on-end, one brick is filled, and then one brick is removed until all brick-on-end rows are completed.
3. And adding the transverse bricks 1 and 2 and brick-on-end discharging results to obtain a final discharging result.
The corner bricks are divided into transverse bricks or brick-on-end links. In the case of a transverse tile, only the width (i.e., height) need be considered; in the case of brick-on-end, only the length needs to be considered.
In some possible embodiments, calculating the discharge schedule for the transverse bricks, brick-on-end may also be accomplished using dynamic programming, genetic algorithms, and the like.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
It is noted that all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description of the application and the claims and the description of the drawings above are intended to cover a non-exclusive inclusion. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).