Routine
---- 庖庖 羊 (on)
Author: HolyFire
In "庖庖 羊 羊 ---- Division" We used to remove a cute lamb to a part, I don't know if I can remember the whole sheep. Oh, it's going to flow. Here, there is no delicious mutton, only I am giving you how to learn our way to the program.
First of all, we have to clear the structure, that is, the graphics of my east, you all saw it, my ASCII art is far away, huh, huh, but still understand.
goat
┏┏━━━━━━━━┳┳┳━┻┻┻━━━━━┓┳┳┳┳┓┓┓┓┓
Brain body tail limbs
┏┏╋╋╋┳┳┳┓ ┏┏┳┳╋┳┳┳┳┳┳┓┓┓┏╋╋╋┓┓┓┏┻┓┓┓
Skeleton Beard Fallen Epastal Braise Braise Back Containment Skeleton Skeleton Tail Flash Fraglet Fruit
┏┏┳┻┳┻┳┳┳┓┓┓┏┳┳┳┻┳┳┳┳┳┳┓┓┏╋╋╋┳┛┳┛
Ear eye nose mouth heart spleen liver lung gastrointestinal kidney foot fluff skeleton
Structural map
In this way, our heart is not a piece of zero-fragmented sheep, but a part of a part of the whole. We started upward from the bottom and you will find this is a restructuring process. Otherw there is a decomposition process.
And we also attribute some minimum units to {contour, color}, which is the information that can be perceived in appearance.
Through this information, we found that this problem is better, people are always happy from simple and easy place, this is why I have to make a division.
Beard {contour, color} fluff {contour, color} skeleton {outline, color}
Chest {contour, color} {{contour, color} back {contour, color}
Eyes {contour, color} nose {contour, color} mouth {contour, color}
Heart {contour, color} spleen {contour, color} liver {contour, color}
Intestinal {contour, color} kidney {contour, color} foot {contour, color}
Tail {contour, color} ears {contour, color} lung {contour, color}
Stomach {contour, color}
It can be seen that the composition of these units is the same, we can collect it to the part of the sheep.
Part of {contour, color}
Silver, skeleton, chest, belly, back, eyes, nose, beard, mouth, heart, spleen, liver, bowel, kidney, feet, tail, ear, lung, stomach {{}}}
Lebit {foot, fluff, skeleton}
Habel {foot, fluff, skeleton}
The forebital and hind limbs also have the same structure.
Physical {foot, fluff, skeleton}
Prostheel, posterior limb {limb}
Flower {forelimbs, hind limbs}
Tortilla {heart, spleen, liver, lung, stomach, intestine, kidney}
Five official {ears, eyes, nose, mouth}
Tail {tail, fluff, skeleton}
Somatic {Chest, belly, back, internal organs, fluff, skeleton} head {facial features, beard, fluff, skeleton}
Goat {head, body, limbs, tail}
In fact, these are all partially combined, such as: forelimbs, hind limbs, body, etc. are also part of the sheep.
Physical {{{}, foot, fluff, skeleton}
Prostheel, posterior limb {limb}
Flood {{{}, forelim, hind limbs}
Nortent {{}, heart, spleen, liver, lung, stomach, intestinal, kidney}
Five official {{}, ears, eyes, nose, mouth}
Tail {{Part}, tail, fluff, skeleton}
Somatic {{}, chest, belly, back, internal organs, fluff, skeleton}
Head {{{}, facial features, beard, fluff, skeleton}
Goat {{head}, body, limbs, tail}
If a complete whole is a part of the special case, then goat should be a part.
Goat {section, head, body, limbs, tail}
In this way, it can be convenient to represent the part of the structural graph - the overall relationship.
Part of {contour, color}
Pavilic, skeleton, chest, belly, back, eyes, nose, mouth, heart, spleen, liver, bowel, kidney, feet, tail, ear, lung, stomach {{Part}}
Physical {{{}, foot, fluff, skeleton}
Prostheel, posterior limb {limb}
Flood {{{}, forelim, hind limbs}
Nortent {{}, heart, spleen, liver, lung, stomach, intestinal, kidney}
Five official {{}, ears, eyes, nose, mouth}
Tail {{Part}, tail, fluff, skeleton}
Somatic {{}, chest, belly, back, internal organs, fluff, skeleton}
Head {{{}, facial features, beard, fluff, skeleton}
Goat {{part}, head, body, limbs, tail}
So, it is time to start thinking by using the mind.
The part of the sheep can be a slight beard, or a tail of shaking, they have a common attribute: contours and colors, but the limbs consisting of feet, fluff, skeleton are also a part, what are they there? In common, it is a bit awkward by partial basis. In fact, a partial contour and color is what is not important for us, and the principle of packaging should not let the user know the internal structure, so we only need to provide a way to describe this part in the visual effect. How to make a method can express different effects, Switch? If else? No!
We have better ways - polymorphism, inherited structure has been, the lack is the virtual function.
Part {Show = No Display} How to behave an unknown object? Disorderless, a pure virtual function is better. The contour {display} is not only the part of the sheep can reflect the visual effect, and the visual effect is the relationship between people and sheep, not part of the sheep.
Fluff {{{section, display = Show fluff}, contours, color}
Skeleton {{section, display = display skeleton}, contour, color}
Chest {{section, display = display chest}, contour, color}
Abdominal {{section, display = display belly}, contour, color}
Back {{section, display = display back}, contours, color}
Eyes {{section, display = display eyes}, contours, color}
Nose {{section, display = display nose}, contour, color}
Mouth {{section, display = Show mouth}, contour, color}
Beard {{section, display = display beard}, contour, color}
Heart {{section, display = display heart}, contour, color}
Spleen {{section, display = Show}, contours, color}
Liver {{section, display = display liver}, contour, color}
Intestinal {{section, display = display intestinal}, contours, color}
Kidney {{section, display = show kidney}, contours, color}
Feet {{section, display = display feet}, contour, color}
Tail {{section, display = display tail}, contour, color}
Ear {{section, display = display ear}, contour, color}
Lung {{section, display = display lung}, contours, color}
Stomach {{section, display = display stomach}, contour, color}
Since the individual is uncertain, it is necessary to describe a contour, since the profile can describe the shape, plus color, it is necessary to reproduce the visual effect, thereby visible that the contour and color are also related, they combine together to reflect the visual effect . They are indirectly reflected in this part, such as
Fluff {{{section, display = Show fluff}, contours, color}
In fact
Fluff {{{section, display = outline color}, contour, color}
As a result, these basic units use the same interface from the new.
Silver, skeleton, chest, belly, back, eyes, nose, beard, mouth, heart, spleen, liver, bowel, kidney, feet, tail, ear, lung, stomach {part, display = contour color}, contours, colour}
Physical {{section, display = display limbs}, foot, fluff, skeleton}
Prostheel, hind limbs {{limb}}
Flood {{section, display = display limbs}, forelimbs, hind limbs}
Castinal organ {{section, display = display internal organs}, heart, spleen, liver, lung, stomach, intestine, kidney} {{{}}} = = = 五 五 五 五} 部分 部分 部分 部分 部分 部分 部分
Tail {{section, display = display tail}, tail, fluff, skeleton}
Somatic {{section, display = display body}, chest, belly, back, internal organs, fluff, skeleton}
Brain {{Part, Show = Show head}, facial features, beard, fluff, skeleton}
Goat {{section, display = Show goat}, head, body, limbs, tail}
The part of these combinations consists of some basic parts, then their visual effect is the overall effect of these basic parts.
Part {display = no display}
Contour {display}
Pavilic, skeleton, chest, belly, back, eyes, beard, nose, mouth, heart, spleen, liver, bowel, kidney, feet, tail, ear, lung, stomach {part, display = contour color}, contours, colour}
Physical {{section, display = display limbs}, foot, fluff, skeleton}
Prostheel, hind limbs {{limb}}
Flood {{section, display = display limbs}, forelimbs, hind limbs}
Cast organs {{section, display = display internal organs}, heart, spleen, liver, lung, stomach, intestinal, kidney}
Five official {{section, display = display five official}, ears, eyes, nose, mouth}
Tail {{section, display = display tail}, tail, fluff, skeleton}
Somatic {{section, display = display body}, chest, belly, back, internal organs, fluff, skeleton}
Brain {{Part, Show = Show head}, facial features, beard, fluff, skeleton}
Goat {{section, display = Show goat}, head, body, limbs, tail}
After another analysis, we found that the final model was so stream compared to the beginning of the beginning, I would like to accept this.
Now the overall-part relationship has been clear, now how to do it with the real thing in reality, that is, how to combine.
Then let us start to talk about it, how do we use the content known to describe a goat?
Goat: a head, a body, a limbs, a tail
Brain: a five sense, a beard, some fluff, a skeleton
Body: a chest, a belly, a back, some viscera, some fluff, a skeleton
Tail: a tail, some fluff, a skeleton
Pentax: Two ears, two eyes, a nose, a mouthful of internal organs: a heart, a spleen, a liver, two lungs, a stomach, some intestines, two kidneys}
Flooder: Two forelimbs, two hind limbs
Physical: a foot, some fluff, a skeleton
Otherwise, the number has an important position on the composition, so we have to add the concept of the base on our model.
Part {display = no display}
Contour {display}
Silver, skeleton, chest, belly, back, beard, eyes, nose, mouth, heart, spleen, liver, bowel, kidney, feet, tail, ear, lung, stomach {part, display = contour color}, contour [ 1], color [1]}
Physical {{section, display = display limbs}, foot [1], fluff [N], skeleton [1]}
Prostheel, hind limbs {{limb}}
Flower {{section, display = display of limbs}, forelims [2], hind limbs [2]}
Castinal tire {{section, display = display internal organs}, heart [1], spleen [1], liver [1], lung [2], stomach [1], intestinal [N], kidney [2]}
Five official {{section, display = display five official}, ear [2], eyes [2], nose [1], mouth [1]}
Tail {{section, display = display tail}, tail [1], fluff [N], skeleton [1]}
Somatic {{section, display = display body}, chest [1], abdominal [1], back [1], internal organs [1], fluff [N], skeleton [1]}
Brain {{Part, Show = Show head}, facial features [1], beard [n], fluff [N], skeleton [1]}
Goat {{section, display = Show goat}, head [1], body [1], limbs [1], tail [1]}
In this case, it is closer to reality and reduces the complexity of the problem.
After a lot of analysis, this model is relatively clearer, acceptable, but does not mean this is the best model, there will be better models. But we don't need the most perfect model, as long as there is a suitable model, here, as my needs, it is already very suitable.
Needless to say, it is now beginning to enter the coding phase. After the above analysis, I believe that there are many things in our hearts to do, don't worry, come slowly, and can't do it.
Limited to the space, I can't add the contents of the graphic display. Too much content will be confused. I can't promine the focus; I can easily introduce the idea to the details of the details, but I ignore the overall situation; then to the graphic display and compilation The relationship between the device and the operating system is not suitable for me to talk about; Finally, I am extremely scarce, if the image of drawing makes everyone disappointment, haha, joke, let us continue .
2001/9/27
Ding Ning