Research on 3D-Model Reconstruction and Coordinate-Picking. Technology Based on CsGL

Similar documents
Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Three-Dimensional Viewing Hearn & Baker Chapter 7

15. Clipping. Projection Transformation. Projection Matrix. Perspective Division

Half-edge Collapse Simplification Algorithm Based on Angle Feature

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

Influence of SLA rapid prototyping process parameters on the forming. precision

Virtual Interaction System Based on Optical Capture

FACET SHIFT ALGORITHM BASED ON MINIMAL DISTANCE IN SIMPLIFICATION OF BUILDINGS WITH PARALLEL STRUCTURE

Perspective Mappings. Contents

The Traditional Graphics Pipeline

CHAPTER 1 Graphics Systems and Models 3

Overview. By end of the week:

Ray Tracer Due date: April 27, 2011

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

The Traditional Graphics Pipeline

CSE452 Computer Graphics

The Traditional Graphics Pipeline

Design and Implementation of Animation Post-processor Based on ACIS and HOOPS in MWorks

Mouse Ray Picking Explained

Computer Graphics 7: Viewing in 3-D

Design and Application of the Visual Model Pool of Mechanical Parts based on Computer-Aided Technologies

Geometry: Outline. Projections. Orthographic Perspective

A method of three-dimensional subdivision of arbitrary polyhedron by. using pyramids

CS 112 The Rendering Pipeline. Slide 1

L1 - Introduction. Contents. Introduction of CAD/CAM system Components of CAD/CAM systems Basic concepts of graphics programming

Real-time Generation and Presentation of View-dependent Binocular Stereo Images Using a Sequence of Omnidirectional Images

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

Rendering If we have a precise computer representation of the 3D world, how realistic are the 2D images we can generate? What are the best way to mode

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 5, No 2, September 2012 ISSN (Online):

Influence of SLA Rapid Prototyping Process Parameters on the Forming Precision Yaru Shi1, a, Yan Cao2, b*, Yongming Wang 3, cand Liang Huang4,d

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Models and The Viewing Pipeline. Jian Huang CS456

Gesture-Based 3D Mesh Modeler

Computer Graphics I Lecture 11

Pipeline Operations. CS 4620 Lecture 14

3D Viewing Episode 2

Movie: Geri s Game. Announcements. Ray Casting 2. Programming 2 Recap. Programming 3 Info Test data for part 1 (Lines) is available

Rasterization Overview

Virtual Environments

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

A New Slicing Procedure for Rapid Prototyping Systems

Computer Graphics. - Rasterization - Philipp Slusallek

Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

CS 130 Exam I. Fall 2015

CSE328 Fundamentals of Computer Graphics

Offset Triangular Mesh Using the Multiple Normal Vectors of a Vertex

Computer Graphics and Visualization. Graphics Systems and Models

COMS 4160: Problems on Transformations and OpenGL

6th Grade Math. Parent Handbook

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

Transformation Pipeline

Multi-projector-type immersive light field display

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

From Vertices To Fragments-1

Projection Matrix Tricks. Eric Lengyel

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing

CPSC GLOBAL ILLUMINATION

Study on Improving the Quality of Reconstructed NURBS Surfaces

Computer Viewing. Prof. George Wolberg Dept. of Computer Science City College of New York

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers

TOOL PATH GENERATION FOR 5-AXIS LASER CLADDING

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

Particle systems, collision detection, and ray tracing. Computer Graphics CSE 167 Lecture 17

One or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface

Development of a Rapid Design System for Aerial Work Truck Subframe with UG Secondary Development Framework

Terrain rendering (part 1) Due: Monday, March 10, 10pm

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

Interactive Collision Detection for Engineering Plants based on Large-Scale Point-Clouds

BioTechnology. An Indian Journal FULL PAPER. Trade Science Inc. A wavelet based real-time rendering technology for indoor mixed reality ABSTRACT

Hole repair algorithm in hybrid sensor networks

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Viewing with Computers (OpenGL)

6th International Conference on Management, Education, Information and Control (MEICI 2016)

Motivation. What we ve seen so far. Demo (Projection Tutorial) Outline. Projections. Foundations of Computer Graphics

Tutorial 3: Constructive Editing (2D-CAD)

OpenGL Transformations

MODERN DIMENSIONAL MEASURING TECHNIQUES BASED ON OPTICAL PRINCIPLES

An Automatic Posture Planning Software of Arc Robot Based on SolidWorks API

Classical and Computer Viewing. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Advanced Lighting Techniques Due: Monday November 2 at 10pm

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Chapter 5. Projections and Rendering

Raycasting. Chapter Raycasting foundations. When you look at an object, like the ball in the picture to the left, what do

Creating and editing vector maps

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

Measurement and Precision Analysis of Exterior Orientation Element Based on Landmark Point Auxiliary Orientation

Practical Shadow Mapping

International Journal of Advance Engineering and Research Development

Reasoning Boolean Operation for Modeling, Simulation and Fabrication of Heterogeneous Objects. Abstract

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

Transcription:

4th International Conference on Sensors, Measurement and Intelligent Materials (ICSMIM 2015) Research on 3D-Model Reconstruction and Coordinate-Picking Technology Based on CsGL Jiang Xu1,Chen Shizhi2,Liang Xu3,Liu Caihui4 1 2 3 4 Keywords: on-line testing, 3D model reconstruction, Picking-up algorithm CsGL, STL model Abstract.--3D-model reconstruction and picking-up algorithm for testing points are key technologies for on-line testing. In this paper, based on.net platform, 3D-model reconstruction for workpiece in STL file format and related transform operation are achieved by the third-party software CsGL. Besides, ray picking-up algorithm for arbitrary point coordinate on the workpiece surface is also explored. Compared to the former, he method for model rendering, the efficiency and accuracy of the picking-up algorithm are all improved in certain degree. Introduction Nowadays, advanced manufacturing technology is one of the most important embodiments for comprehensive national strength. On-line testing and compensation technique, which combines processing and testing together well, provide numerous measuring information to manufacturing process. This technology can shorten auxiliary time, improve machining accuracy and reduce production expense. 3D model reconstruction and testing information picking for the workpiece is the critical step to realize on-line testing technology. There are many recent researches about 3D model reconstruction and testing information picking method, which are proposed in related papers [1-6]. However, most traditional implements are based on MFC Framework, which results in laborious test method, low efficiency and poor accuracy. In this paper, we rebuild 3D model for workpiece model in STL file format using C# language and combining with CsGL, based on VS 2013 platform. Spatial alternation such as rotation, translation and scaling of the 3D model is well performed and circumstance setup of the model is controlled. Besides, a quick coordinate picking-up algorithm for testing point is proposed in this paper. It has significance to a certain to the research on the on-line testing technology during workpiece manufacturing. 3D Model Reconstruction A. STL Model File Parsing STL file is a kind of file format applied for triangle mesh representation in graphics application system. It is easily understandable and wildly used. Almost all kinds of 3D graphics processing software can output STL file format. Only closed surface can be expressed in STL file. In STL file with ASCII code, every triangular patch is constituted by 7 rows of code, which is shown as follows: 2016. The authors - Published by Atlantis Press 643

facet normal v x outer loop vertex vertex v y v z p p p 1x 1y 1z p p p 2x 2y 2z vertex p p p 3x 3y 3z endloop endfacet In this paper, we designed a method called GetSTLModelData in the custom class STLModel to parse STL files and defined the 3D arrays stldata[facecont,4,3] used to store related data of model. The parse process is shown in Fig. 1. Read a line of text ReadLine() Fig. 1 STL file parse process Fig. 2 Program structure B. Rendering 3D Model with CsGL OpenGL is a professional cross-language, multi-platform graphic application programming interface for rendering 3D vector graphic models. It is an underlying graphic library with powerful functions and convenient invocation. The implementation technology for OpenGL with C++ language in recent research is proven completely. However, there were not standards and rules for the development of OpenGL with C#. The third-party software CsGL is the OpenGL on the platform of.net Framework, which is operated via two dynamic link libraries, csgl.dll and csgl_native.dll. To render 3D model and achieve interactive operation, the program structure design is shown in Fig.2. Import the STL model menu to BHOMV.cs class in the main interface and trigger the event of ImportStlModel(). Then call the GetSTLModelData() function in the class of STLModel.cs to get 644

model data. Next, we set up the OpenGL graphic environment to render the model. The steps for rendering 3D model with CsGL are as follows: i) Set up the graphic environment Create a new class belonging to OpenGLControl and rename it OpenGLView. Then create a new instance under this class. ii) Initialize the graphic environment The initialization for the graphic environment includes setups for cache, illumination, material and etc., which can be operated by the function overriding InitGLContext(). iii) Render the model The model rendering can be operated by the funcation overriding gldraw(). In this paper, axes are drew with DrawCoord() function in the class of ModelReCreat.cs and the model of the workpiece are rendered with DrawTriChip function. iv) Change the form size When the form size is changed, redraw of the form can be achieved by rewriting the class with the function OnSizeChanged() in OpenGLControl. v) Refresh the screen To create a timer object GLUpdataTimer in constructor function can refresh the screen in the callback function. C. Model Transformation To display the model in the window, the process includes view transformation, projection transformation and viewport transformation. i) View transformation OpenGL renders the model in the world coordinate system. The eye coordinate system is decided by the viewing position and direction, which is a right-handed coordinate system. Without any view transformation the eye coordinate system is the same with the world coordinate system, as shown in Fig. 3. View transformation is to change the position relationship between the eye and world coordinate system. In the self-defined function CameraInit(), we call the function glulookat() in OpenGL to define the viewing position and direction. Fig.3 Eye coordinate system Fig. 4 Model display ii) Projection transformation Projection transformation is used to define a view-frustum. In this paper, rectangular projection is used to define the view-frustum of the cuboid. Under the self-defined function 645

CameraProjection(), function gl0rtho() of OpenGL is called to set up the view frustum. iii) Viewport transformation Viewport is the region for graphic displaying in the client area window. Viewport transformation can map the projective plane of view-frustum to the viewport. The operation of model includes translation, rotation, scaling, perspectives switching and etc. In the class of CameraBase.cs, the function CameraMoveViewByPercent() is defined to operate model translation, which can move the model up, down, right and left or according to the width and height of the viewport; function CameraZoom() is used to scale the model; function CameraZooAll() is used to optimize the display size of the model after using function GetSTLModelBox() to gain the minimum bounding size of the model; function CameraRotate() is used to rotate the model around the horizontal axis or vertical axis, which is based on the rotation matrix generated by the function CreateRotateMatrix() in class GeometryBase.cs; function CameraSetViewTypee() can switch perspective of the model and display six orientation views as Tom, Bottom, Front, Back, Left, Right and four axonometric views as SW, SE, NW, NE. D. Model Reconstruction In this paper we read a model in STL file format and reconstruct it. The model is displayed in Fig. 4 after appropriate translation, rotation and scaling. Coordinate Picking-up Algorithm A. Picking-up Principle In OpenGL, the function glpickmatrix() based on former principle is with low efficiency and poor accuracy. If we need the space coordinate of arbitrary point on the workpiece, the algorithm provided by OpenGL cannot meet requirements. The flow of the picking-up algorithm proposed in this paper is shown Fig. 5. The principle is that, the picking-up operation of the point on the STL model surface can be seen as an intersection of the triangular patch of the STL model and the observation line though the cursor position. Fig. 5 Picking-up algorithm flow 646

B. The Picking-up Algorithm Flow i) Obtain the picking-up ray p x y, which (, 2 ) Click the screen to gain the 2D coordinate of the selected point d corresponds to p on near clip plane and p on far clip plane of the view-frustum. By means of the reverse transformation gluunproject() in OpenGL the world coordinate of p and p can be obtained and then a straight line through p and p in the space is determined. The equation of this straight line can be acquired. ii) Screen patches by vector dot products Only those patches whose normal direction is opposite to the normal direction of observation line is possibly in demand. To do the dot product operation for the normal vectors of the triangular patch and observation line, only those results less than 0 match the demanded condition. iii) Calculate intersections of the space line and the triangular patch To do the intersection operation for the picking-up ray and the triangular patches in demanded by turn, the coordinate of intersection point is gained as shown in Fig. 6. The point normal form equation of the straight line where the picking-up ray locates can be performed as x= p'[0] + RayVt[0]* t y = p'[1] + RayVt[1]* t z = p'[2] + RayVt[2]* t The point normal form equation of the plane where the triangular patch locates can be performed as TVt[0]*( x PA[0]) + TVt[1]*( x PA[1]) + TV[2]*( x PA[2]) = 0 (2) By the two equations we can calculate that (1) ( PA[0] p'[0])* TVt[0] + ( PA[1] p'[1])* TVt[1] + ( PA[2] p'[2])* TVt[2] t = TVt[0]* RayVt[0] + TVt[1]* RayVt[1] + TVt[2]* RayVt[2] (3) And then we can obtain the intersection point coordinate CrossPoint(x,y,z). iv) The position relationship between the point and triangle. The intersection point calculated must be inside the triangular patch or on its sideline. The mainstream methods to judge include comparing the area and vector cross product. In this paper we apply the algorithm of comparing the area. If SOAB + SOAC + SOBC SABC (4) is true, then the intersection point O is inside the triangle or on its sideline, where we calculate the triangle area by Heron s formula. S = p( p a)( p b)( p c) (5) 647

Fig. 6 Intersection operation for the picking-up Fig. 7 Multi-point crossover ray and the triangular patch v) Choose the optimum solution point If several points in demand is obtained by intersection operations, such as the point p1 and p3 as shown in Fig. 7, we can compare the distance d from these points to the near clip plane and choose the optimum point with the minimum distance. C. Picking-up Result In this paper we read a file of Sphere workpiece. After appropriate translation, rotation and scaling, double click the measuring point on the model surface and the information window of the picking-up point pops up. The information includes 3D coordinate, normal vector and serial number of its triangular patch. Users can fill the the test numver and test point serial number and then choose to save or abandon. Summary In this paper, based on VS2013 development platform, using C# programming language and the third-party software CsGL, we implement reading and displaying of the workpiece model in STL file format, the setup of the rendering environment and multiple conversion operation of the model. A quick picking-up algorithm for the 3D coordinate information of the testing point on the workpiece surface is also proposed. Besides, via experimental verification, the proposed algorithm is with high efficiency and good accuracy, which is of great significance for the research on on-line test technology. Reference [1] Chen Yujun, Zhang Qi, OpenGL simulation and 3D model harvest based on MFC, J. Modern Design Technology,2004. [2] Xia Ruixue, Chen Lin. The measurement information extraction methods oriented CAD model, J. Journal of Instruments and Meters,2011. [3] Wang Jian, Lu Guodong. The pick-up method of graphic objects in 3D scene, J. Computer Technology Application,2004. [4] Zhu Mingliang, Dong Bing. Three-dimensional scene pick-up algorithm based on viewport space, J. Journal of Engineering Graphics,2008. [5] Zhu Jigui, Zhang Guoquan. A new pick-up method based on OpenGL redraw type object, J. Micro Computer and Application,2005. [6] Qian Bo, Zhang Lichao, Surface area recursive pick-up algorithm based on STL model, J. Journal of Huazhong University of Science and Technology,2008. [7] Zhong Sigao, Gao Zhi, The 3D model browsing measurement and management based on OpenGL, J. Computer Engineering,2013. [8] Lee K H, Woo H. Direct integration of reverse engineering and rapid prototyping, J. Computers 648

& Industrial Engineering, 2000. [9] Wang Qinghui, Li Jingrong, CAD application development explanation, M. Electronic Industry Press,2012. 649