Implementation of a COLLADA Scene-Graph

Total Page:16

File Type:pdf, Size:1020Kb

Implementation of a COLLADA Scene-Graph 2006:265 CIV MASTER'S THESIS Implementation of a COLLADA scene-graph Johan Lindbergh Luleå University of Technology MSc Programmes in Engineering Computer Science and Engineering Department of Computer Science and Electrical Engineering Division of Media Technology 2006:265 CIV - ISSN: 1402-1617 - ISRN: LTU-EX--06/265--SE Implementation of a COLLADA scene-graph Master's thesis by Johan Lindbergh [email protected] September 11, 2006 Supervisors: Tomas Karlsson Mikael Drugge Luleå University of Technology Systemteknik Preface This thesis was done at Agency 9 AB for Luleå University of Technology Computer Science and Engineering, during late spring and summer 2006. Agency 9 wanted to see if the digital content pipeline could be made more ecient by designing a 3D engine around the open COLLADA format. Tomas Karlsson at Agency 9 had a rough draft for how this could be done using a client-server architecture. The basics of the architecture is that the client should read and parse data and create rendering instructions, while the server takes those instructions and resources and uses them for rendering the scene. The focus of this thesis is on the client part, although data structures relevant to the rendering server will be covered, as well as the communication with the server. I would like to thank Tomas Karlsson and Khashayar Farmanbar at Agency 9 for all help, and of course the other guys at Agency 9 during the period: Micke, Lasse, Johan, Tompa K and Andreas. Special thanks goes to Åsa Lindvall. You know why. Abstract The need for more graphical content in real-time applications is rapidly in- creasing. As hardware becomes more powerful, the polygon limit, shader possi- bilities and thereby also the room for details in a scene or model increases. The work to create these large digital worlds is done using dierent digital content creation tools (DCC tools), for example Autodesk Maya, 3dsMax, Milkshape or Blender. This makes it valuable to have a versatile non-proprietary format that can handle large data sets, and that is what makes COLLADA interesting for this thesis. A COLLADA document can contain and support almost every feature that a modern content creation tool could need. More importantly, it also contains a scene-graph. Agency 9's current 3D engine AgentFX has been using a scene-graph structure for several years. This scene-graph has to be created by manually building the graph; adding and removing nodes and their children, grandchildren and so on. But is it possible to directly use the scene-graph contained in a COLLADA document for a real-time 3D engine? The main goal of the thesis is to implement and evaluate a client-server architecture of a 3D engine with COLLADA as the base format, continuing on Agency 9's path of supporting COLLADA, and using a scene-graph structure. This thesis mainly covers the client part of the 3D engine. It describes the COLLADA format in more detail, and how to parse and store the COLLADA data structures. Also, the issue of how to communicate with the rendering server is addressed. The main conclusion is that the COLLADA structure can be modied and used as the base of a scene-graph based 3D engine. Contents 1 Introduction 1 1.1 Problem formulation . 1 1.2 Purpose . 2 1.3 Background . 2 1.3.1 COLLADA & the Khronos group . 2 1.3.2 Agency 9 . 3 1.4 Other work . 3 1.5 Limitations . 3 2 Methods and theory 4 2.1 XML . 4 2.1.1 Data binding . 4 2.2 Scene-graphs . 5 2.3 COLLADA . 6 2.3.1 Summary . 7 2.4 The COLLADA format . 7 2.4.1 Header . 8 2.4.2 Library . 8 2.4.3 Scene . 13 2.5 Rendering . 14 2.5.1 Resources and instructions . 14 3 Implementation 16 3.1 JAXB . 16 3.1.1 JAXB customization . 17 3.1.2 JAXB usage . 18 3.2 COLLADA Client . 19 3.2.1 Resources and instructions revisited . 19 3.2.2 Animating . 20 3.3 Client parser classes . 21 3.3.1 COLLADAParser . 21 3.3.2 AnimationParser . 21 3.3.3 CameraParser . 21 3.3.4 ControllerParser . 21 3.3.5 EectParser . 21 3.3.6 GeometryParser . 22 3.3.7 LightParser . 23 3.4 Rendering server . 23 iii 3.5 Data structures . 23 3.5.1 Bind package . 23 3.5.2 Vector math library . 24 3.6 Communication . 24 4 Evaluation 26 4.1 Functionality . 26 4.1.1 Client-server architecture . 26 4.1.2 Parsing COLLADA libraries . 26 4.1.3 Camera . 27 4.1.4 Animations . 27 4.1.5 Scene-graph . 27 4.2 Performance . 28 4.2.1 Load time examples . 28 4.2.2 Space costs . 30 5 Discussion 32 5.1 Conclusion . 32 5.1.1 COLLADA as a 3D engine format . 33 5.2 Future work . 33 Bibliography 35 List of Figures 36 List of Tables 37 A Unmarshalling example 39 B Sample COLLADA le 41 Chapter 1 Introduction 1.1 Problem formulation The concept of using a scene-graph has been around for quite some time. IRIS Inventor was one of the earliest, presented in a paper in 1993 [1]. Nowadays, a scene-graph is almost the de-facto standard data structure for representing a virtual world. Current 3D graphics toolkits using some form of scene-graph include Open Scenegraph1, Java3D 2, Gizmondo3, Renderware4 and of course AgentFX 5. For a more thorough explanation about what a scene-graph is, please refer to section 2.2. Until recently, AgentFX has put the work of building the scene-graph on the programmer. Manually creating and connecting all nodes in a content tree can be tedious work and be quite hard to manage. It could also be quite time consuming, especially when creating large virtual worlds. Agency 9 thought that it was possible to use COLLADA's own scene-graph representation to automatically build the scene-graph. Using the information in a COLLADA document, the programmer would no longer have to bother with the initial structuring of the graph. This was implemented and tested in Mikael Lagré's [2] bachelor's thesis (see 1.4) in 2005. Since COLLADA is very well dened, and its goal is to incorporate as many features in modern content creation tools as possible, it would be interesting to see if one could build an engine that can read and parse an entire COLLADA document. Then, depending on machine capabilities and implemented features, the engine should make its best eort to render the scene. Tomas Karlsson, CTO at Agency 9, had an idea of a client-server architecture for a 3D engine. The client should be responsible for reading and parsing the COLLADA data. The data should then be packaged and sent to a rendering server. The server [3] (see 1.4) is then responsible for implementing functionality of rendering what it can handle. The COLLADA documentation [4] quite clearly states that COLLADA is not a game engine format as such, rather that it is benecial in the content 1http://www.openscenegraph.org/ 2https://java3d.dev.java.net/ 3http://www.gizmosdk.com/ 4http://www.renderware.com/ 5http://www.agency9.se/ 1 1.2. PURPOSE CHAPTER 1. INTRODUCTION production pipeline. The documentation does however not point out any obvious problems with using COLLADA as an engine format, just that applications will use proprietary, size-optimized binary les. Whether there is some substance in those statements remains to be seen. 1.2 Purpose Agency 9 feels that it is worth researching the possibility to use COLLADA more or less as an engine format. Using the client-server architecture, the client should be able to supply the server with all data needed for rendering, and probably more than that. The goal is to be able to use the client and server as separate entities. Dierent rendering kernels could be used by the server, and depending on the kernel, dierent amounts of the data sent could be used in the rendering process. The purpose of this thesis is to learn as much as possible about XML and COLLADA, and to see if it is possible to take the whole COLLADA structure, including both resources and scene-graph, and map it to a real time rendering engine. Most of the work will be to understand the COLLADA structure and decide what to do with the data contained within a .dae6-le. Another big part of the work will be the learning about XML and data binding, implementing resource parsers and key-frame interpolation. Yet another part of the thesis project is to decide, together with Tomas Karlsson and Lasse Wedin [3] how to talk to the rendering server. Some problems in Lagré [2] arised because of the requirement to t the current version of AgentFX. These problems might be avoided by redesigning the 3D engine from scratch. Another higher purpose is thus to lay the foundation for a new iteration of AgentFX. 1.3 Background 1.3.1 COLLADA & the Khronos group COLLADA, from COLLAborative Design Activity, is basically an open Digi- tal Asset Exchange Schema for the interactive 3D industry. COLLADA is a standard of the Khronos group7. The Khronos group was founded in January 2000 by a number of media- centric companies including ATI, Creative, Google, Intel, nVidia, Ericsson and Sun Microsystems. The group is dedicated to creating open standard APIs and enable the authoring and playback of rich media on a wide variety of platforms and devices. Current media APIs and technologies are OpenGL R , OpenGL R ES, OpenVGTMand COLLADATMamong others.
Recommended publications
  • Studio Toolkit for Flexibles 14 User Guide
    Studio Toolkit for Flexibles 14 User Guide 06 - 2015 Studio Toolkit for Flexibles Contents 1. Copyright Notice.......................................................................................................................................................................... 4 2. Introduction.....................................................................................................................................................................................6 2.1 About Studio....................................................................................................................................................................... 6 2.2 Workflow and Concepts................................................................................................................................................. 7 2.3 Quick-Start Tutorial...........................................................................................................................................................8 3. Creating a New Bag.................................................................................................................................................................12 3.1 Pillow Bags........................................................................................................................................................................13 3.1.1 Panel Order and Fin vs. Lap Seals.............................................................................................................14 3.2 Gusseted Bags.................................................................................................................................................................15
    [Show full text]
  • Compression and Streaming of Polygon Meshes
    Compression and Streaming of Polygon Meshes by Martin Isenburg A dissertation submitted to the faculty of the University of North Carolina at Chapel Hill in partial fulfillment of the requirements for the degree of Doctor of Philosophy in the Department of Computer Science. Chapel Hill 2005 Approved by: Jack Snoeyink, Advisor Craig Gotsman, Reader Peter Lindstrom, Reader Dinesh Manocha, Committee Member Ming Lin, Committee Member ii iii ABSTRACT MARTIN ISENBURG: Compression and Streaming of Polygon Meshes (Under the direction of Jack Snoeyink) Polygon meshes provide a simple way to represent three-dimensional surfaces and are the de-facto standard for interactive visualization of geometric models. Storing large polygon meshes in standard indexed formats results in files of substantial size. Such formats allow listing vertices and polygons in any order so that not only the mesh is stored but also the particular ordering of its elements. Mesh compression rearranges vertices and polygons into an order that allows more compact coding of the incidence between vertices and predictive compression of their positions. Previous schemes were designed for triangle meshes and polygonal faces were triangulated prior to compression. I show that polygon models can be encoded more compactly by avoiding the initial triangulation step. I describe two compression schemes that achieve better compression by encoding meshes directly in their polygonal representation. I demonstrate that the same holds true for volume meshes by extending one scheme to hexahedral meshes. Nowadays scientists create polygonal meshes of incredible size. Ironically, com- pression schemes are not capable|at least not on common desktop PCs|to deal with giga-byte size meshes that need compression the most.
    [Show full text]
  • Meshes and More CMSC425.01 Fall 2019 Administrivia
    Meshes and More CMSC425.01 fall 2019 Administrivia • Google form distributed for grading issues Today’s question How to represent objects Polygonal meshes • Standard representation of 3D assets • Questions: • What data and how stored? • How generate them? • How color and render them? Data structure • Geometric information • Vertices as 3D points • Topology information • Relationships between vertices • Edges and faces Vertex and fragment shaders • Mapping triangle to screen • Map and color vertices • Vertex shaders in 3D • Assemble into fragments • Render fragments • Fragment shaders in 2D Normals and shading – shading equation • Light eQuation • k terms – color of object • L terms – color of light • Ambient term - ka La • Constant at all positions • Diffuse term - kd (n • l) • Related to light direction • Specular term - (v • r)Q • Related to light, viewer direction Phong exponent • Powers of cos (v • r)Q • v and r normalized • Tightness of specular highlights • Shininess of object Normals and shading • Face normal • One per face • Vertex normal • One per vertex. More accurate • Interpolation • Gouraud: Shade at vertices, interpolate • Phong: Interpolate normals, shade Texture mapping • Vary color across figure • ka, kd and ks terms • Interpolate position inside polygon to get color • Not trivial! • Mapping complex Bump mapping • “Texture” map of • Perturbed normals (on right) • Perturbed height (on left) Summary – full polygon mesh asset • Mesh can have vertices, faces, edges plus normals • Material shader can have • Color (albedo) •
    [Show full text]
  • Notes on Polygon Meshes 1 Basic Definitions
    CMSC 23700 Introduction to Computer Graphics Handout 2 Autumn 2015 November 12 Notes on polygon meshes 1 Basic definitions Definition 1 A polygon mesh (or polymesh) is a triple (V; E; F ), where V a set of vertices (points in space) E ⊂ (V × V ) a set of edges (line segments) F ⊂ E∗ a set of faces (convex polygons) with the following properties: 1. for any v 2 V , there exists (v1; v2) 2 E such that v = v1 or v = v2. 2. for and e 2 E, there exists a face f 2 F such that e is in f. 3. if two faces intersect in space, then the vertex or edge of intersection is in the mesh. If all of the faces of a polygon mesh are triangles, then we call it a triangle mesh (trimesh). Polygons can be tessellated to form triangle meshes. Definition 2 We classify edges in a mesh based on the number of faces they are part of: • A boundary edge is part of exactly one face. • An interior edge is part of two or more faces. • A manifold edge is part of exactly two faces. • A junction edge is part of three or more faces. Junction edges are to be avoided; they can cause cracks when rendering the mesh. Definition 3 A polymesh is connected if the undirected graph G = (VF ;EE), called the dual graph, is connected, where • VF is a set of graph vertices corresponding to the faces of the mesh and • EE is a set of graph edges connecting adjacent faces.
    [Show full text]
  • Creating Simplified 3D Models with High Quality Textures
    University of Wollongong Research Online Faculty of Engineering and Information Sciences - Faculty of Engineering and Information Sciences Papers: Part A 2015 Creating Simplified 3D oM dels with High Quality Textures Song Liu University of Wollongong, [email protected] Wanqing Li University of Wollongong, [email protected] Philip O. Ogunbona University of Wollongong, [email protected] Yang-Wai Chow University of Wollongong, [email protected] Publication Details Liu, S., Li, W., Ogunbona, P. & Chow, Y. (2015). Creating Simplified 3D Models with High Quality Textures. 2015 International Conference on Digital Image Computing: Techniques and Applications, DICTA 2015 (pp. 264-271). United States of America: The Institute of Electrical and Electronics Engineers, Inc.. Research Online is the open access institutional repository for the University of Wollongong. For further information contact the UOW Library: [email protected] Creating Simplified 3D oM dels with High Quality Textures Abstract This paper presents an extension to the KinectFusion algorithm which allows creating simplified 3D models with high quality RGB textures. This is achieved through (i) creating model textures using images from an HD RGB camera that is calibrated with Kinect depth camera, (ii) using a modified scheme to update model textures in an asymmetrical colour volume that contains a higher number of voxels than that of the geometry volume, (iii) simplifying dense polygon mesh model using quadric-based mesh decimation algorithm, and (iv) creating and mapping 2D textures to every polygon in the output 3D model. The proposed method is implemented in real-Time by means of GPU parallel processing. Visualization via ray casting of both geometry and colour volumes provides users with a real-Time feedback of the currently scanned 3D model.
    [Show full text]
  • Agisoft Photoscan User Manual Standard Edition, Version 1.3 Agisoft Photoscan User Manual: Standard Edition, Version 1.3
    Agisoft PhotoScan User Manual Standard Edition, Version 1.3 Agisoft PhotoScan User Manual: Standard Edition, Version 1.3 Publication date 2017 Copyright © 2017 Agisoft LLC Table of Contents Overview ......................................................................................................................... iv How it works ............................................................................................................ iv About the manual ...................................................................................................... iv 1. Installation and Activation ................................................................................................ 1 System requirements ................................................................................................... 1 GPU acceleration ........................................................................................................ 1 Installation procedure .................................................................................................. 2 Restrictions of the Demo mode ..................................................................................... 2 Activation procedure ................................................................................................... 3 2. Capturing photos ............................................................................................................ 4 Equipment ................................................................................................................
    [Show full text]
  • N Polys Advanced X3D [Autosaved]
    Web3D 2011 Tutorial: Advanced X3D Nicholas Polys: Virginia Tech Yvonne Jung: Fraunhofer IGD Jeff Weekly, Don Brutzman: Naval Postgraduate School Tutorial Outline Recent work in the Web3D Consortium Heading to ISO this month! • X3D : Advanced Features • X3D Basics • Advanced rendering (Yvonne Jung) • Volumes • Geospatial • CAD • Units (Jeff Weekly) • Authoring 2 Open Standards www.web3d.org • Portability • Durability • IP-independence • International recognition and support : the Standard Scenegraph Scene graph for real-time interactive delivery of virtual environments over the web: • Meshes, lights, materials, textures, shaders • Integrated video, audio Event ROUTE • Animation • Interaction • Scripts & Behaviors Sensor • Multiple encodings (ISO = XML, VRML-Classic, Binary) • Multiple Application Programming Interfaces (ISO = ECMA, Java) • X3D 3.3 includes examples for Volume rendering, CAD and Geospatial support! Web3D Collaboration & Convergence W3C ISO OGC - XML - Web3DS - HTML 5 -CityGML - SVG - KML Interoperability Web3D Consortium IETF & Access - Mime types Across Verticals - Extensible 3D (X3D) - Humanoid Animation (H-Anim) - VRML DICOM - N-D Presentation State - DIS - Volume data Khronos - OpenGL, WebGL - COLLADA Adoption Immersive X3D • Virginia Tech Visionarium: VisCube • Multi-screen, clustered stereo rendering • 1920x1920 pixels per wall (x 4) • Infitech Stereo • Wireless Intersense head & wand • Instant Reality 7 VT Visionarium • Output from VMD • Jory Z. Ruscio, Deept Kumar, Maulik Shukla, Michael G. Prisant, T. M. Murali,
    [Show full text]
  • Visualisation and Generalisation of 3D City Models
    Visualisation and Generalisation of 3D City Models Bo Mao August 2010 TRITA SoM 2010-08 ISSN 1653-6126 ISRN KTH/SoM/-10/08/-SE ISBN 978-91-7415-715-4 © Bo Mao 2010 Licentiate Thesis Geoinformatics Division Department of Urban Planning and Environment Royal Institute of Technology (KTH) SE-100 44 STOCKHOLM, Sweden ii Abstract 3D city models have been widely used in different applications such as urban planning, traffic control, disaster management etc. Effective visualisation of 3D city models in various scales is one of the pivotal techniques to implement these applications. In this thesis, a framework is proposed to visualise the 3D city models both online and offline using City Geography Makeup Language (CityGML) and Extensible 3D (X3D) to represent and present the models. Then, generalisation methods are studied and tailored to create 3D city scenes in multi- scale dynamically. Finally, the quality of generalised 3D city models is evaluated by measuring the visual similarity from the original models. In the proposed visualisation framework, 3D city models are stored in CityGML format which supports both geometric and semantic information. These CityGML files are parsed to create 3D scenes and be visualised with existing 3D standard. Because the input and output in the framework are all standardised, it is possible to integrate city models from different sources and visualise them through the different viewers. Considering the complexity of the city objects, generalisation methods are studied to simplify the city models and increase the visualisation efficiency. In this thesis, the aggregation and typification methods are improved to simplify the 3D city models.
    [Show full text]
  • Modeling: Polygonal Mesh, Simplification, Lod, Mesh
    The Modeling-Rendering Paradigm Modeler: Renderer: EECS 487: Interactive Modeling complex shapes Vertex data • no equation For a chair, Face, etc. Fixed function transForm and Vertex shader • instead, achieve complexity using lighting Computer Graphics simple pieces • polygons, parametric surfaces, or Clip, homogeneous divide and viewport Lecture 36: implicit surfaces scene graph Rasterize • Polygonal mesh simplification • with arbitrary precision, in principle Texture stages Fragment shader Fragment merging: stencil, depth 3D Geometry Representations 2D: Range Image Represent different kinds oF inFormation: Image with depth inFormation point data, surface data, volumetric data • acquired From range scanner, incl. MicrosoFt Kinect and Google Tango Points Solids • not a complete 3D description: does not include • 2D: range image • Constructive Solid Geometry part oF object occluded From viewpoint • 3D: point cloud • Voxels Surfaces Procedural • Polygonal mesh • Particle system • Parametric surfaces • Spring-mass system Cyberware • Subdivision surfaces • Fractals • Implicit surfaces Curless Range image Tessellation Range surface Funkhouser Funkhouser, Ramamoorthi 3D: Point Cloud Surfaces Unstructured set oF 3D Boundary representation (B-reps) point samples • sometimes we only care about the surface, e.g., when Acquired From range finder rendering opaque objects and performing geometric computations Disadvantage: no structural inFo • adjacency/connectivity have to use e.g., k-nearest neighbors to compute Increasingly hot topic in graphics/vision
    [Show full text]
  • ISO/IEC JTC 1 N13604 ISO/IEC JTC 1 Information Technology
    ISO/IEC JTC 1 N13604 2017-09-17 Replaces: ISO/IEC JTC 1 Information Technology Document Type: other (defined) Document Title: Study Group Report on 3D Printing and Scanning Document Source: SG Convenor Project Number: Document Status: This document is circulated for review and consideration at the October 2017 JTC 1 meeting in Russia. Action ID: ACT Due Date: 2017-10-02 Pages: Secretariat, ISO/IEC JTC 1, American National Standards Institute, 25 West 43rd Street, New York, NY 10036; Telephone: 1 212 642 4932; Facsimile: 1 212 840 2298; Email: [email protected] Study Group Report on 3D Printing and Scanning September 11, 2017 ISO/IEC JTC 1 Plenary (October 2017, Vladivostok, Russia) Prepared by the ISO/IEC JTC 1 Study Group on 3D Printing and Scanning Executive Summary The purpose of this report is to assess the possible contributions of JTC 1 to the global market enabled by 3D Printing and Scanning. 3D printing, also known as additive manufacturing, is considered by many sources as a truly disruptive technology. 3D printers range presently from small table units to room size and can handle simple plastics, metals, biomaterials, concrete or a mix of materials. They can be used in making simple toys, airplane engine components, custom pills, large buildings components or human organs. Depending on process, materials and precision, 3D printer costs range from hundreds to millions of dollars. 3D printing makes possible the manufacturing of devices and components that cannot be constructed cost-effectively with other manufacturing techniques (injection molding, computerized milling, etc.). It also makes possible the fabrications of customized devices, or individual (instead of identical mass-manufactured) units.
    [Show full text]
  • Moving Web 3D Content Into Gearvr
    Moving Web 3d Content into GearVR Mitch Williams Samsung / 3d-online GearVR Software Engineer August 1, 2017, Web 3D BOF SIGGRAPH 2017, Los Angeles Samsung GearVR s/w development goals • Build GearVRf (framework) • GearVR Java API to build apps (also works with JavaScript) • Play nice with other devices • Wands, Controllers, I/O devices • GearVR apps run on Google Daydream ! • Performance, New Features • Fight for every Millisecond: • Android OS, Oculus, GPU, CPU, Vulkun • Unity, Unreal, GearVRf (framework) • Enable content creation • Game developers, 3D artists, UI/UX people, Web designers Content Creation for GearVR • 360 movies • Game Editors: Unity, Unreal • GearVRf (framework) • Open source Java api, JavaScript bindings • WebVR • WebGL; frameworks: A-frame, Three.js, React, X3Dom • 3d file formats • Collada, .FBX, gltf, .OBJ &.mtl, etc. using Jassimp • Java binding for Assimp (Asset Import Library) • X3D Why implement X3D in GearVR • Samsung began this effort February, 2016 • X3D is a widely supported file format • Exported by 3DS Max, Blender, Maya, Moto • Or exports VRML and converts to X3D • No other file format had similar capabilities. • Interactivity via JavaScript • Declarative format easy to edit / visualize the scene. • GearVR is not just a VR game console like Sony PSVR • We are a phone, web access device, camera, apps platform • X3D enables web applications: • Compliments the game influence in GearVR from Unity, Unreal. • Enables new VR web apps including: Google Maps, Facebook, Yelp JavaScript API’s. GearVR app Build Runtime Live Demo Very daring for the presenter who possesses no art skills. • 3ds Max 1. Animated textured objects 2. Export VRML97, Convert with “Instant Reality” to X3D • Android Studio 1.
    [Show full text]
  • Polygonal Meshes
    Polygonal Meshes COS 426 3D Object Representations Points Solids Range image Voxels Point cloud BSP tree CSG Sweep Surfaces Polygonal mesh Subdivision High-level structures Parametric Scene graph Implicit Application specific 3D Object Representations Points Solids Range image Voxels Point cloud BSP tree CSG Sweep Surfaces Polygonal mesh Subdivision High-level structures Parametric Scene graph Implicit Application specific 3D Polygonal Mesh Set of polygons representing a 2D surface embedded in 3D Isenberg 3D Polygonal Mesh Geometry & topology Face Edge Vertex (x,y,z) Zorin & Schroeder Geometry background Scene is usually approximated by 3D primitives Point Vector Line segment Ray Line Plane Polygon 3D Point Specifies a location Represented by three coordinates Infinitely small typedef struct { Coordinate x; Coordinate y; Coordinate z; } Point; (x,y,z) Origin 3D Vector Specifies a direction and a magnitude Represented by three coordinates Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz) Has no location typedef struct { (dx,dy,dz) Coordinate dx; Coordinate dy; Coordinate dz; } Vector; 3D Vector Dot product of two 3D vectors V1·V2 = ||V1 || || V2 || cos(Θ) (dx1,dy1,dz1) Θ (dx2,dy2 ,dz2) 3D Vector Cross product of two 3D vectors V1·V2 = (dy1dx2 - dz1dy2, dz1dx2 - dx1dz2, dx1dy2 - dy1dx2) V1xV2 = vector perpendicular to both V1 and V2 ||V1xV2|| = ||V1 || || V2 || sin(Θ) (dx1,dy1,dz1) Θ (dx2,dy2 ,dz2) V1xV2 3D Line Segment Linear path between two points Parametric representation: » P = P1 + t (P2 - P1),
    [Show full text]