• No results found

8.2 Transformace, množinové operace

N/A
N/A
Protected

Academic year: 2021

Share "8.2 Transformace, množinové operace"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

8.2

Transformace, mnoˇ

zinov´

e operace

8.2.1

Transformace

Posunut´ı, otoˇ

cen´ı a zmˇ

ena rozmˇ

er˚

u umoˇ

nuj´ı efektivn´ı pr´

aci s objekty. Je jednoduˇsˇs´ı

um´ıstit objekt v poˇ

zadovan´

ych rozmˇ

erech do poˇ

atku soustavy souˇradn´

e a aˇ

z pot´

e

jej pomoc´ı transformac´ı um´ıstit do poˇ

zadovan´

e polohy. Zmˇ

ena rozmˇ

er˚

u se obvykle

pouˇ

z´ıv´

a pro cel´

e skupiny objekt˚

u nebo i textury.

Na jeden objekt m˚

zeme pouˇ

z´ıt kombinaci nˇ

ekolika transformac´ı (i stejn´

eho druhu),

aleˇ

z´ı ale na jejich poˇrad´ı! Posunut´ım a n´

asledn´

ym otoˇ

cen´ım um´ıst´ıme objekt jinam

neˇ

z otoˇ

cen´ım a posunut´ım.

Rotate

Otoˇ

cen´ı objektu kolem jednotliv´

ych souˇradn´

ych os ve stupn´ıch.

teleso{souradnicerotate< x, y, z >}

Scale

Zmˇ

ena rozmˇ

er˚

u objektu ve smˇ

eru jednotliv´

ych souˇradn´

ych os.

teleso{souradnicescale< x, y, z >}

Translate

Posunut´ı objektu ve smˇ

eru vektoru

< x, y, z >

.

teleso{souradnicetranslate< x, y, z >}

r.

Kv´

adr - rozd´ıl v poˇrad´ı transformac´ı.

#include ”colors.inc”

#include ”osy.inc”// nacteni souradnych os z prvniho cviceni camera{location<5,6,−15>look at<5,6,0>}

light source{<0,20,0>color rgb .7}

light source{<0,0,−50>color rgb 1 shadowless} background{color White}

box{<0,0,1>, <3,3,6> translate<10,0,0>rotate<0,0,45> pigment{color Red}} box{<0,0,1>, <3,3,6> rotate<0,0,45>translate<10,0,0> pigment{color Green}}

(2)

8.2.2

Mnoˇ

zinov´

e operace CSG

Odpov´ıdaj´ı mnoˇ

zinov´

ym operac´ım definovan´

ym v matematice — sjednocen´ı, pr˚

unik,

rozd´ıl. Umoˇ

nuj´ı ze z´

akladn´ıch jednoduch´

ych tˇ

eles vytv´

aˇret sloˇ

zit´

e objekty, kter´

e je

moˇ

zn´

e d´

ale modifikovat jako jeden celek (barva, povrch, textury, optick´

e vlastnosti,

posunut´ı, otoˇ

cen´ı, zmˇ

ena mˇ

eˇr´ıtka).

Pozn´

amka 8.2.1

nastaven´ı prostˇ

red´ı pro n´

asleduj´ıc´ı pˇ

r´ıklady:

camera

{

location

<

0

,

1

,

−4

>

look at

< .

3

,

1

.

3

,

0

>

}

light source

{

<

0

,

3

,

−5

>

color rgb 1 shadowless

}

background

{

color rgb 1

}

Union

Definice 8.2.1

Prvek patˇ

r´ı do sjednocen´ı dvou nebo v´ıce mnoˇ

zin pr´

avˇ

e tehdy, kdyˇ

z

patˇ

r´ı do alespoˇ

n jedn´

e ze sjednocovan´

ych mnoˇ

zin.

Pozn´

amka 8.2.2 (PovRAY)

Z jednotliv´

ych tˇ

eles vytvoˇ

r´ıme jeden celek, se kter´

ym

ale pracujeme.

union{teleso1 teleso2 teleso3[OBJ ECT M ODIF IERS...]}

r.

sjednocen´ı kv´

adru s vrcholy

V

1

(0

,

0

,

0),

V

2

(1

,

2

,

1) a koule o stˇredu

S

(1

,

2

,

1)

a polomˇ

eru

r

= 1, v´

ysledek je pootoˇ

cen, rozmˇ

erovˇ

e deformov´

an a posunut

union{ box{<0,0,0>, <1,2,1>} sphere{<1,2,1>,1} pigment{color rgb<1,0,0>} rotate<0,60,0> scale<1.5, .9,1> translate<−1.5,0,0> }

(3)

r.

pr˚

unik kv´

adru s vrcholy

V

1

(0

,

0

,

0),

V

2

(1

,

2

,

1) a koule o stˇredu

S

(1

,

2

,

1) a

po-lomˇ

eru

r

= 1, v´

ysledek je pootoˇ

cen, rozmˇ

erovˇ

e deformov´

an a posunut

intersection{ box{<0,0,0>, <1,2,1>} sphere{<1,2,1>,1} pigment{color rgb<1,0,0>} rotate<0,60,0> scale<1.5, .9,1> translate<−1.5,0,0> }

Difference

Definice 8.2.3

Prvek patˇ

r´ı do rozd´ılu dvou nebo v´ıce mnoˇ

zin pr´

avˇ

e tehdy, kdyˇ

z patˇ

r´ı

jenom do prvn´ı mnoˇ

ziny ale ne do dalˇ

s´ıch mnoˇ

zin rozd´ılu.

Pozn´

amka 8.2.4 (PovRAY)

Od prvn´ıho tˇ

elesa odeˇ

c´ıt´

a (odeb´ır´

a) vˇ

sechny dalˇ

s´ı ze

seznamu.

difference{teleso1 teleso2 teleso3[OBJ ECT M ODIF IERS...]}

r.

rozd´ıl kv´

adru s vrcholy

V

1

(0

,

0

,

0),

V

2

(1

,

2

,

1) a koule o stˇredu

S

(1

,

2

,

1) a

po-lomˇ

eru

r

= 1, v´

ysledek je pootoˇ

cen, rozmˇ

erovˇ

e deformov´

an a posunut

difference{ box{<0,0,0>, <1,2,1>} sphere{<1,2,1>,1} pigment{color rgb<1,0,0>} rotate<0,60,0> scale<1.5, .9,1> translate<−1.5,0,0> }

(4)

8.2.3

Reˇ

ˇ

sen´

e pˇ

r´ıklady

Domeˇ

cek

#include ”colors.inc”//barvy #include ”glass.inc”// sklo #include ”woods.inc”// drevo #include ”skies.inc”// obloha

sky sphere{S Cloud2}// obloha jako vnitrni povrch kulove plochy camera{location<13,5,−12>look at<0,5,0>}

light source{<10,10,−10>color rgb 0.7}//hlavni svetelny zdroj light source{<−10,5,−10>color rgb 0.2}//pomocny svetelny zdroj background{color rgb<0,0,1>}

(5)

/* ————– zdi ————– */ difference{ box{<−5,0,−5>, <5,5,5>} box{<−4.5,0.1,−4.5>, <4.5,5,4.5>} box{<2,0.1,−6>, <4,4,−4>} box{<−4,2,−6>, <0,4,6>} box{<6,2,−3>, <−6,4,3>}

pigment{brick rgb<1,1,1>rgb<1,0,0>scale< .1, .1, .15>} }

/* ————– okna ————– */ difference{

box{<−4.9,0,−4.9>, <4.9,5,4.9>} box{<−4.6,0.1,−4.6>, <4.6,5,4.6>} pigment{Col Glass Old}

} /* ————– dvere ————– */ difference{ box{<2,0.1,−4.95>, <4,4,−4.55>} cylinder{<2.5,3.5,−5>, <2.5,3.5,−4.5> .2} cylinder{<3,3,−5>, <3,3,−4.5> .2} cylinder{<3.5,2.5,−5>, <3.5,2.5,−4.5> .2} texture{T Wood8} } /* ————– komin ————– */ box{ <4,5,2>, <3,10,1>

pigment{brick rgb<1,1,1>rgb<1,0,0>scale< .1, .1, .1>} }

(6)

Hrnky

#include ”colors.inc” #include ”skies.inc”

camera{location<−7,5,−11>look at<−2,3,4>} light source{<−6,10,−10>color rgb 1 shadowless} plane{<0,1,0>, 0 pigment{checker Black White}} sky sphere{S Cloud2}

/* ————– hrnek ————– */ #declare hrnek = union{

(7)

}

/* ————– podsalek ————– */ #declare podsalek = union{ difference{

cone{<0,0.1,0>,2.3,<0,1,0>,4} cone{<0,0.3,0>,2.1,<0,1.1,0>,4.1} }

difference{

torus{3.9, 0.1 scale<0,0.5,0>translate<0,1,0>} cone{<0,0.3,0>,2.1,<0,1.1,0>,4.1}

}

torus{2.2, 0.1 scale<0,0.5,0>translate<0,0.1,0>} }

/* ————– kava ————– */

#declare kava = cylinder{<0,0,0>,<0,1,0>,1.8 pigment{color Black}}

/* ————– 1. hrnek ————– */

object{hrnek pigment{color Yellow}translate<1,0.3,1>} object{podsalek pigment{color Yellow}translate<1,0,1>}

/* ————– 2. hrnek ————– */

object{hrnek pigment{color YellowGreen}rotate<0,220,0>scale< .5, .5, .5>translate<−6,0,0>} object{podsalek pigment{color YellowGreen}scale< .5, .5, .5>translate<−6,0,0>}

object{kava scale< .5, .5, .5>translate<−6,1.8,0>}

/* ————– 3. hrnek ————– */

object{hrnek pigment{color Black}rotate<0,220,0>scale< .7, .7, .7>translate<−2,0,15>finish{reflection .2 ambient 0.2 diffuse 0.9}}

object{podsalek pigment{color Black} scale< .7, .7, .7>translate< −2,0,15>finish{reflection .2 ambient 0.2 diffuse 0.9}}

(8)

8.2.4

Ulohy k procviˇ

´

cen´ı

1. Koule

tˇri prodˇ

eravˇ

en´

e vz´

ajemnˇ

e zanoˇren´

e

koule

2. D´

ama

akladn´ı postaven´ı figur

3. Z´

asobn´ık

asobn´ık ve tvaru zploˇstˇ

el´

eho disku

s

pˇr´ıvodn´ımi

potrub´ımi

ve

smˇ

eru

souˇradn´

ych os

4. Kl´ıˇ

c

kl´ıˇ

c pro ˇsestihrann´

e ˇsrouby s odvrtanou

rukojet´ı

References

Related documents

To facilitate course and program submissions universities, colleges, and career-technical institutions we will be using program accreditations or state board approvals as proof

or information about their expertise, which is repeated mainly with Negation feedback. Social: we mean context information related to a user’s role at work, and

 The relation between action and desire: because user’s actions are mainly determined by his desire and the current context values, and there is only one active user during a

Relatively few outsiders had direct contact with these remote and closed societies, and little real knowledge needed obstruct the creative fantasy of elite ideologues, but

Second, since compliance is conditional on the prescription behavior of physicians, we account for the selectivity of patients into drugs, induced by physicians responding to

Speci…cation four includes an indicator-variable for all prescriptions written at Dragonen’s health center, to control for time invariant heterogeneity regarding the health center,

EMRMS -Cost reduction application and improvement quality of service: - Enter and preview all of the patient's data, their history, their vitals, check on the work

事前テストと事後テストはそれぞれリーディング Part5 から Part7 に分かれており、TOEIC テストの出題形式と同じ形式で Part 5 短文穴埋め問題 13 問、Part 6 長文穴埋め問題 3