2. Modeling based on the current transformation matrix
In a multi-layered model, components need to be multi-referenced through low-level to high-level to finally implement references in the world coordinate system of the root object. Xwc is the world coordinate point, Xmc is the component body coordinate point, and the reference transformations of each level are recorded as T0, T1, ..., Tk, then Xwc=Xmc.Tk.Tk-1....T1.T0. It can be seen that this reference process requires a series of coordinate transformation operations, and multiple matrix multiplication operations are required. Since all the pixels in the component need to perform such operations, the execution efficiency is extremely low. According to the principle of composite geometric transformation, there is a composite transformation T such that T=Tk.Tk-1....T1.T0, then Xwc=Xmc.T. The compound transformation T directly reflects the transformation relationship between the component body coordinates and the root object world coordinates. Therefore, we can introduce a current transformation matrix (CTM) as a global variable, which represents this composite transformation. When the model references the component layer by layer from the root object (the preorder traversal of the tree), the corresponding reference transformation is accumulated to obtain a new CTM, ie CTM0=T0, CTM1=T1.CTM0,...,CTMk=Tk.CTMk- 1. From this, Xwc=Xmc.CTM can be obtained, and each pixel in the component can be referenced in the world coordinate system only by one (current) coordinate transformation.
Using the CTM transformation model requires a set of operational functions for the CTM. First, you should be able to set up CTM. There are two types of settings: relative settings and absolute settings. Absolute setting refers to replacing the original CTM value with a given matrix; relative setting means multiplying a given matrix by CTM and replacing CTM to achieve CTM accumulation. Secondly, the CTM needs to be temporarily reserved, because in the environment of multi-level nesting, when the component returns to the component after completing the reference to the lower component, the original CTM value of the component should be returned accordingly, and the CTM can be stacked. Meet this requirement.
The typical procedure for implementing component reference transformation in accordance with the CTM principle is as follows:
PUSH(ctm,stk); push ctm onto stack stk
SET-CTM-REL(m); replace ctm with m.ctm
SUB-OBJECT; call component (defined in the body coordinate system)
POP(ctm,stk); will ctm pop the stack stk
The CTM operation function can be thought of as a set of modeling functions of a graphics system built in the world coordinate system. It is used to help the application software build the model. Each component generates an output pixel defined in its ontology coordinate system, via the CTM function. After processing, it is transformed into an output pixel defined in the world coordinate system, and then processed by the graphics system.
Third, the hierarchical organization of engineering drawings and special issues
1. Hierarchical organization of engineering drawings
Engineering drawings have an obvious hierarchy. A whole picture consists of various views and other graphic elements reflecting the design object; these graphic elements are combined by lower-level basic components; the bottom layer is the basic pixels. A typical example is a machine that contains multiple components, each component or an inseparable component, or a component that can be further decomposed, so that the design can be represented as a hierarchy. This hierarchical organization corresponds to a structured programming, and graphics programming should generally organize the program structure according to it.
It should be noted that the conventional graphics program is designed according to the above structure, but there are certain defects in the processing of the design object. According to the principle of the hierarchical model, the relationship between high-level components and low-level components should be a reference transformation, but the conventional graphics program is just a relationship of calling subroutines. Specifically, when designing a program segment or program module of a component, the conventional method often requires frequent design data → scale conversion of the drawing data, and the programmer should pay attention to both the design object itself and its performance on the drawing. In terms of aspects, this is bound to increase the burden of programming, and the program code is not refined enough. However, according to the hierarchical model method, since the component is defined in its own ontology coordinate system, the graphic can be drawn with the real design size in the component's own body coordinate space without considering the problem of proportional conversion, that is, the programmer only needs Focusing on the design object itself greatly simplifies programming. The method does not seem to be scaled on the surface, but essentially the scale conversion has been hidden into the background by reference to the transformation matrix, which is automatically handled by the hierarchical model manipulation function.
Previous page next page
Felt Pin Board,Acoustic Felt Panels,Sound Absorbing Panels,Decorative Acoustic Panels
Hebei RooAoo New Material Technology Co.,Ltd. , https://www.raacoustic.com