1 Hierarchical and Object-Oriented Graphics • Construct complex models from a set of simple geometric objects • Extend the use of transformations to include hierarchical relationships • Useful for characterizing relationships among model parts in applications such as robotics and figure animations.
70
Embed
1 Hierarchical and Object-Oriented Graphics Construct complex models from a set of simple geometric objects Extend the use of transformations to include.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
Hierarchical and Object-Oriented Graphics
• Construct complex models from a set of simple geometric objects
• Extend the use of transformations to include hierarchical relationships
• Useful for characterizing relationships among model parts in applications such as robotics and figure animations.
2
Symbols and Instances
• A non-hierarchical approach which models our world as a collection of symbols.
• Symbols can include geometric objects, fonts and other application-dependent graphical objects.
• Use the following instance transformation to place instances of each symbol in the model.
• The transformation specify the desired size, orientation and location of the symbol.
TRSM
3
Example
4
Hierarchical Models
• Relationships among model parts can be represented by a graph.
• A graph consists of :- A set of nodes or vertices.- A set of edges which connect pairs of nodes.
• A directed graph is a graph where each of its edges has a direction associated with it.
5
Trees and DAG: Trees
• A tree is a directed graph without closed paths or loops.
• Each tree has a single root node with outgoing edges only.
• Each non-root node has a parent node from which an edge enters.
• Each node has one or more child nodes to which edges are connected.
• A node without children is called a terminal node or leaf.
6
Trees and DAGS: Trees
root node
node
edge
leaf
7
Example
8
Trees and DAG: DAG
• Storing the same information in different nodes is inefficient.
• Use a single prototype for multiple instances of an object and replace the tree structure by the directed acyclic graph (DAG).
• Both trees and DAG are hierarchical methods of expressing relationships.
9
Example: A Robot Arm• The robot arm is modeled using three simple objects.
• The arm has 3 degrees of freedom represented by the 3 joint angles between components.
• Each joint angle determines how to position a component with respect to the others.
10
Robot Arm: Base
• The base of the robot arm can rotate about the y axis by the angle .
• The motion of any point p on the base can be described by applying the rotation matrix )(yR
11
Robot Arm: Lower Arm
• The lower arm is rotated about the z-axis by an angle , which is represented by
• It is then shifted to the top of the base by a distance , which is represented by .
• If the base has rotated, we must also rotate the lower arm using .
• The overall transformation is .
)(zR
1h)0,,0( 1hT
)(yR
)()0,,0()( 1 zy h RTR
12
Robot Arm: Upper Arm
• The upper arm is rotated about the z-axis by the angle , represented by the matrix .
• It is then translated by a matrix relative to the lower arm.
• The previous transformation is then applied to position the upper arm relative to the world frame.
• Constructive solid geometry (CSG) operates on a set of solid geometric entities instead of surface primitives.
• Uses three operations: union, intersection, and set difference:- AB consists of all points in either A or B.- AB consists of all points in both A and B.- A-B consists of all points in A which are not in B.
56
CSG Trees (3)
57
CSG Trees (3)
• The algebraic expressions are stored and parsed using expression trees.- Internal nodes store operations.- Terminal nodes store operands.
• The CSG tree is evaluated by a post-order traversal.
58
CSG Trees (4)
- Example
Extracted from Foley et al.’s book
59
CSG Trees (5)- Example
CSG does not provide unique representation
Extracted from Foley et al.’s book
60
Spatial Partitioning Representation (SPR) – Cell Decomposition• Each cell-decomposition system defines a set of primitives
cells that are typically parameterized• “Gluing” them together
Extracted from Foley et al.’s book
61
SPR – Spatial-Occupancy Enumeration
• Special case of cell decomposition• Decomposed into identical cells arranged in a fixed, regular
grid
Extracted from Foley et al.’s book
62
SPR – Quadtrees and Octrees (2)
• A hierarchical variant of spatial-occupancy enumeration• Designed to address approach’s demanding storage
requirements• Use separating planes and lines parallel to the coordinate
axes.• For a quadtree, each parent node has four child nodes.• For an octree (derived from quadtrees), each parent node has
eight child nodes.
Extracted from Foley et al.’s book
63
SPR – Quadtrees and Octrees (3)
• Successive subdivision can be represented as a tree with partially full quadrants (P), full (F) and empty (E)
• No standard for assigning quadrant numbers (0-3)
Extracted from Foley et al.’s book
64
SPR – Quadtrees and Octrees (4)
• Octree is similar to the quandtree, except that its three dimensionals are recursively subdivided into octant.
Extracted from Foley et al.’s book
65
SPR – Quadtrees and Octrees (5)• Boolean set operations
Extracted from Foley et al.’s book
S T
TS TS
66
SPR – Binary Space-Partitioning (BSP) Trees (1)
• Recursively divide space into a pairs of subspaces, each separated by a plane of arbitrary orientation and position.
• Originally, used in determining visible surface in graphics
View point
67
SPR – Binary Space-Partitioning (BSP) Trees (2)• Rendering of a set of polygons using binary spatial-partition tree (BSP tree)
• Plane A separates polygons into two groups- B,C in front of A- D,E and F behind A.
• In the BSP tree- A is at the root.- B and C are in the left subtree.- D, E and F are in the right subtree.
68
SPR – Binary Space-Partitioning (BSP) Trees (3)
• Proceeding recursively- B is in front of C- D separates E and F
• In the 2 BSP sub-trees- B is the left child of C- E and F are the left and right of D respectively
69
SPR – Binary Space-Partitioning (BSP) Trees (4)
• Later to represent arbitrary polyhedra.• Each internal node is associated with a plane and has two
child pointers – one for each side • If the half-space on a side of the plane is subdivided further,
its child is the root of a subtree• If the half-space is homogenous, its child is a leaf,
representing a region either entirely inside or entirely outside, labeled as “in” or “out”
70
Comparison of Representations
• Accuracy- Spatial-partitioning – only an approximation- CSG – high
• Uniqueness- Octree and spatial-occupancy-enumeration – unique- CSG – not