Introduction to Computational Geometry - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Introduction to Computational Geometry

Description:

Introduction to Computational Geometry Hackson Leung_at_HW311 Intersections How to find the intersection point, if any? Cartesian coordinate geometry Given K straight ... – PowerPoint PPT presentation

Number of Views:513
Avg rating:3.0/5.0
Slides: 43
Provided by: Hack60
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Computational Geometry


1
Introduction to Computational Geometry
  • Hackson Leung_at_HW311

2
Agenda
  • Dot, Line and Plane
  • Cartesian Coordinate System
  • Straight Line and Segment
  • Distance how to measure?
  • Cartesian Coordinate Geometry
  • Vector Geometry
  • Intersections
  • Polygons

3
DOT, LINE AND PLANE
  • To begin with

4
Geometry
  • Geometry (Greek ?e?µet??a geo earth, metria
    measure) is a part of mathematics concerned
    with questions of size, shape, and relative
    position of figures and with properties of
    space. Wikipedia
  • What to deal with?
  • Lines
  • Polygons
  • Planes
  • Objects (in N dimensional!)

5
Geometry
  • Geometry (Greek ?e?µet??a geo earth, metria
    measure) is a part of mathematics concerned
    with questions of size, shape, and relative
    position of figures and with properties of
    space. Wikipedia
  • What to deal with (Computationally)?
  • Lines
  • Polygons
  • Planes
  • Objects (in N dimensional!)

6
Simple geometry revisit
  • 1-Dimensional
  • Simply R
  • a single point and line only
  • e.g. Number Line
  • 2-Dimensional
  • 2-tuple (a.k.a. pair)
  • Can represent point, line and plane
  • 3-Dimensional
  • 3-tuple (a.k.a. Triple)
  • Can represent?

7
Computational Geometry
  • Adopt algorithmic approach to solve problems in
    terms of geometry
  • e.g. List out all possible distinct intersection
    points, given several lines
  • In this session, we only focus on 2-D geometry
    only
  • Further info can be found at Advanced
    Computational Geometry

8
CARTESIAN COORDINATESYSTEM
  • You must have learnt it in Mathematics

9
Cartesian Coordinate System
  • Terminologies
  • Dont tell me that you dont know them!

y-axis
A point with ve x and y coordinates
x-axis
10
Cartesian Coordinate System
  • Terminologies
  • Dont tell me that you dont know them!

y-axis
A straight line with negative slope, passing
through origin
x-axis
11
Cartesian Coordinate System
  • Terminologies
  • Dont tell me that you dont know them!

y-axis
A regular pentagon
x-axis
12
Cartesian Coordinate System
  • You may not know this

y-axis
Two straight lines intersecting at one point
x-axis
13
Cartesian Coordinate System
  • You may not know this

y-axis
A straight line intersects the pentagon at two
points
x-axis
14
Cartesian Coordinate System
  • So how to deal with
  • Learn more and you will know

15
LINE AND SEGMENT
  • Diversify

16
Line and Segment
  • Line infinitely long
  • Segment Finite region within the line
  • Line is a more general representation of any line
    segment within itself

17
DISTANCE
  • Way to describe how far we are

18
Distance
  • Problem Given two points, how far are they?
  • Use ruler to measure
  • In computer, no way!
  • Not precise enough!

Length l
P2 (x2, y2)
P1 (x1, y1)
19
Distance
  • Problem Given two points, how far are they?
  • If we do not care about the actual distance
  • Think about that the world is full of grids
  • And you can only walk on their sides
  • The famous Manhattan Distance

Length l
P2 (x2, y2)
P1 (x1, y1)
20
Distance
  • Problem Given two points, how far are they?
  • If we do care about the actual distance
  • Manhattan distance gives us a brief idea to
    calculate the actual distances
  • If you have learnt Pythagorass Theorem
  • Euclidean Distance

P2 (x2, y2)
Length l
b y2 y1
P1 (x1, y1)
a x2 x1
21
Distance
  • Problem Given a line segment, how long is it?
  • Treat the two ends as points
  • Go back to last slide

22
Distance
  • Problem Given two line segments, which one
  • is the longest?
  • Easy
  • Euclidean Distance
  • Apply Pythagorass Theorem
  • Compare the length
  • Really that easy?

23
Distance
  • Problem Given two line segments, which one
  • is the longest?
  • Difficulties
  • Length of segment A v4 2
  • Length of segment B 1.9999999
  • In computer, it may turn out that A B!
  • Known as precision error
  • Cure
  • Use Manhattan Distance (does it work?)
  • LA gt LB ? LA2 gt LB2 when LA and LB are
    non-negative

24
CARTESIAN COORDINATEGEOMETRY
  • x, y and z

25
Coordinate Geometry
  • Basically from Cartesian Coordinate System
  • How to describe
  • A point?
  • (x, y) Coordinates for 2D
  • A line?
  • Straight line equation
  • A line segment?
  • Straight line equation, plus range of x and y
  • Two points form a segment

26
Coordinate Geometry
  • For straight line, we need to know its slope
  • Given two points on the line
  • slope m change of y value / change of x value
  • What if x 0?
  • Common representation point-slope form
  • (y-y1) m(x-x1)
  • Always possible to represent?
  • Another choice two-point form
  • y - y1 / x x1 y1 y2 / x1 x2
  • If x1 x2, then?

27
VECTOR GEOMETRY
  • Arrows World

28
Vector Geometry
  • What is a vector?
  • Geometric object which has both magnitude and
    direction (think of line segment)
  • A notation of means a motion from A to B
  • Notation (x, y) means a point P from O (0, 0) to
  • (x, y) (Note the terminology!)

29
Vector Geometry
  • Properties
  • Length of vector
  • Addition (x1, y1) (x2, y2) (x3, y3)
  • Subtraction Reverse addition only

30
Vector Geometry
  • Properties
  • Multiplication
  • Dot Product (x1, y1)? (x2, y2) x1x2 - y1y2
  • Projection of (x1, y1) under (x2, y2) with
    product of their length
  • Wedge Product (x1, y1)(x2, y2) x1y2 - y1x2
  • Dot Product on itself?
  • Wedge Product on itself?

31
Vector Geometry
  • Straight line equation
  • Describe any vectors r that end on a line u,
    which passes through r0(a, b) and parallel to
    r1(c, d)
  • u r r0 tr1 , t is any real number

32
INTERSECTIONS
  • When lines hit

33
Intersections
  • Recall the previous problem
  • How to find the intersection point, if any?

34
Intersections
  • How to find the intersection point, if any?
  • Cartesian coordinate geometry
  • Given K straight line equations, find all
    distinct intersection point(s)
  • Usually a line is defined by giving two arbitrary
    points which are on the line
  • How to represent its equation?
  • What if a line is a vertical line?

35
Intersections
  • How to find the intersection point, if any?
  • Cartesian coordinate geometry
  • Given 2 straight line equations, find all
    distinct intersection point(s)
  • HKOI1998 Junior Q1 Simultaneous Equations
  • How about K lines?

36
Intersections
  • How to find the intersection point, if any?
  • Vector geometry
  • Given 2 straight line equations, find all
    distinct intersection point(s)
  • Need to find their equations?
  • Two vectors are formed, let them be AB and CD
  • We let vector itself be a line
  • In general, r0 OA, r1 AB

37
Intersections
  • How to find the intersection point, if any?
  • Vector geometry
  • Given 2 straight line equations, find all
    distinct intersection point(s)
  • Two vectors are formed, let them be AB and CD

38
Intersections
  • How to find the intersection point, if any?
  • Vector geometry
  • Clearly, produces the intersection
    point
  • What if is zero?
  • Parallel but not the same line
  • Parallel but they are on the same line
  • How about the segment intersection?

39
POLYGON
  • Optional topic

40
Polygon
  • If time allows, we would discuss the following
    topics
  • Polygon Convex or Concave
  • Is a point inside or outside a polygon?
  • Given N points, can I find a minimum bounded
    polygon that includes those points?
  • I have two convex polygons, tell me their
    intersection area
  • I have two polygons, tell me if they can combine
    to a single polygon through rotation and
    translation

41
Practice Problems
  • HKOJ2071 Little Stage
  • HKOJ2074 Storage Centre
  • HKOJ2980 Simultaneous Equation

42
QA
  • Remember TFT is coming!
Write a Comment
User Comments (0)
About PowerShow.com