3D Distance from a Point to a Triangle

Similar documents
Vector Notation: AB represents the vector from point A to point B on a graph. The vector can be computed by B A.

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

Common Core Unit Summary Grades 6 to 8

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

Solving Simultaneous Equations and Matrices

Automatic 3D Reconstruction via Object Detection and 3D Transformable Model Matching CS 269 Class Project Report

Angle - a figure formed by two rays or two line segments with a common endpoint called the vertex of the angle; angles are measured in degrees

Interactive 3D Medical Visualization: A Parallel Approach to Surface Rendering 3D Medical Data

Triangle Scan Conversion using 2D Homogeneous Coordinates

Introduction to Computer Graphics

Shape Dictionary YR to Y6

Figure 1.1 Vector A and Vector F

INTRODUCTION TO RENDERING TECHNIQUES

Geometry: Unit 1 Vocabulary TERM DEFINITION GEOMETRIC FIGURE. Cannot be defined by using other figures.

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur

Geometry of Vectors. 1 Cartesian Coordinates. Carlo Tomasi

Solving Geometric Problems with the Rotating Calipers *

Using Photorealistic RenderMan for High-Quality Direct Volume Rendering

Computer Graphics CS 543 Lecture 12 (Part 1) Curves. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

MATHS LEVEL DESCRIPTORS

COMPARISON OF TWO DIFFERENT SURFACES FOR 3D MODEL ABSTRACTION IN SUPPORT OF REMOTE SENSING SIMULATIONS BACKGROUND

[G.CO.2, G.CO.4, G.CO.5]

Mean Value Coordinates

Algebra Geometry Glossary. 90 angle

Section 1.1. Introduction to R n

1 Symmetries of regular polyhedra

Equations Involving Lines and Planes Standard equations for lines in space

Teacher Page. 1. Reflect a figure with vertices across the x-axis. Find the coordinates of the new image.

Rendering Microgeometry with Volumetric Precomputed Radiance Transfer

Geometry and Measurement

Lecture 9: Geometric map transformations. Cartographic Transformations

Content. Chapter 4 Functions Basic concepts on real functions 62. Credits 11

GeoGebra. 10 lessons. Gerrit Stols

New York State Student Learning Objective: Regents Geometry

SOLIDS, NETS, AND CROSS SECTIONS

Generating Signed Distance Fields From Triangle Meshes IMM-TECHNICAL REPORT

A Short Introduction to Computer Graphics

521493S Computer Graphics. Exercise 2 & course schedule change

Geometric algebra rotors for skinned character animation blending

Degree Reduction of Interval SB Curves

Realtime 3D Computer Graphics Virtual Reality

The Essentials of CAGD

Such As Statements, Kindergarten Grade 8

Current Standard: Mathematical Concepts and Applications Shape, Space, and Measurement- Primary

WORK SCHEDULE: MATHEMATICS 2007

EDEXCEL NATIONAL CERTIFICATE/DIPLOMA MECHANICAL PRINCIPLES AND APPLICATIONS NQF LEVEL 3 OUTCOME 1 - LOADING SYSTEMS

Geometric Camera Parameters

Part-Based Recognition

Chapter 8 Geometry We will discuss following concepts in this chapter.

CAMI Education linked to CAPS: Mathematics

Orthogonal Projections

Robust NURBS Surface Fitting from Unorganized 3D Point Clouds for Infrastructure As-Built Modeling

What's the Spin? - Discover Properties of Geometric Rotations

Virtual Resection with a Deformable Cutting Plane

a.) Write the line 2x - 4y = 9 into slope intercept form b.) Find the slope of the line parallel to part a

University of Tampere Computer Graphics 2013 School of Information Sciences Exercise

2. If C is the midpoint of AB and B is the midpoint of AE, can you say that the measure of AC is 1/4 the measure of AE?

Impedance Matching. Using transformers Using matching networks

Angles that are between parallel lines, but on opposite sides of a transversal.

FOREWORD. Executive Secretary

11.1. Objectives. Component Form of a Vector. Component Form of a Vector. Component Form of a Vector. Vectors and the Geometry of Space

12.5 Equations of Lines and Planes

KEANSBURG SCHOOL DISTRICT KEANSBURG HIGH SCHOOL Mathematics Department. HSPA 10 Curriculum. September 2007

Essential Mathematics for Computer Graphics fast

THREE DIMENSIONAL GEOMETRY

1. Abstract 2. Introduction 3. Algorithms and Techniques

Welcome to Math 7 Accelerated Courses (Preparation for Algebra in 8 th grade)

12-1 Representations of Three-Dimensional Figures

Bedford, Fowler: Statics. Chapter 4: System of Forces and Moments, Examples via TK Solver

A HYBRID APPROACH FOR AUTOMATED AREA AGGREGATION

alternate interior angles

Pre-Algebra Academic Content Standards Grade Eight Ohio. Number, Number Sense and Operations Standard. Number and Number Systems

Copyright 2011 Casa Software Ltd. Centre of Mass

Behavioral Animation Modeling in the Windows Environment

Prentice Hall Algebra Correlated to: Colorado P-12 Academic Standards for High School Mathematics, Adopted 12/2009

The Dot and Cross Products

Georgia Standards of Excellence Curriculum Map. Mathematics. GSE 8 th Grade

Number Sense and Operations

Vectors 2. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

Geometric Transformation CS 211A

Hyperbolic Islamic Patterns A Beginning

CREATING 3D digital content for computer games,

Questions. Strategies August/September Number Theory. What is meant by a number being evenly divisible by another number?

Geometry Course Summary Department: Math. Semester 1

Biggar High School Mathematics Department. National 5 Learning Intentions & Success Criteria: Assessing My Progress

egyptigstudentroom.com

Big Ideas in Mathematics

GEOMETRY CONCEPT MAP. Suggested Sequence:

Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks

Machine Learning and Data Mining. Regression Problem. (adapted from) Prof. Alexander Ihler

Dual Marching Cubes: Primal Contouring of Dual Grids

Finite Elements for 2 D Problems

39 Symmetry of Plane Figures

Torgerson s Classical MDS derivation: 1: Determining Coordinates from Euclidean Distances

Computational Geometry. Lecture 1: Introduction and Convex Hulls

How To Create A Surface From Points On A Computer With A Marching Cube

9 MATRICES AND TRANSFORMATIONS

Basic Understandings

Problem set on Cross Product

Visualization of General Defined Space Data

Transcription:

3D Distance from a Point to a Triangle Mark W. Jones Technical Report CSR-5-95 Department of Computer Science, University of Wales Swansea February 1995 Abstract In this technical report, two different methods for calculating the distance between a point and a triangle in 3D space will be described. It will be shown that it is far more efficient to calculate the distance by using a rotation to make the problem 2D. Both methods are tested with relation to the production of 3D data from polygonal meshes (voxelisation). 1 Introduction The problem of finding the distance from a point to a triangle in 3D space arose with repsect to producing 3D data from a polygonal mesh. In this case the input to the process of voxelisation [1] is a triangular mesh, and the output is voxel data a 3D array of data values. Voxelisation is needed to overlay synthetic objects into collected data. For examples with application to the integration of objects and medical data see Wang and Kaufman [2] and for the integration of objects with terrain data for flight simulation see Cohen and Gotsman [3]. The problem is that of finding the distance from a point È to a triangle È ½ È ¾ È, where È is a point in three dimensional space. This is more difficult than it seems at first due to the different possibilities that exist. The point È could be closest to the plane of the triangle, closest to an edge, or closest to a vertex. In Section 2 a method of calculating that distance in 3D is given, and in Section 3 a method which reduces the problem to 2D is described. Section 4 presents results demonstrating that the 2D method is more efficient than the 3D method. 2 3DMethod Approaching the problem in three dimensions requires the projection of È onto the plane of triangle È ½ È ¾ È to create È (Figure 1). N p V2 P2 P 3 P 2 α P3 P 1 V3 V 1 P 1 Figure 1: Calculating the distance of È from È ½ È ¾ È. 1

The normal Æ Ô of È ½ È ¾ È can be calculated as The angle, «between the normal Æ Ô and È ½ È is calculated Æ Ô È ½ È ¾ È ½ È (1) Ó «È ½È Æ Ô È ½ È Æ Ô The length of the vector È È can be found using (2) È È È È ½ Ó «(3) The vector È È can then be determined È È È È ÆÔ ÆÔ (The negative sign is used since È È has direction opposite to that of Æ Ô.) È can then be calculated as (4) È È È È (5) If it was the case that the projection of È onto the plane lay within the triangle È ½ È ¾ È,the length È È (Equation 3) would be the distance of È from È ½ È ¾ È. If instead È falls outside the triangle, the distance to the triangle is the distance to the closest edge or vertex to È. In order to determine which edge or vertex È is closest to, the position of È in relation to the three vectors Î ½, Î ¾ and Î must be found, (Figure 1) where Î ½ È ¾È ½ È ¾ È ½ È È ½ È È ½ Î ¾ È È ¾ È È ¾ È½È ¾ È ½ È ¾ Î È ½È È ½ È È¾È È ¾ È If ½ Î ½ È ½ È µ Æ Ô,then ½ if È is anticlockwise of Î ½. Similarly, ¾ and can be calculated for the other vectors. Using ½, ¾ and the position of È in relation to the vectors Î ½, Î ¾ and Î can be determined. It further has to be determined if È is inside the triangle, and if so the distance from the triangle is the distance calculated in Equation 3. If È is clockwise of Î ¾ and anticlockwise of Î ½, it is outside the triangle if È È ½ È È ¾µ Æ Ô (7) and similarly for the other cases. If È is found to be outside the triangle, it is either closest to a vertex, or the side. For example, assume È is closest to È ½È ¾. (it is easy to apply the following to the remaining edges) The direction Ê, ofè to È is given by (6) and the angle is Ê È È ¾ È È ½µ È ½ È ¾ (8) The length È È is calculated using Ó È È ½ Ê È È ½ Ê (9) and È È is È È È È ½ Ó (10) 2

È È È È Ê Ê The point È, which is the projection of È onto the line È ½È ¾ is (11) È È È È (12) Let Ø È È ½ (13) È ¾ È ½ If Ø ½, È is between È ½ and È ¾ and the distance of È from the line is È È as calculated in Equation 10. The distance of È to È ½ È ¾ is Ô È È ¾ È È ¾ µ. If Ø, È is closest to vertex È ½ and can be calculated as the distance È ½ È. If Ø ½, È is closest to È ¾. Therefore the distance of È to È ½ È ¾ È has been calculated. It should be noted that Equations 1 and 6 can be precalculated for efficiency. 3 2DMethod The second approach is that of converting the problem into a two dimensional problem. The simplest way to achieve this is by calculating the translation and rotation matrix to rotate the triangle È ½ È ¾ È so that È ½ lies on the origin, È ¾ liesontheþ axis, and È lies in the ÝÞ plane. This transformation matrix can be calculated once for each triangle in a preproccessing step, and can then be used to transform È to È. È can be trivially projected onto the triangles plane giving È by ignoring its Ü coordinate since the triangle is in the ÝÞ plane. If È is inside the triangle È ½ È ¾ È, the distance from the point to the triangle is simply the Ü coordinate of È. Using È, determination of the closest part of triangle È ½ È ¾ È to È can be found by using the edge equation [4], and once determined the distance can be found in a standard way. The edge equation is simply: Ü Ýµ Ü µ Ý µ (14) for a line passing through µ with gradient with respect to a point Ü Ýµ. If the point is to the left of the line, if to the right, and if, it is on the line. In Figure 2 we see the different possibilities. P 31 P 3 P 11 P 1 Figure 2: Calculating point position relative to triangle. If È is left of È È ½ it is closest to È È ½ if it is to the right of È È ½ and to the left of È ½ È ½½. The proximity to the other edges of the triangle can be similarly determined. For È to be closest to vertex È ½ it must be right of È ½ È ½½ and left of È ½ È ½¾, where È ½ È ½¾ is defined at right 3

angles to È ½ È ¾. Using just these edge equations, the closest vertex or edge of È ½ È ¾ È to È can be determined. The lines È ½ È ½½, È ½ È ½¾, È È ½, È È ¾, etc. and their directions can be precomputed, thus enabling simple applications of the edge equation to determine which part of the triangle the point È is closest to. Once determined, the distance can be calculated to that part in the normal way. 4 Results The voxelisation process was implemented as in [1], with two distance functions one the 3D version of Section 2, and one the 2D version of Section 3. The voxelisation process was carried out using both distance functions, and times were compared for various datasets. It can be seen from Table 1 that the 2D method was consistently faster than the 3D method, and in fact took a quarter of the time to compute the same dataset. The reason for such a marked difference in computation times could be put down to the number of square roots that must be computed. For the 3D method four square roots are required ( È ½ È, Ê, È È ½ and È È ), as opposed to one final distance calculation square root for the 2D method. Data set No. of Distance Time taken Ratio triangles computations 2D method 3D method 3D 2D Octahedron 8 99576 1.017 2.917 2.87 Dodecahedron 36 1170754 8.016 33.949 4.24 Soccerball 116 3850470 25.649 111.496 4.35 Teapot 252 5717484 38.032 159.744 4.20 King 3080 17740398 144.294 519.546 3.60 Queen 2600 16378497 130.028 491.447 3.78 Bishop 2360 14092809 114.112 410.334 3.60 Pawn 1600 14791639 116.912 420.033 3.59 Knight 1524 10191575 86.113 286.889 3.33 Rook 1600 18501156 144.544 541.462 3.75 Table 1: Table showing voxelization timings In conclusion, a two dimensional method for computing the distance of a point from a triangle has been compared against a standard three dimensional method. The results indicate that the two dimensional method performs far more efficiently than the three dimensional method, and is suited for any application where distance measurements to three dimensional triangles are required. The method was tested with particular attention to the process of voxelisation, which requires intensive use of point to triangle measurement. References [1] M. W. Jones. Voxelisation of polygonal meshes. In Proceedings of 13th Annual Conference of Eurographics (UK Chapter) (Loughborough, March 28-30, 1995), pages 160 171, March 1995. [2] S. W. Wang and A. E. Kaufman. Volume sampled voxelization of geometric primitives. In Proc. Visualization 93, pages 78 84. IEEE CS Press, Los Alamitos, Calif., 1993. [3] D. Cohen and C. Gotsman. Photorealistic terrain imaging and flight simulation. IEEE Computer Graphics and Applications, 14(2):10 12, March 1994. 4

[4] J. Pineda. A parallel algorithm for polygon rasterization. In Proc. SIGGRAPH 88 (Atlanta, Georgia, August 1-5, 1988), volume 22(4), pages 17 20. ACM SIGGRAPH, New York, August 1988. 5