1.15.  Príklady grafických zobrazení s použitím základných útvarov

Rovinná lomená čiara definovaná svojimi vrcholmi

(* Rovinná lomená čiara definovaná svojimi vrcholmi *)  linia1 = Line[& ... , 3}, {-1, 5}, {2, 2} } ] ; <br /> g2 = Show[Graphics[linia1]]   <br /> Show[ g2, Axes -> True]

[Graphics:../HTMLFiles/index_93.gif]

[Graphics:../HTMLFiles/index_94.gif]



Obdĺžnik definovaný svojimi vrcholmi
  (* Rectangle defined by its dots *)  rec = Graphics[   {Rectangle[{1, -1}, {2, -0.3}] }   ] ; <br /> g3 = Show[rec, AspectRatio -> 1]

[Graphics:../HTMLFiles/index_96.gif]



Pravidelný päťuholník
 (* Polygon for n = 5 (pentagon) *)  pet1 = Table[{Sin[2 π * n/5.],    Cos[2 π * n/5.] } , {n, 5}] ; <br /> d5 = Graphics[Polygon[pet1]] ;  Show[d5, AspectRatio -> 1]

[Graphics:../HTMLFiles/index_98.gif]



Zobrazenie troch základných útvarov v jednom obrázku

 (* Displayng the three primitives in the same graphics *)  Show[g2, rec, d5, AspectRatio -> Automatic]

[Graphics:../HTMLFiles/index_100.gif]



Pravidelný jedenásťuholník

 (* Polygon for n = 11 *)  pet2 = Table[{Sin[2 π * n/11.],    Cos[2 π * n/11.] } , {n, 11}] ; <br /> Show[Graphics[Polygon[pet2]], AspectRatio -> Automatic]

[Graphics:../HTMLFiles/index_102.gif]



Kružnica so stredom v bode (1, 6) a polomerom 4, mierky na súradnicových osiach sú v pomere zlatého rezu

 (* Circle defined by the center in {1, 6} and radius 4 *)  (* The default ratio of y/x in Mathematica is the GoldenRatio = 0.618 *)  s1 = Graphics[Circle[ {1, 6} , 4 ]] ; <br /> Show[s1]

[Graphics:../HTMLFiles/index_104.gif]



Kruh so stredom v bode (2, 7) a pomerom 4, mierky na súradnicových osiach sú v pomere zlatého rezu

 (* Disk defined by the co - ordinates of its center and radius *)  s2 = Graphics[ Disk[   {2, 7}, 4 ]] ; <br /> Show[s2]

[Graphics:../HTMLFiles/index_106.gif]



Kombinovaný obrázok, s použitím rovnakej mierky na súradnicových osiach

  (* Combined graphics of the upper circle and the disk at ratio y/x = 1 *)  Show[s1, s2, AspectRatio -> 1]

[Graphics:../HTMLFiles/index_108.gif]





Priestorová lomená čiara definovaná svojimi vrcholmi

 (* Broken line in the 3 D space defined by its vertices *)  points = { {1, 0, 2}, {5, 7, -1}, {-2, -3, -4}, {1, 4, 9}} ;  k1 = Line[ points ] ; <br /> g6 = Show[Graphics3D[ k1]]

[Graphics:../HTMLFiles/index_110.gif]



Priestorový mnohouholník

 (* 3 D polygon of the previous example *)  poli = Polygon[   points] ; <br /> g7 = Show[Graphics3D[poli]]

[Graphics:../HTMLFiles/index_112.gif]



Rovnobežnosten

 (* Graphics of a parallelipiped defined by two opposite vertices *)  cu1 = Cuboid[{0, -2, 3}, {3, 4, 5}] <br /> g8 = Show[Graphics3D[cu1]]

[Graphics:../HTMLFiles/index_114.gif]



Kombinácia viacerých základných útvarov

  (* Combined graphics of the polygon and parallelipiped *)  (* The last graphics show the same from a different view point *)  Show[g7, g8]  Show[%, ViewPoint -> {3, -2, 2} ]

[Graphics:../HTMLFiles/index_116.gif]

[Graphics:../HTMLFiles/index_117.gif]