Theory
हर Picture के Building Blocks
एक computer drawing चाहे कितनी भी complex दिखे, यह primitives नाम के basic shapes के एक small set से built है। एक game character, एक diagram, एक font glyph, सब ultimately points, lines, और curves से combined बने हैं।
यह lesson core graphics objects introduce करता है: point, line, circle और ellipse, और polygon। हर एक mathematically कैसे defined है यह जानना matter करता है, क्योंकि अगली unit इन्हें pixel grid पर draw करने के बारे में है, और आप एक ऐसा shape draw नहीं कर सकते जिसे आप describe नहीं कर सकते। Primitives सीखिए, और drawing algorithms sense बनाएँगे।
At a glance
| Object | इससे Defined |
|---|---|
| Point | एक single position: coordinates (x, y) |
| Line | दो endpoints (x1, y1) और (x2, y2) के बीच एक straight segment |
| Circle | एक centre (h, k) से radius r पर सारे points |
| Ellipse | एक circle जैसा पर दो radii के साथ (a horizontal, b vertical) |
| Polygon | Vertices जोड़ते straight line segments का एक closed shape |
Theory
Point, Line, और Round Shapes
Point सबसे basic object है: coordinates (x, y) से दी गई एक single position, एक pixel की तरह drawn। बाकी सब कुछ points से built है।
एक line दो endpoints, (x1, y1) और (x2, y2), को जोड़ने वाला एक straight segment है। यह workhorse primitive है, ज़्यादातर shapes lines से बनी हैं।
एक circle एक centre (h, k) से एक fixed distance, radius r, पर सारे points का set है। एक ellipse circle को generalise करता है: इसकी दो radii हैं, एक horizontal (a) और एक vertical (b), तो यह एक stretched circle जैसा दिखता है। जब a b के बराबर होता है, एक ellipse बस एक circle है। ये round shapes endpoints की बजाय इनके centre और radii से defined हैं।
Theory
Polygons: Lines से Closed Shapes
एक polygon corner points (vertices) के एक set को जोड़ने वाले straight line segments (इसके edges) से बना एक closed figure है। एक triangle एक 3-sided polygon है, एक rectangle एक 4-sided one है, और ऐसे ही आगे।
Polygons essential हैं क्योंकि ये simple lines से complex shapes build करते हैं, और particularly, 3D objects को usually polygons के meshes की तरह model किया जाता है (अक्सर triangles)। तो humble line, end to end closed loops में जुड़कर, लगभग किसी भी shape को represent करने का basis बन जाती है। यही वजह है एक line अच्छी तरह draw करना (अगली unit का focus) इतना foundational है: lines polygons बनाते हैं, और polygons बाकी सब कुछ बनाते हैं।
Quiz
एक circle को एक graphics primitive की तरह कैसे defined किया जाता है?
- एक line की तरह, दो endpoints से
- एक centre point (h, k) से एक fixed distance (radius r) पर सारे points की तरह
- एक closed shape की straight line segments की तरह
- दो अलग radii से, एक horizontal और एक vertical
Show the answer
एक centre point (h, k) से एक fixed distance (radius r) पर सारे points की तरह
एक circle को एक centre point (h, k) से एक fixed distance, radius r, पर सारे points के set की तरह defined किया जाता है; circle पर हर point centre से exactly r दूर है। Option A एक LINE describe करता है (दो endpoints), circle नहीं। Option C एक POLYGON describe करता है (straight line segments का एक closed shape), जो एक smooth curve नहीं है। Option D एक ELLIPSE describe करता है, जिसकी TWO radii हैं (horizontal a और vertical b); एक circle special case है जहाँ दोनों radii equal हैं। तो एक circle को एक centre और एक radius चाहिए; यही इसकी defining description है।
Think first
Shapes को Primitives की तरह Represent करना इन्हें Draw करने के लिए क्यों Matter करता है?
हर image को इसे एक whole की तरह treat करने की बजाय points, lines, circles, और polygons में क्यों break करें? फिर tap कीजिए।
Show the answer
क्योंकि एक computer सिर्फ़ वही draw कर सकता है जिसे यह precisely DESCRIBE कर सकता है, और हर image को कुछ well-defined primitives तक reduce करने का मतलब है आपको सिर्फ़ उन कुछ के लिए algorithms चाहिए, फिर आप इन्हें combine करके कोई भी picture build कर सकते हैं। एक raster display ultimately individual pixels light up करता है, तो एक shape draw करने के लिए computer को exactly calculate करना पड़ता है इससे कौन से pixels belong करते हैं, और वह calculation entirely shape की mathematical definition पर depend करता है। दो endpoints से defined एक line में इसके along कौन से pixels हैं इसके लिए एक clear formula है (यही DDA और Bresenham compute करते हैं); एक centre और radius से defined एक circle में इसके pixels के लिए एक clear rule है; एक polygon बस lines की एक sequence है। क्योंकि ये primitives simple और precisely defined हैं, हम हर एक के लिए efficient, correct drawing algorithms एक बार लिख सकते हैं। फिर कोई भी complex image, चाहे कितनी भी elaborate हो, इन building blocks से assembled है: एक character polygons और curves है, एक diagram lines और circles है, एक 3D model triangles का एक mesh है। यह एक powerful decomposition है: हर possible picture (impossible) के लिए एक bespoke method चाहिए होने की बजाय, आपको एक handful primitives के लिए drawing routines चाहिए, plus इन्हें combine और position करने का एक तरीका (जहाँ transformations आते हैं)। यह mirror करता है कैसे complex programs simple functions से build होते हैं, या complex structures simple parts से। तो shapes को primitives की तरह define करना सिर्फ़ tidy notation नहीं है; यही वह है जो drawing को tractable बनाता है, एक image को primitives की तरह describe कीजिए, और आप इसे pixel by pixel render कर सकते हैं। Simple, precise building blocks किसी भी picture को drawable बनाते हैं।
Summary
Key takeaways
- सारी pictures basic graphics primitives से built हैं।
- एक point एक single position (x, y) है, एक pixel की तरह drawn, सबसे basic element।
- एक line दो endpoints (x1, y1) और (x2, y2) के बीच एक straight segment है।
- एक circle एक centre (h, k) से radius r पर सारे points है; एक ellipse circle जैसा पर दो radii के साथ है (horizontal a, vertical b)।
- एक polygon vertices जोड़ते straight line segments का एक closed shape है (triangle, rectangle, और ऐसे ही आगे)।
- Complex और 3D shapes इन primitives से built हैं (3D अक्सर triangles के polygon meshes की तरह)।
- Memory hook: point, line, circle, ellipse, polygon वे building blocks हैं जिन्हें drawing algorithms render करते हैं।