338 lines
13 KiB
XML
338 lines
13 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
|
|
<svg
|
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
xmlns:cc="http://creativecommons.org/ns#"
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
xmlns:svg="http://www.w3.org/2000/svg"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
width="210mm"
|
|
height="297mm"
|
|
viewBox="0 0 210 297"
|
|
version="1.1"
|
|
id="svg8"
|
|
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
|
sodipodi:docname="sepcompilation.svg"
|
|
inkscape:export-filename="C:\Users\vova\workspace\latex\cs_mipt_faki\term2\seminar02_encapsulation\images\sepcompilation.png"
|
|
inkscape:export-xdpi="300"
|
|
inkscape:export-ydpi="300">
|
|
<defs
|
|
id="defs2" />
|
|
<sodipodi:namedview
|
|
id="base"
|
|
pagecolor="#ffffff"
|
|
bordercolor="#666666"
|
|
borderopacity="1.0"
|
|
inkscape:pageopacity="0.0"
|
|
inkscape:pageshadow="2"
|
|
inkscape:zoom="0.98994949"
|
|
inkscape:cx="243.20281"
|
|
inkscape:cy="570.05869"
|
|
inkscape:document-units="mm"
|
|
inkscape:current-layer="layer1"
|
|
showgrid="false"
|
|
inkscape:window-width="2560"
|
|
inkscape:window-height="1377"
|
|
inkscape:window-x="-8"
|
|
inkscape:window-y="-8"
|
|
inkscape:window-maximized="1" />
|
|
<metadata
|
|
id="metadata5">
|
|
<rdf:RDF>
|
|
<cc:Work
|
|
rdf:about="">
|
|
<dc:format>image/svg+xml</dc:format>
|
|
<dc:type
|
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
<dc:title></dc:title>
|
|
</cc:Work>
|
|
</rdf:RDF>
|
|
</metadata>
|
|
<g
|
|
inkscape:label="Layer 1"
|
|
inkscape:groupmode="layer"
|
|
id="layer1">
|
|
<rect
|
|
style="opacity:1;fill:#e7eef4;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
|
id="rect815"
|
|
width="138.83838"
|
|
height="58.966839"
|
|
x="23.432297"
|
|
y="13.06549" />
|
|
<text
|
|
xml:space="preserve"
|
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Consolas;-inkscape-font-specification:'Consolas, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
|
x="28.503822"
|
|
y="24.373625"
|
|
id="text823"><tspan
|
|
sodipodi:role="line"
|
|
id="tspan821"
|
|
x="28.503822"
|
|
y="24.373625"
|
|
style="stroke-width:0.26458332"><tspan
|
|
style="fill:#0000ff"
|
|
id="tspan845">struct</tspan> Point {</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.503822"
|
|
y="30.547235"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan825"> <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan837">float</tspan> x, y;</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.503822"
|
|
y="36.720848"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan827"></tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.503822"
|
|
y="42.894459"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan829"> <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan841">float</tspan> norm() const;</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.503822"
|
|
y="49.068069"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan831"> <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan843">void</tspan> normalize();</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.503822"
|
|
y="55.24168"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan833"> Point <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan847">operator</tspan>+(<tspan
|
|
style="fill:#0000ff"
|
|
id="tspan851">const</tspan> Point& r) <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan849">const</tspan>;</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.503822"
|
|
y="61.415291"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan835">};</tspan></text>
|
|
<text
|
|
xml:space="preserve"
|
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Consolas;-inkscape-font-specification:'Consolas, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
|
x="25.79151"
|
|
y="11.021605"
|
|
id="text855"><tspan
|
|
sodipodi:role="line"
|
|
id="tspan853"
|
|
x="25.79151"
|
|
y="11.021605"
|
|
style="stroke-width:0.26458332">point.h</tspan></text>
|
|
<rect
|
|
style="opacity:1;fill:#e7eef4;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
|
id="rect815-8"
|
|
width="139.52013"
|
|
height="114.80299"
|
|
x="23.665709"
|
|
y="86.590546" />
|
|
<text
|
|
xml:space="preserve"
|
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Consolas;-inkscape-font-specification:'Consolas, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
|
x="26.57818"
|
|
y="89.27375"
|
|
id="text823-4"><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="89.27375"
|
|
style="fill:#0000ff;stroke-width:0.26458332"
|
|
id="tspan835-0"> </tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="95.447365"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1159"><tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1161">#include</tspan> <cmath></tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="101.62097"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1163"><tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1171">#include</tspan> "point.h"</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="107.79458"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan997" /><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="113.96819"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan995"><tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1001">float</tspan> Point::norm() <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1003">const</tspan> {</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="120.14181"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan969"> <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1005">return</tspan> sqrt(x*x + y*y);</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="126.31542"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan971">}</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="132.48901"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan973" /><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="138.66263"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan975"><tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1007">void</tspan> Point::normalize() {</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="144.83624"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan977"> <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1009">float</tspan> pnorm = norm();</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="151.00984"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan979"> x /= pnorm;</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="157.18346"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan981"> y /= pnorm;</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="163.35707"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan983">}</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="169.53069"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan985" /><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="175.7043"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan987">Point Point::<tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1011">operator</tspan>+(<tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1013">const</tspan> Point& r) <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1015">const</tspan>{</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="181.8779"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan989"> Point result = {x + r.x, y + r.y};</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="188.05151"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan991"> <tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1017">return</tspan> result;</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="26.57818"
|
|
y="194.22513"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan993">}</tspan></text>
|
|
<text
|
|
xml:space="preserve"
|
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Consolas;-inkscape-font-specification:'Consolas, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
|
x="25.736752"
|
|
y="81.801659"
|
|
id="text855-9"><tspan
|
|
sodipodi:role="line"
|
|
id="tspan853-3"
|
|
x="25.736752"
|
|
y="81.801659"
|
|
style="stroke-width:0.26458332">point.cpp</tspan></text>
|
|
<rect
|
|
style="opacity:1;fill:#e7eef4;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
|
id="rect815-6"
|
|
width="139.8732"
|
|
height="58.965"
|
|
x="23.31591"
|
|
y="215.80164" />
|
|
<text
|
|
xml:space="preserve"
|
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Consolas;-inkscape-font-specification:'Consolas, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
|
x="28.386515"
|
|
y="227.10884"
|
|
id="text823-9"><tspan
|
|
sodipodi:role="line"
|
|
x="28.386515"
|
|
y="227.10884"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan835-8"><tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1149">#include</tspan> <iostream></tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.386515"
|
|
y="233.28246"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1143"><tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1151">#include</tspan> "point.h"</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.386515"
|
|
y="239.45607"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1145" /><tspan
|
|
sodipodi:role="line"
|
|
x="28.386515"
|
|
y="245.62967"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1141"><tspan
|
|
style="fill:#0000ff"
|
|
id="tspan1153">int</tspan> main() {</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.386515"
|
|
y="251.80327"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1131"> Point p = {1, 2};</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.386515"
|
|
y="257.97687"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1133"> p.normalize();</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.386515"
|
|
y="264.15048"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1137"> std::cout << p.x << " " << p.y << std::endl;</tspan><tspan
|
|
sodipodi:role="line"
|
|
x="28.386515"
|
|
y="270.3241"
|
|
style="stroke-width:0.26458332"
|
|
id="tspan1139">}</tspan></text>
|
|
<text
|
|
xml:space="preserve"
|
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93888855px;line-height:1.25;font-family:Consolas;-inkscape-font-specification:'Consolas, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
|
x="25.674202"
|
|
y="213.75682"
|
|
id="text855-5"><tspan
|
|
sodipodi:role="line"
|
|
id="tspan853-9"
|
|
x="25.674202"
|
|
y="213.75682"
|
|
style="stroke-width:0.26458332">main.cpp</tspan></text>
|
|
</g>
|
|
</svg>
|