0% found this document useful (0 votes)
17 views1 page

2 Quad

Uploaded by

vishu2125
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

2 Quad

Uploaded by

vishu2125
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

2 Quad-trees

A quadtree is a particular type of tree in which each leaf-node is labelled by a value and each non-leaf
node has exactly four children. It is used most often to partition a two dimensional space (e.g., a
pixelated image) by recursively dividing it into four quadrants. Formally, a quadtree can be defined to be
either a single node with a number or value (e.g., in the range 0 to 255), or a node without a value but
with four quadtree children: lu, ll, ru, and rl. It can thus be defined “inductively” by the following rules:
Definition. A quad tree is either (Rule 1) a root node with a value, or (Rule 2) a root node without a value
and four quad tree children: lu, ll, ru, and rl. in which Rule 1 is the “base case” and Rule 2 is the
“induction step”. We say that a quadtree is primitive if it consists of a single node/number, and that can
be tested by the corresponding condition: • isValue(qt), which returns true if quad-tree qt is a single
node. To build a quad-tree we have two constructors: • baseQT(value), which returns a single node
quad-tree with label value. • makeQT(luqt, ruqt, llqt, rlqt), which builds a quad-tree from four
constituent quadtrees luqt, llqt, ruqt, rlqt. 32 Then to extract components from a quad-tree we have
four selectors: • lu(qt), which returns the left-upper quad-tree. • ru(qt), which returns the right-upper
quad-tree. • ll(qt), which returns the left-lower quad-tree. • rl(qt), which returns the right-lower quad-
tree. which can be applied whenever isValue(qt) is false. For cases when isValue(qt) is true, we could
define an operator value(qt) that returns the value, but conventionally we simply say that qt itself is the
required value. Quad-trees of this type are most commonly used to store grey-value pictures (with 0
representing black and 255 white). A simple example would be: 10 20 40 30 50 60 70 80 110 100 120 90
0 We can then create algorithms using the operators to perform useful manipulations of the
representation. For example, we could rotate a picture qt by 180◦ using: rotate(qt) { if ( isValue(qt) )
return qt else return makeQT( rotate(rl(qt)), rotate(ll(qt)), rotate(ru(qt)), rotate(lu(qt)) ) } or we could
compute average values by recursively averaging the constituent sub-trees. There exist numerous
variations of this general idea, such coloured quadtrees which store value-triples that represent colours
rather than grey-scale, and edge quad-trees which store lines and allow curves to be represented with
arbitrary precision

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy