Patent ID: 8606549

Claim:
A method of simulating illuminated environment for off-line programming being performed by a processor of a data processing device, the method comprising: (a) reading information of a three-dimensional (3D) model of a product (product model) and a 3D model of a light source device (light source model) from a storage device, and respectively meshing the product model and the light source model into a plurality of space triangles; (b) setting illumination parameters for the product model based on the information of the product model and the light source model, the illumination parameters comprising an illumination range, parameters as to types and number of light sources, an illumination direction, parameters as to light source positions and light source intensity, wherein step (b) comprises: (b1) determining the illumination range according to coordinates of a maximum bounding box of the product model; (b2) determining a position of a main light source of the light source device according to coordinates of a center point of an upper surface of the maximum bounding box; (b3) determining positions of assistant light sources of the light source device based on the main light source position and the information of the light source model; (b4) determining an illumination cone according to the position of the main light source and the illumination range, taking a rotation axis of the illumination cone as a light ray S along the illumination direction, and taking a height of the rotation axis as the illumination depth; and (b5) dividing the illumination depth into n sections to obtain a set of points on the illumination depth, calculating a distance between each point on the illumination depth and the main light source position, and calculating an attenuation coefficient K of each point according to a corresponding distance; (c) simulating an illuminated environment for the product model based on the illumination parameters; (d) reading 3D measurement points on the product model, projecting the product model onto a two-dimensional (2D) plane under the illuminated environment, and determining 2D measurement points matching the 3D measurement points; (e) determining a measurement region in the 2D plane according to the 2D measurement points, and rendering the measurement region based on an original color of the product model and illuminated effect produced by the illuminated environment; (f) creating point-selection tools in the rendered measurement region; and (g) generating an off-line measurement program based on the illumination parameters, coordinate information of the 2D measurement points and 3D measurement points, color information of the measurement region, and information of the point-selection tools.